Added full support for the app-prefix parameter

This commit is contained in:
leviofanh
2025-12-18 02:38:05 +01:00
parent d51c543346
commit 9e9f07408d
8 changed files with 35 additions and 15 deletions

View File

@@ -72,7 +72,11 @@ def ResponseObject(status=True, message=None, data=None, status_code = 200) -> F
'''
Flask App
'''
app = Flask("WGDashboard", template_folder=os.path.abspath("./static/dist/WGDashboardAdmin"))
_, APP_PREFIX_INIT = DashboardConfig().GetConfig("Server", "app_prefix")
app = Flask("WGDashboard",
template_folder=os.path.abspath("./static/dist/WGDashboardAdmin"),
static_folder=os.path.abspath("./static/dist/WGDashboardAdmin"),
static_url_path=APP_PREFIX_INIT if APP_PREFIX_INIT else '')
def peerInformationBackgroundThread():
global WireguardConfigurations
@@ -250,7 +254,8 @@ def auth_req():
'/static/', 'validateAuthentication', 'authenticate', 'getDashboardConfiguration',
'getDashboardTheme', 'getDashboardVersion', 'sharePeer/get', 'isTotpEnabled', 'locale',
'/fileDownload',
'/client'
'/client',
'/assets/', '/img/', '/json/'
]
if (("username" not in session or session.get("role") != "admin")
@@ -1698,7 +1703,7 @@ Index Page
@app.get(f'{APP_PREFIX}/')
def index():
return render_template('index.html')
return render_template('index.html', APP_PREFIX=APP_PREFIX)
if __name__ == "__main__":
startThreads()