Merge pull request #351 from TheophileDiot/1.5
Change the way services are sent to the UI
This commit is contained in:
commit
8dd377562f
|
@ -727,12 +727,19 @@ class Database:
|
|||
services = []
|
||||
config = self.get_config(methods=methods)
|
||||
with self.__db_session() as session:
|
||||
for service in session.query(Services).with_entities(Services.id).all():
|
||||
service_names = [
|
||||
service.id
|
||||
for service in session.query(Services).with_entities(Services.id).all()
|
||||
]
|
||||
for service in service_names:
|
||||
tmp_config = deepcopy(config)
|
||||
|
||||
for key, value in deepcopy(tmp_config).items():
|
||||
if key.startswith(f"{service.id}_"):
|
||||
tmp_config[key.replace(f"{service.id}_", "")] = value
|
||||
if key.startswith(f"{service}_"):
|
||||
tmp_config[key.replace(f"{service}_", "")] = value
|
||||
del tmp_config[key]
|
||||
elif any(key.startswith(f"{s}_") for s in service_names):
|
||||
del tmp_config[key]
|
||||
|
||||
services.append(tmp_config)
|
||||
|
||||
|
|
|
@ -1,8 +1,3 @@
|
|||
from subprocess import DEVNULL, STDOUT, run
|
||||
from sys import path as sys_path, exit as sys_exit, modules as sys_modules
|
||||
|
||||
sys_path.append("/usr/share/bunkerweb/deps/python")
|
||||
|
||||
from bs4 import BeautifulSoup
|
||||
from copy import deepcopy
|
||||
from datetime import datetime, timezone
|
||||
|
@ -33,6 +28,7 @@ from re import match as re_match
|
|||
from requests import get
|
||||
from requests.utils import default_headers
|
||||
from shutil import rmtree, copytree, chown
|
||||
from sys import path as sys_path, exit as sys_exit, modules as sys_modules
|
||||
from tarfile import CompressionError, HeaderError, ReadError, TarError, open as tar_open
|
||||
from threading import Thread
|
||||
from time import time
|
||||
|
@ -479,7 +475,11 @@ def services():
|
|||
# Display services
|
||||
services = app.config["CONFIG"].get_services()
|
||||
return render_template(
|
||||
"services.html", services=[dumps(service) for service in services]
|
||||
"services.html",
|
||||
services=[
|
||||
{"SERVER_NAME": service.pop("SERVER_NAME"), "settings": dumps(service)}
|
||||
for service in services
|
||||
],
|
||||
)
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue