Merge pull request #347 from TheophileDiot/1.5

Update the UI back for the future new front
This commit is contained in:
Théophile Diot 2022-11-11 15:07:38 +01:00 committed by GitHub
commit 47afdc88e1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 8 deletions

View File

@ -25,7 +25,7 @@ from flask import (
)
from flask_login import LoginManager, login_required, login_user, logout_user
from flask_wtf.csrf import CSRFProtect, CSRFError, generate_csrf
from json import JSONDecodeError, load as json_load
from json import JSONDecodeError, dumps, load as json_load
from jinja2 import Template
from os import chmod, getenv, getpid, listdir, mkdir, walk
from os.path import exists, isdir, isfile, join
@ -478,7 +478,7 @@ def services():
# Display services
services = app.config["CONFIG"].get_services()
return render_template("services.html", services=services)
return render_template("services.html", services=[dumps(service) for service in services])
@app.route("/global_config", methods=["GET", "POST"])
@ -535,9 +535,8 @@ def global_config():
)
)
# Display services
services = app.config["CONFIG"].get_services()
return render_template("global_config.html", services=services)
# Display global config
return render_template("global_config.html")
@app.route("/configs", methods=["GET", "POST"])

View File

@ -1,4 +1,3 @@
from base64 import b64encode
from datetime import datetime
from typing import List, Union
from bs4 import BeautifulSoup, Tag
@ -388,7 +387,7 @@ def path_to_dict(
or magic_file.startswith("application/json")
):
with open(path, "rb") as f:
d["content"] = b64encode(f.read()).decode("utf-8")
d["content"] = f.read().decode("utf-8")
else:
config_types = [
"http",
@ -430,7 +429,7 @@ def path_to_dict(
"path": f"{path}/{type_lower}{'/' + conf['service_id'] if conf['service_id'] else ''}/{conf['name']}.conf",
"can_edit": conf["method"] == "ui",
"can_download": True,
"content": b64encode(conf["data"]).decode("utf-8"),
"content": conf["data"].decode("utf-8"),
}
if (