Made a few tweaks + change the plugins for the services modals

This commit is contained in:
TheophileDiot 2022-12-03 12:00:32 +01:00
parent 6560ca0869
commit fa54ebd491
5 changed files with 50 additions and 8 deletions

View file

@ -68,7 +68,10 @@ class Database:
)
if sqlalchemy_string.startswith("sqlite"):
makedirs(dirname(sqlalchemy_string.split("///")[1]), exist_ok=True)
try:
makedirs(dirname(sqlalchemy_string.split("///")[1]), exist_ok=True)
except FileExistsError:
pass
elif "+" in sqlalchemy_string and "+pymysql" not in sqlalchemy_string:
splitted = sqlalchemy_string.split("+")
sqlalchemy_string = f"{splitted[0]}:{':'.join(splitted[1].split(':')[1:])}"
@ -763,6 +766,12 @@ class Database:
del tmp_config[key]
elif any(key.startswith(f"{s}_") for s in service_names):
del tmp_config[key]
else:
tmp_config[key] = (
{"value": value["value"], "method": "default"}
if methods is True
else value
)
services.append(tmp_config)

View file

@ -59,6 +59,7 @@ def imerge(a, b):
yield i
yield j
# Function to catch SIGHUP and reload the scheduler
def handle_reload(signum, frame):
global reloading, run, scheduler
@ -381,7 +382,6 @@ if __name__ == "__main__":
proc = subprocess_run(
# Reload nginx
["/etc/init.d/nginx", "reload"],
# ["nginx", "-s", "reload"],
stdin=DEVNULL,
stderr=STDOUT,
env=deepcopy(env),

View file

@ -60,7 +60,6 @@ class Tabs {
this.desktopBtns = document.querySelectorAll(
`[${this.prefix}-tabs-desktop] button`
);
console.log(this.desktopBtns);
//MOBILE
this.mobileBtn = document.querySelector(`[${this.prefix}-mobile-select]`);
this.mobileBtnTxt = this.mobileBtn.querySelector(`span`);

View file

@ -1,8 +1,24 @@
{% set current_endpoint = url_for(request.endpoint)[1:].split("/")[-1].strip().replace('_', '-')
%}
{% set global_config =
config["CONFIG"].get_config() %}
{% set plugins = config["CONFIG"].get_plugins() %}
{% set global_config = config["CONFIG"].get_config() %}
{% set plugins = [{
"id": "general",
"order": 999,
"name": "General",
"description": "The general settings for the server",
"version": "0.1",
"settings": {
"SERVER_NAME": {
"context": "multisite",
"default": "www.example.com",
"help": "List of the virtual hosts served by bunkerweb.",
"id": "server-name",
"label": "Server name",
"regex": ".*",
"type": "text"
}
}
}] + config["CONFIG"].get_plugins() %}
<!-- plugin item -->
{% for plugin in plugins %}

View file

@ -1,6 +1,24 @@
{% set current_endpoint = url_for(request.endpoint)[1:].split("/")[-1].strip().replace('_', '-')
%}
{% set plugins = [{
"id": "general",
"order": 999,
"name": "General",
"description": "The general settings for the server",
"version": "0.1",
"settings": {
"SERVER_NAME": {
"context": "multisite",
"default": "www.example.com",
"help": "List of the virtual hosts served by bunkerweb.",
"id": "server-name",
"label": "Server name",
"regex": ".*",
"type": "text"
}
}
}] + config["CONFIG"].get_plugins() %}
<div {{current_endpoint}}-tabs class="col-span-12 grid grid-cols-12 {% if current_endpoint == 'services' %}mb-4{% endif %}">
<!-- desktop tabs -->
<div {{current_endpoint}}-tabs-desktop class="hidden md:block col-span-12">
@ -41,7 +59,7 @@
<!-- end general tab-->
{% endif %}
<!-- tabs -->
{% for plugin in config["CONFIG"].get_plugins() %} {% if current_endpoint == "services" and plugin["settings"]
{% for plugin in plugins %} {% if current_endpoint == "services" and plugin["settings"]
and check_settings(plugin["settings"], "multisite") or current_endpoint == "global-config" and plugin["settings"]
and check_settings(plugin["settings"], "global") %}
<button
@ -136,7 +154,7 @@
<!-- end general button-->
{% endif %}
{% for plugin in config["CONFIG"].get_plugins() %} {% if current_endpoint == "services" and plugin["settings"]
{% for plugin in plugins %} {% if current_endpoint == "services" and plugin["settings"]
and check_settings(plugin["settings"], "multisite") or current_endpoint == "global-config" and plugin["settings"]
and check_settings(plugin["settings"], "global") %}
<button