mirror of
https://github.com/bunkerity/bunkerweb
synced 2026-05-24 09:28:37 +00:00
Fix redundant code and improve error handling in manage_bunkerweb function
This commit is contained in:
parent
3437d8610e
commit
dd0574aa78
2 changed files with 2 additions and 7 deletions
|
|
@ -201,7 +201,6 @@ def manage_bunkerweb(method: str, *args, operation: str = "reloads", is_draft: b
|
|||
# Do the operation
|
||||
error = 0
|
||||
ui_data = get_ui_data()
|
||||
operation = ""
|
||||
|
||||
if "TO_FLASH" not in ui_data:
|
||||
ui_data["TO_FLASH"] = []
|
||||
|
|
@ -214,11 +213,7 @@ def manage_bunkerweb(method: str, *args, operation: str = "reloads", is_draft: b
|
|||
elif operation == "delete":
|
||||
operation, error = app.config["CONFIG"].delete_service(args[2], check_changes=(was_draft != is_draft or not is_draft))
|
||||
|
||||
if error:
|
||||
ui_data["TO_FLASH"].append({"content": operation, "type": "error"})
|
||||
else:
|
||||
ui_data["TO_FLASH"].append({"content": operation, "type": "success"})
|
||||
|
||||
if not error:
|
||||
if was_draft != is_draft or not is_draft:
|
||||
# update changes in db
|
||||
ret = db.checked_changes(["config", "custom_configs"], value=True)
|
||||
|
|
|
|||
|
|
@ -136,7 +136,7 @@ class Config:
|
|||
|
||||
return error
|
||||
|
||||
def reload_config(self) -> str:
|
||||
def reload_config(self) -> Optional[str]:
|
||||
return self.__gen_conf(self.get_config(methods=False), self.get_services(methods=False))
|
||||
|
||||
def new_service(self, variables: dict, is_draft: bool = False) -> Tuple[str, int]:
|
||||
|
|
|
|||
Loading…
Reference in a new issue