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

@@ -6,10 +6,14 @@
<meta name="apple-mobile-web-app-capable" content="yes">
<meta name="application-name" content="WGDashboard">
<meta name="apple-mobile-web-app-title" content="WGDashboard">
<link rel="manifest" href="/json/manifest.json">
<link rel="icon" href="/img/Logo-2-512x512.png">
<base href="{{ APP_PREFIX if APP_PREFIX else '' }}/">
<link rel="manifest" href="./json/manifest.json">
<link rel="icon" href="./img/Logo-2-512x512.png">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>WGDashboard</title>
<script>
window.APP_PREFIX = "{{ APP_PREFIX if APP_PREFIX else '' }}";
</script>
</head>
<body>
<div id="app"></div>

View File

@@ -27,8 +27,11 @@ export const getUrl = (url) => {
if (apiKey){
return `${apiKey.host}${url}`
}
return import.meta.env.MODE === 'development' ? url
: `${window.location.protocol}//${(window.location.host + window.location.pathname + url).replace(/\/\//g, '/')}`
if (import.meta.env.MODE === 'development') {
return url;
}
const appPrefix = window.APP_PREFIX || '';
return `${window.location.protocol}//${window.location.host}${appPrefix}${url}`;
}
export const fetchGet = async (url, params=undefined, callback=undefined) => {

View File

@@ -32,7 +32,7 @@ export default defineConfig(({mode}) => {
}
return {
base: "/static/dist/WGDashboardAdmin",
base: "./",
plugins: [
vue(),
],