add/change conf-file options; add debug login

This commit is contained in:
lare 2022-11-17 07:20:03 +01:00
parent 9476ec4f63
commit 73de6addc1
4 changed files with 23 additions and 14 deletions

View file

@ -1,13 +1,13 @@
{
"nodes": {
"<nodename>": {
"pub-endpoint": "<clearnet-fqdn/ip-address>",
"api-con": "http://<node-(internal)-ip/hostname>:<port>/",
"pub-endpoint": "<clearnet-fqdn/ip-address>", //optional, recommended
"api-con": "http://<node-(internal)-ip/hostname>:<port>/", // 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-please-replace>", // secret key for session cookies
"flask-debug": false, // optional; default false
"flask-template-dir": "../frontend/" // optional; default "../frontend"
}

View file

@ -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__":

View file

@ -5,10 +5,10 @@
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>{{config["MNT"]}} Autopeering</title>
<link rel="stylesheet" href="/static/style.css">
<link rel="stylesheet" href="{{config['base-dir']}}static/style.css">
</head>
<body>
<header class="flex flex-row"><div></div><a href="/">{{config["MNT"]}} Autopeering</a>{% if "login" in session %}<a href="/logout">logout</a>{% else %} <a href="/login?return=/peer">login</a>{%endif%}</header>
<header class="flex flex-row"><div></div><a href="{{config['base-dir']}}">{{config["MNT"]}} Autopeering</a>{% if "login" in session %}<a href="{{config['base-dir']}}logout">logout</a>{% else %} <a href="{{config['base-dir']}}login?return=/peer">login</a>{%endif%}</header>
<div class="content flex">
{% block content %}
{% endblock %}

View file

@ -16,9 +16,16 @@
</button>
</form>
<form action="" method="post">
<input type="text" name="logincode" id="logincode">
<input type="submit" value="submit">
{% if config["debug-mode"] %}
<form action="" method="post" class="flex">
<label for="debug">Debug login, if you see this in Production contact {{config["MNT"]}}</label><br>
<input type="text" name="mnt" id="mnt" placeholder="YOUR-MNT"><br>
<input type="text" name="asn" id="asn" placeholder="AS4242420000"><br>
<input type="text" name="allowed-v4" id="allowed-v4" placeholder="ipv4 subnet"><br>
<input type="text" name="allowed-v6" id="allowed-v6" placeholder="ipv6 subnet"><br>
<input type="number" name="theanswer" id="theanswer" placeholder="The answer for everything"><br>
<input type="submit" value="login">
</form>
{% endif %}
{% endblock %}