mirror of
https://github.com/donaldzou/WGDashboard.git
synced 2026-01-13 05:56:19 +00:00
Added full support for the app-prefix parameter
This commit is contained in:
@@ -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>
|
||||
|
||||
@@ -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) => {
|
||||
|
||||
@@ -32,7 +32,7 @@ export default defineConfig(({mode}) => {
|
||||
}
|
||||
|
||||
return {
|
||||
base: "/static/dist/WGDashboardAdmin",
|
||||
base: "./",
|
||||
plugins: [
|
||||
vue(),
|
||||
],
|
||||
|
||||
@@ -2,7 +2,8 @@
|
||||
<html lang="">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<link rel="icon" href="/img/Logo-2-128x128.png">
|
||||
<base href="{{ APP_PREFIX if APP_PREFIX else '' }}/">
|
||||
<link rel="icon" href="./img/Logo-2-128x128.png">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>WGDashboard Client</title>
|
||||
<style>
|
||||
@@ -28,15 +29,18 @@
|
||||
}
|
||||
}
|
||||
</style>
|
||||
<script>
|
||||
window.APP_PREFIX = "{{ APP_PREFIX if APP_PREFIX else '' }}";
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<div id="app">
|
||||
<div id="preloader">
|
||||
<div id="preloader_placeholder">
|
||||
<img style="width: 100%" src="/img/Logo-2-128x128.png" alt="WGDashboard Client" />
|
||||
<img style="width: 100%" src="./img/Logo-2-128x128.png" alt="WGDashboard Client" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<script type="module" src="/src/main.js"></script>
|
||||
<script type="module" src="./src/main.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@@ -2,8 +2,11 @@ import axios from "axios";
|
||||
import {useRouter} from "vue-router";
|
||||
|
||||
export const requestURl = (url) => {
|
||||
return import.meta.env.MODE === 'development' ? '/client' + url
|
||||
: `${window.location.protocol}//${(window.location.host + window.location.pathname + url).replace(/\/\//g, '/')}`
|
||||
if (import.meta.env.MODE === 'development') {
|
||||
return '/client' + url;
|
||||
}
|
||||
const appPrefix = window.APP_PREFIX || '';
|
||||
return `${window.location.protocol}//${window.location.host}${appPrefix}/client${url}`;
|
||||
}
|
||||
|
||||
// const router = useRouter()
|
||||
|
||||
@@ -40,5 +40,5 @@ export default defineConfig({
|
||||
}
|
||||
}
|
||||
},
|
||||
base: '/static/dist/WGDashboardClient'
|
||||
base: './'
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user