MCPcopy Create free account
hub / github.com/aaPanel/BaoTa / set_static_path

Method set_static_path

mod/project/java/projectMod.py:3596–3634  ·  view source on GitHub ↗
(self, get)

Source from the content-addressed store, hash-verified

3594 return json_response(status = True, data = data)
3595
3596 def set_static_path(self, get):
3597 try:
3598 project_name = get.project_name.strip()
3599 project_data = self.get_project_find(project_name)
3600 status = utils.js_value_to_bool(get.status)
3601 index = get.index.strip()
3602 path = get.path.strip()
3603 except:
3604 return json_response(status = False, msg = "参数错误")
3605
3606 if not project_data:
3607 return json_response(False, "未找到项目")
3608
3609 if not project_data["project_config"]["java_type"] == "springboot":
3610 return json_response(status = False, msg = "非springboot项目无法设置静态文件")
3611
3612 proxy_info = project_data['project_config'].get("proxy_info", [])
3613 for i in proxy_info:
3614 if i["proxy_dir"] == "/":
3615 return json_response(status = False, msg = "项目已存在根路由【/】配置,无法设置态文件配置")
3616
3617 project_data["project_config"]["static_info"] = {
3618 "status": status,
3619 "index": index,
3620 "path": path,
3621 "use_try_file": True,
3622 }
3623
3624 res = self._set_static_path(project_data)
3625 if isinstance(res, str):
3626 return json_response(status = False, msg = res)
3627
3628 public.M("sites").where("id=?", (project_data["id"],)).update(
3629 {
3630 "project_config": json.dumps(project_data["project_config"])
3631 }
3632 )
3633
3634 return json_response(status = True, msg = "设置成功")
3635
3636 def get_keep_status(self, get):
3637 try:

Callers 1

create_projectMethod · 0.95

Calls 8

get_project_findMethod · 0.95
json_responseFunction · 0.90
_set_static_pathMethod · 0.80
getMethod · 0.45
updateMethod · 0.45
whereMethod · 0.45
MMethod · 0.45
dumpsMethod · 0.45

Tested by

no test coverage detected