mirror of
https://github.com/WGDashboard/WGDashboard-PRW.git
synced 2026-08-04 06:52:58 +00:00
Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 49b5f45c5a |
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
.idea/*
|
|
||||||
*.db
|
*.db
|
||||||
dist
|
dist
|
||||||
|
|
||||||
|
|||||||
@@ -8,9 +8,9 @@ from .config_utils import config_utils
|
|||||||
class config():
|
class config():
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def filter(config_data: dict, filter_keyword: str) -> tuple[bool, dict]:
|
def filter(config_data: dict, filter_keyword: str) -> tuple[bool, dict]:
|
||||||
"""
|
'''
|
||||||
Helper function to grab a specific part of the config
|
Helper function to grab a specific part of the config
|
||||||
"""
|
'''
|
||||||
lower_filter_keyword = filter_keyword.lower()
|
lower_filter_keyword = filter_keyword.lower()
|
||||||
|
|
||||||
for section_name, section_values in config_data.items():
|
for section_name, section_values in config_data.items():
|
||||||
@@ -23,9 +23,9 @@ class config():
|
|||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def read() -> tuple[bool, dict]:
|
def read() -> tuple[bool, dict]:
|
||||||
"""
|
'''
|
||||||
check some basic things and then return the dict containing the config data
|
check some basic things and then return the dict containing the config data
|
||||||
"""
|
'''
|
||||||
|
|
||||||
ok, candidate_path = config_utils.search_known_paths()
|
ok, candidate_path = config_utils.search_known_paths()
|
||||||
if not ok:
|
if not ok:
|
||||||
@@ -46,7 +46,7 @@ class config():
|
|||||||
|
|
||||||
ok, config_data = config.read()
|
ok, config_data = config.read()
|
||||||
if not ok:
|
if not ok:
|
||||||
log.error("failed to read the config successfully")
|
log.error("failed to read the config succesfully")
|
||||||
return False
|
return False
|
||||||
|
|
||||||
if not config_utils.find_section(config_data, lower_target_section):
|
if not config_utils.find_section(config_data, lower_target_section):
|
||||||
|
|||||||
@@ -8,9 +8,9 @@ import os
|
|||||||
class config_utils():
|
class config_utils():
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def search_known_paths() -> tuple[bool, str]:
|
def search_known_paths() -> tuple[bool, str]:
|
||||||
"""
|
'''
|
||||||
Look at predefined paths on the filesystem for a config file
|
Look at predefined paths on the filesystem for a config file
|
||||||
"""
|
'''
|
||||||
|
|
||||||
possible_config_locations = [
|
possible_config_locations = [
|
||||||
"./config.ini",
|
"./config.ini",
|
||||||
|
|||||||
@@ -40,7 +40,7 @@ class localeman:
|
|||||||
return json.load(lang_file)
|
return json.load(lang_file)
|
||||||
return None
|
return None
|
||||||
|
|
||||||
def get_available_languages(self):
|
def get_available_languages():
|
||||||
available_languages_path = "./static/locales/supported_locales.json"
|
available_languages_path = "./static/locales/supported_locales.json"
|
||||||
|
|
||||||
with open(os.path.join(available_languages_path), "r") as f:
|
with open(os.path.join(available_languages_path), "r") as f:
|
||||||
|
|||||||
@@ -29,9 +29,8 @@ white_list = [
|
|||||||
"/static/",
|
"/static/",
|
||||||
"/api/auth",
|
"/api/auth",
|
||||||
"/api/auth/validate",
|
"/api/auth/validate",
|
||||||
"/api/auth/totp", # Need a GET to see if TOTP is enabled
|
|
||||||
"/api/dashboard/locale",
|
"/api/dashboard/locale",
|
||||||
# "/api/dashboard/configuration",
|
"/api/dashboard/configuration",
|
||||||
"/api/dashboard/theme",
|
"/api/dashboard/theme",
|
||||||
"/api/dashboard/version",
|
"/api/dashboard/version",
|
||||||
"/api/dashboard/totp",
|
"/api/dashboard/totp",
|
||||||
@@ -50,7 +49,6 @@ def authentication_required():
|
|||||||
|
|
||||||
auth_required_flag = config_server.get('auth_req', True)
|
auth_required_flag = config_server.get('auth_req', True)
|
||||||
api_key_enabled = config_server.get("wgdashboard_apikey", False)
|
api_key_enabled = config_server.get("wgdashboard_apikey", False)
|
||||||
app_prefix = config_server.get("app_prefix", "")
|
|
||||||
|
|
||||||
if not auth_required_flag:
|
if not auth_required_flag:
|
||||||
return
|
return
|
||||||
@@ -67,10 +65,6 @@ def authentication_required():
|
|||||||
if flask.session.get("role") == "admin":
|
if flask.session.get("role") == "admin":
|
||||||
return
|
return
|
||||||
|
|
||||||
# Handle Client Dashboard Path
|
|
||||||
if path.startswith(f'{app_prefix}/client'):
|
|
||||||
return
|
|
||||||
|
|
||||||
if routes_utils.is_path_allowed(path, white_list, flask.session):
|
if routes_utils.is_path_allowed(path, white_list, flask.session):
|
||||||
return
|
return
|
||||||
|
|
||||||
|
|||||||
@@ -3,6 +3,6 @@ configparser==7.2.0
|
|||||||
gunicorn==25.3.0
|
gunicorn==25.3.0
|
||||||
sqlalchemy==2.0.48
|
sqlalchemy==2.0.48
|
||||||
Flask==3.1.3
|
Flask==3.1.3
|
||||||
Werkzeug==3.1.7
|
Werkzeug==3.1.8
|
||||||
pyotp==2.9.0
|
pyotp==2.9.0
|
||||||
psutil==7.2.2
|
psutil==7.2.2
|
||||||
Reference in New Issue
Block a user