mirror of
https://github.com/bunkerity/bunkerweb
synced 2026-05-24 09:28:37 +00:00
Fix template configuration retrieval and streamline plugin base definition in Database class
This commit is contained in:
parent
511e79aae8
commit
d4603b91f2
1 changed files with 13 additions and 10 deletions
|
|
@ -612,7 +612,7 @@ class Database:
|
|||
old_template_settings[(ts.template_id, ts.setting_id, ts.suffix, ts.step_id)] = ts
|
||||
|
||||
old_template_configs = {}
|
||||
for tc in old_data.get("bw_template_configs", []):
|
||||
for tc in old_data.get("bw_template_custom_configs", []):
|
||||
old_template_configs[(tc.template_id, tc.type, tc.name, tc.step_id)] = tc
|
||||
|
||||
# Build desired data from default_plugins
|
||||
|
|
@ -750,21 +750,24 @@ class Database:
|
|||
for plugin in plugins:
|
||||
if "id" not in plugin:
|
||||
# General plugin
|
||||
base_plugin = {
|
||||
"id": "general",
|
||||
"type": "core",
|
||||
}
|
||||
base_plugin = {"id": "general", "type": "core"}
|
||||
else:
|
||||
base_plugin = {
|
||||
"id": plugin["id"],
|
||||
"type": plugin.get("type", "core"),
|
||||
}
|
||||
base_plugin = {"id": plugin["id"], "type": plugin.get("type", "core")}
|
||||
|
||||
# Skip unsupported plugin
|
||||
if base_plugin["id"] == "letsencrypt_dns":
|
||||
continue
|
||||
|
||||
# TEMPLATES
|
||||
plugin_path = (
|
||||
Path("/", "usr", "share", "bunkerweb", "core", base_plugin["id"])
|
||||
if base_plugin.get("type", "core") == "core"
|
||||
else (
|
||||
Path("/", "etc", "bunkerweb", "plugins", base_plugin["id"])
|
||||
if base_plugin.get("type", "core") == "external"
|
||||
else Path("/", "etc", "bunkerweb", "pro", "plugins", base_plugin["id"])
|
||||
)
|
||||
)
|
||||
templates_path = plugin_path.joinpath("templates")
|
||||
if templates_path.is_dir():
|
||||
for template_file in templates_path.iterdir():
|
||||
|
|
@ -807,7 +810,7 @@ class Database:
|
|||
continue
|
||||
# Check if setting exists globally
|
||||
setting_id = setting
|
||||
suffix = None
|
||||
suffix = 0
|
||||
if hasattr(self, "suffix_rx") and self.suffix_rx.search(setting):
|
||||
setting_id, suffix = setting.rsplit("_", 1)
|
||||
if setting_id not in saved_settings:
|
||||
|
|
|
|||
Loading…
Reference in a new issue