From c1663e42cc03236d1b3239e3f62f07f5e8f87e46 Mon Sep 17 00:00:00 2001 From: lare Date: Thu, 17 Nov 2022 07:20:03 +0100 Subject: [PATCH] add/change conf-file options; add debug login --- web/backend/config.sample.json | 11 ++++++----- web/backend/main.py | 9 +++++---- web/frontend/base.html | 4 ++-- web/frontend/login.html | 13 ++++++++++--- 4 files changed, 23 insertions(+), 14 deletions(-) diff --git a/web/backend/config.sample.json b/web/backend/config.sample.json index be34908..cb7625b 100644 --- a/web/backend/config.sample.json +++ b/web/backend/config.sample.json @@ -1,13 +1,13 @@ { "nodes": { "": { - "pub-endpoint": "", - "api-con": "http://:/", + "pub-endpoint": "", //optional, recommended + "api-con": "http://:/", // required "comment": "/* from here: data to be displayed on the webinterface */", "country": "...", // Countrycode: 2 capital letters "city": "...", - "wg-key": "...=", // pubkey of node - "internal-v4": "172.2x.xxx.xxx", + "wg-key": "...=", // pubkey of node; required + "internal-v4": "172.2x.xxx.xxx", //at least one ipv{4,6} addr required "internal-v6": "fdxx:...", "internal-v4ll": "169.254.xxx.xxx", "internal-v6ll": "fe80::..." @@ -17,7 +17,8 @@ "listen": "0.0.0.0", "port": 8042, "domain": "example.org", // domain to use for kioubit verification service + "base-dir": "/", //optional:directury for which it is reachable (if behind some sort of reverse proxy) default "/" + "debug-mode": false, // optional; whethet to enable debugging; default false "flask-secret-key": "", // secret key for session cookies - "flask-debug": false, // optional; default false "flask-template-dir": "../frontend/" // optional; default "../frontend" } \ No newline at end of file diff --git a/web/backend/main.py b/web/backend/main.py index ff80c5f..76c91ba 100644 --- a/web/backend/main.py +++ b/web/backend/main.py @@ -36,9 +36,10 @@ class Config (dict): if not "flask-template-dir" in self._config: self._config["flask-template-dir"] = "../frontend" - if not "flask-debug" in self._config: - self._config["flask-debug"] = False - + if not "debug-mode" in self._config: + self._config["debug-mode"] = False + if not "base-dir" in self._config: + self._config["base-dir"] = "/" print(self._config) config = Config() @@ -122,7 +123,7 @@ def main(): app.static_folder= config["flask-template-dir"]+"/static/" app.template_folder=config["flask-template-dir"] app.secret_key = config["flask-secret-key"] - app.run(host=config["listen"], port=config["port"], debug=config["flask-debug"], threaded=True) + app.run(host=config["listen"], port=config["port"], debug=config["debug-mode"], threaded=True) if __name__ == "__main__": diff --git a/web/frontend/base.html b/web/frontend/base.html index ffd4327..b1b1d8a 100644 --- a/web/frontend/base.html +++ b/web/frontend/base.html @@ -5,10 +5,10 @@ {{config["MNT"]}} Autopeering - + -
{{config["MNT"]}} Autopeering{% if "login" in session %}logout{% else %} login{%endif%}
+
{{config["MNT"]}} Autopeering{% if "login" in session %}logout{% else %} login{%endif%}
{% block content %} {% endblock %} diff --git a/web/frontend/login.html b/web/frontend/login.html index cb176bf..eaa4afb 100644 --- a/web/frontend/login.html +++ b/web/frontend/login.html @@ -16,9 +16,16 @@ -
- - +{% if config["debug-mode"] %} + +
+
+
+
+
+
+
+{% endif %} {% endblock %} \ No newline at end of file