mirror of
https://github.com/donaldzou/WGDashboard.git
synced 2026-01-12 13:36:17 +00:00
Fix: Fixed support for WGDashboardClient, now its static files are processed separately
This commit is contained in:
@@ -4,8 +4,9 @@ from tzlocal import get_localzone
|
|||||||
|
|
||||||
from functools import wraps
|
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 os
|
||||||
|
import mimetypes
|
||||||
|
|
||||||
from modules.WireguardConfiguration import WireguardConfiguration
|
from modules.WireguardConfiguration import WireguardConfiguration
|
||||||
from modules.DashboardConfig import DashboardConfig
|
from modules.DashboardConfig import DashboardConfig
|
||||||
@@ -192,6 +193,14 @@ def createClientBlueprint(wireguardConfigurations: dict[WireguardConfiguration],
|
|||||||
})
|
})
|
||||||
return ResponseObject(status, msg)
|
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)
|
@client.get(prefix)
|
||||||
def ClientIndex():
|
def ClientIndex():
|
||||||
app_prefix = dashboardConfig.GetConfig("Server", "app_prefix")[1]
|
app_prefix = dashboardConfig.GetConfig("Server", "app_prefix")[1]
|
||||||
|
|||||||
@@ -255,7 +255,8 @@ def auth_req():
|
|||||||
'getDashboardTheme', 'getDashboardVersion', 'sharePeer/get', 'isTotpEnabled', 'locale',
|
'getDashboardTheme', 'getDashboardVersion', 'sharePeer/get', 'isTotpEnabled', 'locale',
|
||||||
'/fileDownload',
|
'/fileDownload',
|
||||||
'/client',
|
'/client',
|
||||||
'/assets/', '/img/', '/json/'
|
'/assets/', '/img/', '/json/',
|
||||||
|
'/client/assets/', '/client/img/'
|
||||||
]
|
]
|
||||||
|
|
||||||
if (("username" not in session or session.get("role") != "admin")
|
if (("username" not in session or session.get("role") != "admin")
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
<html lang="">
|
<html lang="">
|
||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8">
|
<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">
|
<link rel="icon" href="./img/Logo-2-128x128.png">
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
<title>WGDashboard Client</title>
|
<title>WGDashboard Client</title>
|
||||||
|
|||||||
Reference in New Issue
Block a user