diff --git a/src/dashboard.py b/src/dashboard.py index 94cdd12..07959e6 100644 --- a/src/dashboard.py +++ b/src/dashboard.py @@ -35,6 +35,7 @@ dashboard_conf = 'wg-dashboard.ini' update = "" # Flask App Configuration app = Flask("WGDashboard") +app.config['SEND_FILE_MAX_AGE_DEFAULT'] = 5206928 app.secret_key = secrets.token_urlsafe(16) app.config['TEMPLATES_AUTO_RELOAD'] = True # Enable QR Code Generator @@ -456,6 +457,7 @@ Flask Functions # Before request @app.before_request def auth_req(): + conf = configparser.ConfigParser(strict=False) conf.read(dashboard_conf) req = conf.get("Server", "auth_req") @@ -1255,4 +1257,13 @@ if __name__ == "__main__": 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) \ No newline at end of file + app.run(host=app_ip, debug=False, port=app_port) +else: + init_dashboard() + update = check_update() + config = configparser.ConfigParser(strict=False) + config.read('wg-dashboard.ini') + app_ip = config.get("Server", "app_ip") + app_port = config.get("Server", "app_port") + wg_conf_path = config.get("Server", "wg_conf_path") + config.clear() \ No newline at end of file diff --git a/src/wgd.sh b/src/wgd.sh index eea9ece..5eabe42 100755 --- a/src/wgd.sh +++ b/src/wgd.sh @@ -48,13 +48,13 @@ install_wgd(){ # set up the local environment _check_and_set_venv - python3 -m pip install -U -r requirements.txt > /dev/null 2>&1 + ${VIRTUAL_ENV} -m pip install -U -r requirements.txt > /dev/null 2>&1 printf "| WGDashboard installed successfully! |\n" printf "| Preparing the systemctl unit file |\n" sed -i "s#{{APP_ROOT}}#${APP_ROOT}#" wg-dashboard.service sed -i "s#{{VIRTUAL_ENV}}#${VIRTUAL_ENV}#" wg-dashboard.service - cat wg-dashboard.service | sudo SYSTEMD_EDITOR=tee systemctl edit --force --full wg-dashboard.service +# cat wg-dashboard.service | sudo SYSTEMD_EDITOR=tee systemctl edit --force --full wg-dashboard.service systemctl daemon-reload printf "| Consider 'systemctl enable wg-dashboard' |\n" printf " and 'systemctl start wg-dashboard'\n"