Fix: Fixed support for WGDashboardClient, now its static files are processed separately
parent
721ac89420
commit
f58e572558
|
|
@ -4,8 +4,9 @@ from tzlocal import get_localzone
|
|||
|
||||
from functools import wraps
|
||||
|
||||
from flask import Blueprint, render_template, abort, request, Flask, current_app, session, redirect, url_for
|
||||
from flask import Blueprint, render_template, abort, request, Flask, current_app, session, redirect, url_for, send_from_directory
|
||||
import os
|
||||
import mimetypes
|
||||
|
||||
from modules.WireguardConfiguration import WireguardConfiguration
|
||||
from modules.DashboardConfig import DashboardConfig
|
||||
|
|
@ -192,6 +193,14 @@ def createClientBlueprint(wireguardConfigurations: dict[WireguardConfiguration],
|
|||
})
|
||||
return ResponseObject(status, msg)
|
||||
|
||||
@client.get(f'{prefix}/assets/<path:filename>')
|
||||
@client.get(f'{prefix}/img/<path:filename>')
|
||||
def serve_client_static(filename):
|
||||
client_dist_folder = os.path.abspath("./static/dist/WGDashboardClient")
|
||||
mimetype = mimetypes.guess_type(filename)[0]
|
||||
subfolder = 'assets' if 'assets' in request.path else 'img'
|
||||
return send_from_directory(os.path.join(client_dist_folder, subfolder), os.path.basename(filename), mimetype=mimetype)
|
||||
|
||||
@client.get(prefix)
|
||||
def ClientIndex():
|
||||
app_prefix = dashboardConfig.GetConfig("Server", "app_prefix")[1]
|
||||
|
|
|
|||
|
|
@ -255,7 +255,8 @@ def auth_req():
|
|||
'getDashboardTheme', 'getDashboardVersion', 'sharePeer/get', 'isTotpEnabled', 'locale',
|
||||
'/fileDownload',
|
||||
'/client',
|
||||
'/assets/', '/img/', '/json/'
|
||||
'/assets/', '/img/', '/json/',
|
||||
'/client/assets/', '/client/img/'
|
||||
]
|
||||
|
||||
if (("username" not in session or session.get("role") != "admin")
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
<html lang="">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<base href="{{ APP_PREFIX if APP_PREFIX else '' }}/">
|
||||
<base href="{{ APP_PREFIX if APP_PREFIX else '' }}/client/">
|
||||
<link rel="icon" href="./img/Logo-2-128x128.png">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>WGDashboard Client</title>
|
||||
|
|
|
|||
Loading…
Reference in New Issue