Added full support for the app-prefix parameter
parent
d51c543346
commit
9e9f07408d
|
|
@ -194,7 +194,8 @@ def createClientBlueprint(wireguardConfigurations: dict[WireguardConfiguration],
|
|||
|
||||
@client.get(prefix)
|
||||
def ClientIndex():
|
||||
return render_template('client.html')
|
||||
app_prefix = dashboardConfig.GetConfig("Server", "app_prefix")[1]
|
||||
return render_template('client.html', APP_PREFIX=app_prefix)
|
||||
|
||||
@client.get(f'{prefix}/api/serverInformation')
|
||||
def ClientAPI_ServerInformation():
|
||||
|
|
|
|||
|
|
@ -72,7 +72,11 @@ def ResponseObject(status=True, message=None, data=None, status_code = 200) -> F
|
|||
'''
|
||||
Flask App
|
||||
'''
|
||||
app = Flask("WGDashboard", template_folder=os.path.abspath("./static/dist/WGDashboardAdmin"))
|
||||
_, APP_PREFIX_INIT = DashboardConfig().GetConfig("Server", "app_prefix")
|
||||
app = Flask("WGDashboard",
|
||||
template_folder=os.path.abspath("./static/dist/WGDashboardAdmin"),
|
||||
static_folder=os.path.abspath("./static/dist/WGDashboardAdmin"),
|
||||
static_url_path=APP_PREFIX_INIT if APP_PREFIX_INIT else '')
|
||||
|
||||
def peerInformationBackgroundThread():
|
||||
global WireguardConfigurations
|
||||
|
|
@ -250,7 +254,8 @@ def auth_req():
|
|||
'/static/', 'validateAuthentication', 'authenticate', 'getDashboardConfiguration',
|
||||
'getDashboardTheme', 'getDashboardVersion', 'sharePeer/get', 'isTotpEnabled', 'locale',
|
||||
'/fileDownload',
|
||||
'/client'
|
||||
'/client',
|
||||
'/assets/', '/img/', '/json/'
|
||||
]
|
||||
|
||||
if (("username" not in session or session.get("role") != "admin")
|
||||
|
|
@ -1698,7 +1703,7 @@ Index Page
|
|||
|
||||
@app.get(f'{APP_PREFIX}/')
|
||||
def index():
|
||||
return render_template('index.html')
|
||||
return render_template('index.html', APP_PREFIX=APP_PREFIX)
|
||||
|
||||
if __name__ == "__main__":
|
||||
startThreads()
|
||||
|
|
|
|||
|
|
@ -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: './'
|
||||
})
|
||||
|
|
|
|||
Loading…
Reference in New Issue