mirror of
https://github.com/WGDashboard/WGDashboard-PRW.git
synced 2026-08-04 15:02:59 +00:00
Compare commits
2 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 360363141a | |||
| 456484cf7d |
+1
-1
@@ -1,4 +1,4 @@
|
||||
|
||||
.idea/*
|
||||
*.db
|
||||
dist
|
||||
|
||||
|
||||
@@ -8,9 +8,9 @@ from .config_utils import config_utils
|
||||
class config():
|
||||
@staticmethod
|
||||
def filter(config_data: dict, filter_keyword: str) -> tuple[bool, dict]:
|
||||
'''
|
||||
"""
|
||||
Helper function to grab a specific part of the config
|
||||
'''
|
||||
"""
|
||||
lower_filter_keyword = filter_keyword.lower()
|
||||
|
||||
for section_name, section_values in config_data.items():
|
||||
@@ -23,9 +23,9 @@ class config():
|
||||
|
||||
@staticmethod
|
||||
def read() -> tuple[bool, dict]:
|
||||
'''
|
||||
"""
|
||||
check some basic things and then return the dict containing the config data
|
||||
'''
|
||||
"""
|
||||
|
||||
ok, candidate_path = config_utils.search_known_paths()
|
||||
if not ok:
|
||||
@@ -46,7 +46,7 @@ class config():
|
||||
|
||||
ok, config_data = config.read()
|
||||
if not ok:
|
||||
log.error("failed to read the config succesfully")
|
||||
log.error("failed to read the config successfully")
|
||||
return False
|
||||
|
||||
if not config_utils.find_section(config_data, lower_target_section):
|
||||
|
||||
@@ -8,9 +8,9 @@ import os
|
||||
class config_utils():
|
||||
@staticmethod
|
||||
def search_known_paths() -> tuple[bool, str]:
|
||||
'''
|
||||
"""
|
||||
Look at predefined paths on the filesystem for a config file
|
||||
'''
|
||||
"""
|
||||
|
||||
possible_config_locations = [
|
||||
"./config.ini",
|
||||
|
||||
@@ -40,7 +40,7 @@ class localeman:
|
||||
return json.load(lang_file)
|
||||
return None
|
||||
|
||||
def get_available_languages():
|
||||
def get_available_languages(self):
|
||||
available_languages_path = "./static/locales/supported_locales.json"
|
||||
|
||||
with open(os.path.join(available_languages_path), "r") as f:
|
||||
|
||||
@@ -29,8 +29,9 @@ white_list = [
|
||||
"/static/",
|
||||
"/api/auth",
|
||||
"/api/auth/validate",
|
||||
"/api/auth/totp", # Need a GET to see if TOTP is enabled
|
||||
"/api/dashboard/locale",
|
||||
"/api/dashboard/configuration",
|
||||
# "/api/dashboard/configuration",
|
||||
"/api/dashboard/theme",
|
||||
"/api/dashboard/version",
|
||||
"/api/dashboard/totp",
|
||||
@@ -49,6 +50,7 @@ def authentication_required():
|
||||
|
||||
auth_required_flag = config_server.get('auth_req', True)
|
||||
api_key_enabled = config_server.get("wgdashboard_apikey", False)
|
||||
app_prefix = config_server.get("app_prefix", "")
|
||||
|
||||
if not auth_required_flag:
|
||||
return
|
||||
@@ -64,7 +66,11 @@ def authentication_required():
|
||||
|
||||
if flask.session.get("role") == "admin":
|
||||
return
|
||||
|
||||
|
||||
# Handle Client Dashboard Path
|
||||
if path.startswith(f'{app_prefix}/client'):
|
||||
return
|
||||
|
||||
if routes_utils.is_path_allowed(path, white_list, flask.session):
|
||||
return
|
||||
|
||||
|
||||
Generated
+4
-4
@@ -17,7 +17,7 @@
|
||||
"qrcode": "^1.5.4",
|
||||
"uuid": "^13.0.0",
|
||||
"vue": "^3.5.30",
|
||||
"vue-router": "^5.0.4"
|
||||
"vue-router": "^5.0.3"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@vitejs/plugin-vue": "^6.0.5",
|
||||
@@ -3213,9 +3213,9 @@
|
||||
}
|
||||
},
|
||||
"node_modules/vue-router": {
|
||||
"version": "5.0.4",
|
||||
"resolved": "https://registry.npmjs.org/vue-router/-/vue-router-5.0.4.tgz",
|
||||
"integrity": "sha512-lCqDLCI2+fKVRl2OzXuzdSWmxXFLQRxQbmHugnRpTMyYiT+hNaycV0faqG5FBHDXoYrZ6MQcX87BvbY8mQ20Bg==",
|
||||
"version": "5.0.3",
|
||||
"resolved": "https://registry.npmjs.org/vue-router/-/vue-router-5.0.3.tgz",
|
||||
"integrity": "sha512-nG1c7aAFac7NYj8Hluo68WyWfc41xkEjaR0ViLHCa3oDvTQ/nIuLJlXJX1NUPw/DXzx/8+OKMng045HHQKQKWw==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@babel/generator": "^7.28.6",
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
"qrcode": "^1.5.4",
|
||||
"uuid": "^13.0.0",
|
||||
"vue": "^3.5.30",
|
||||
"vue-router": "^5.0.4"
|
||||
"vue-router": "^5.0.3"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@vitejs/plugin-vue": "^6.0.5",
|
||||
|
||||
Reference in New Issue
Block a user