This commit is contained in:
Donald Zou
2025-08-16 17:20:44 +08:00
parent 37546515be
commit 288068bf70
3 changed files with 2 additions and 30 deletions

View File

@@ -1462,7 +1462,7 @@ DashboardPlugin: DashboardPlugins = DashboardPlugins(app, WireguardConfiguration
InitWireguardConfigurationsList(startup=True)
app.static_url_path = f'{APP_PREFIX}/static'
with app.app_context():
DashboardClients: DashboardClients = DashboardClients(WireguardConfigurations)
app.register_blueprint(createClientBlueprint(WireguardConfigurations, DashboardConfig, DashboardClients))

View File

@@ -10,31 +10,6 @@
<link rel="icon" href="/img/Logo-2-512x512.png">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>WGDashboard</title>
<script type="javascript">
// Runtime base path detection
function getBasePath() {
const path = window.location.pathname
const segments = path.split('/')
const staticIndex = segments.indexOf('static')
if (staticIndex > 0) {
return segments.slice(0, staticIndex + 1).join('/') + '/app/dist/'
}
return '/static/app/dist/'
}
// Update document base if needed
const currentBase = document.querySelector('base')?.href || window.location.origin + '/'
const detectedBase = window.location.origin + getBasePath()
console.log(detectedBase)
if (currentBase !== detectedBase) {
const baseTag = document.querySelector('base') || document.createElement('base')
baseTag.href = detectedBase
if (!document.querySelector('base')) {
document.head.appendChild(baseTag)
}
}
</script>
</head>
<body>
<div id="app"></div>

View File

@@ -32,10 +32,7 @@ export default defineConfig(({mode}) => {
}
return {
base: "/",
define: {
__RUNTIME_BASE_DETECTION__: true
},
base: "/static/app/dist",
plugins: [
vue(),
],