Compare commits

..
Author SHA1 Message Date
daanselen f4b33de173 Port over the fix from main 2026-11-18 19:02:53 +01:00
Samuel Lock 914a7812e7 Merge commit from fork 2026-11-18 19:01:54 +01:00
4 changed files with 10 additions and 13 deletions
+4 -6
View File
@@ -9,7 +9,7 @@ from zipfile import ZipFile
from datetime import datetime, timedelta
import sqlalchemy
from flask import Flask, request, render_template, session, send_file, current_app
from flask import Flask, request, render_template, session, send_file, current_app, g
from flask_cors import CORS
from icmplib import ping, traceroute
from flask.json.provider import DefaultJSONProvider
@@ -248,7 +248,7 @@ def auth_req():
if request.method.lower() == 'options':
return ResponseObject(True)
DashboardConfig.APIAccessed = False
g.api_key_authenticated = False
authenticationRequired = DashboardConfig.GetConfig("Server", "auth_req")[1]
d = request.headers
if authenticationRequired:
@@ -258,7 +258,6 @@ def auth_req():
apiKeyExist = len(list(filter(lambda x : x.Key == apiKey, DashboardConfig.DashboardAPIKeys))) == 1
DashboardLogger.log(str(request.url), str(request.remote_addr), Message=f"API Key Access: {('true' if apiKeyExist else 'false')} - Key: {apiKey}")
if not apiKeyExist:
DashboardConfig.APIAccessed = False
response = Flask.make_response(app, {
"status": False,
"message": "API Key does not exist",
@@ -267,9 +266,8 @@ def auth_req():
response.content_type = "application/json"
response.status_code = 401
return response
DashboardConfig.APIAccessed = True
g.api_key_authenticated = True
else:
DashboardConfig.APIAccessed = False
appPrefix = APP_PREFIX if len(APP_PREFIX) > 0 else ''
whiteList = [
# f'/static/',
@@ -358,7 +356,7 @@ def API_AuthenticateLogin():
if not DashboardConfig.GetConfig("Server", "auth_req")[1]:
return ResponseObject(True, DashboardConfig.GetConfig("Other", "welcome_session")[1])
if DashboardConfig.APIAccessed:
if getattr(g, 'api_key_authenticated', False):
authToken = hashlib.sha256(f"{request.headers.get('wg-dashboard-apikey')}{datetime.now()}".encode()).hexdigest()
session['role'] = 'admin'
session['username'] = authToken
-1
View File
@@ -98,7 +98,6 @@ class DashboardConfig:
self.dbMetadata = db.MetaData()
self.__createAPIKeyTable()
self.DashboardAPIKeys = self.__getAPIKeys()
self.APIAccessed = False
self.SetConfig("Server", "version", DashboardConfig.DashboardVersion)
def EnsureDatabaseIntegrity(self, wireguardConfigurations):
+5 -5
View File
@@ -8,7 +8,7 @@
"name": "client",
"version": "v1.0.1",
"dependencies": {
"axios": "^1.21.1",
"axios": "^1.21.0",
"bootstrap": "^5.3.8",
"bootstrap-icons": "^1.13.2",
"dayjs": "^1.11.23",
@@ -1230,12 +1230,12 @@
"license": "MIT"
},
"node_modules/axios": {
"version": "1.21.1",
"resolved": "https://registry.npmjs.org/axios/-/axios-1.21.1.tgz",
"integrity": "sha512-6eI5Q/Y4u/Um9dDlsRoq5pY2rxnUTv+L4PpLitnbk/i4jb3MxLZ5CsN5Ih3IysbeRYK4pR+P7qfMsOQl9fwwFQ==",
"version": "1.21.0",
"resolved": "https://registry.npmjs.org/axios/-/axios-1.21.0.tgz",
"integrity": "sha512-YCzXMB53Q9PZBsh7yN7wtapit4WepwcHS2fP8QhGsBxSz5YtgYobV7GGlWlAJi+RxfU77GQTQi2DSLUma42EYA==",
"license": "MIT",
"dependencies": {
"follow-redirects": "^1.16.2",
"follow-redirects": "^1.16.0",
"form-data": "^4.0.6",
"https-proxy-agent": "^5.0.1",
"proxy-from-env": "^2.1.0"
+1 -1
View File
@@ -9,7 +9,7 @@
"preview": "vite preview"
},
"dependencies": {
"axios": "^1.21.1",
"axios": "^1.21.0",
"bootstrap": "^5.3.8",
"bootstrap-icons": "^1.13.2",
"dayjs": "^1.11.23",