diff --git a/src/dashboard.py b/src/dashboard.py index 3cb52f0..8704b1d 100644 --- a/src/dashboard.py +++ b/src/dashboard.py @@ -618,12 +618,11 @@ def check_update(config): for i in output: if not i["prerelease"]: release.append(i) - if config.get("Server", "version") == release[0]["tag_name"]: - result = "false" - else: - result = "true" - return result + if config["Server"]["version"] > release[0]["tag_name"]: + return "true" + + return "false" except urllib.error.HTTPError: return "false" @@ -635,7 +634,7 @@ Configure DashBoard before start web-server def run_dashboard(): global UPDATE - config = util.read_dashboard_conf(DASHBOARD_CONF_FILE) + config = read_and_update_config_file() UPDATE = check_update(config) # global app_ip app_ip = config.get("Server", "app_ip") @@ -661,13 +660,4 @@ def get_host_bind(): if __name__ == "__main__": - # UPDATE = check_update() - # config = util.read_dashboard_conf(DASHBOARD_CONF_FILE) - # # global app_ip - # app_ip = config.get("Server", "app_ip") - # # global app_port - # app_port = config.get("Server", "app_port") - # WG_CONF_PATH = config.get("Server", "wg_conf_path") - # config.clear() - # app.run(host=app_ip, debug=False, port=app_port) run_dashboard() diff --git a/src/default_config.py b/src/default_config.py index d0cbd65..4c794f7 100644 --- a/src/default_config.py +++ b/src/default_config.py @@ -1,9 +1,12 @@ +from dashboard import DASHBOARD_VERSION + dash_config = { "Account": { "username": "admin", "password": "8c6976e5b5410415bde908bd4dee15dfb167a9c873fc4bb8a81f6f2ab448a918", }, "Server": { + "version": DASHBOARD_VERSION, "wg_conf_path": "/etc/wireguard", "auth_req": True, "dashboard_refresh_interval": 60000,