Added full support for the app-prefix parameter
parent
d51c543346
commit
9e9f07408d
|
|
@ -194,7 +194,8 @@ def createClientBlueprint(wireguardConfigurations: dict[WireguardConfiguration],
|
||||||
|
|
||||||
@client.get(prefix)
|
@client.get(prefix)
|
||||||
def ClientIndex():
|
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')
|
@client.get(f'{prefix}/api/serverInformation')
|
||||||
def ClientAPI_ServerInformation():
|
def ClientAPI_ServerInformation():
|
||||||
|
|
|
||||||
|
|
@ -72,7 +72,11 @@ def ResponseObject(status=True, message=None, data=None, status_code = 200) -> F
|
||||||
'''
|
'''
|
||||||
Flask App
|
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():
|
def peerInformationBackgroundThread():
|
||||||
global WireguardConfigurations
|
global WireguardConfigurations
|
||||||
|
|
@ -250,7 +254,8 @@ def auth_req():
|
||||||
'/static/', 'validateAuthentication', 'authenticate', 'getDashboardConfiguration',
|
'/static/', 'validateAuthentication', 'authenticate', 'getDashboardConfiguration',
|
||||||
'getDashboardTheme', 'getDashboardVersion', 'sharePeer/get', 'isTotpEnabled', 'locale',
|
'getDashboardTheme', 'getDashboardVersion', 'sharePeer/get', 'isTotpEnabled', 'locale',
|
||||||
'/fileDownload',
|
'/fileDownload',
|
||||||
'/client'
|
'/client',
|
||||||
|
'/assets/', '/img/', '/json/'
|
||||||
]
|
]
|
||||||
|
|
||||||
if (("username" not in session or session.get("role") != "admin")
|
if (("username" not in session or session.get("role") != "admin")
|
||||||
|
|
@ -1698,7 +1703,7 @@ Index Page
|
||||||
|
|
||||||
@app.get(f'{APP_PREFIX}/')
|
@app.get(f'{APP_PREFIX}/')
|
||||||
def index():
|
def index():
|
||||||
return render_template('index.html')
|
return render_template('index.html', APP_PREFIX=APP_PREFIX)
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
startThreads()
|
startThreads()
|
||||||
|
|
|
||||||
|
|
@ -6,10 +6,14 @@
|
||||||
<meta name="apple-mobile-web-app-capable" content="yes">
|
<meta name="apple-mobile-web-app-capable" content="yes">
|
||||||
<meta name="application-name" content="WGDashboard">
|
<meta name="application-name" content="WGDashboard">
|
||||||
<meta name="apple-mobile-web-app-title" content="WGDashboard">
|
<meta name="apple-mobile-web-app-title" content="WGDashboard">
|
||||||
<link rel="manifest" href="/json/manifest.json">
|
<base href="{{ APP_PREFIX if APP_PREFIX else '' }}/">
|
||||||
<link rel="icon" href="/img/Logo-2-512x512.png">
|
<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">
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
<title>WGDashboard</title>
|
<title>WGDashboard</title>
|
||||||
|
<script>
|
||||||
|
window.APP_PREFIX = "{{ APP_PREFIX if APP_PREFIX else '' }}";
|
||||||
|
</script>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<div id="app"></div>
|
<div id="app"></div>
|
||||||
|
|
|
||||||
|
|
@ -27,8 +27,11 @@ export const getUrl = (url) => {
|
||||||
if (apiKey){
|
if (apiKey){
|
||||||
return `${apiKey.host}${url}`
|
return `${apiKey.host}${url}`
|
||||||
}
|
}
|
||||||
return import.meta.env.MODE === 'development' ? url
|
if (import.meta.env.MODE === 'development') {
|
||||||
: `${window.location.protocol}//${(window.location.host + window.location.pathname + url).replace(/\/\//g, '/')}`
|
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) => {
|
export const fetchGet = async (url, params=undefined, callback=undefined) => {
|
||||||
|
|
|
||||||
|
|
@ -32,7 +32,7 @@ export default defineConfig(({mode}) => {
|
||||||
}
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
base: "/static/dist/WGDashboardAdmin",
|
base: "./",
|
||||||
plugins: [
|
plugins: [
|
||||||
vue(),
|
vue(),
|
||||||
],
|
],
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,8 @@
|
||||||
<html lang="">
|
<html lang="">
|
||||||
<head>
|
<head>
|
||||||
<meta charset="UTF-8">
|
<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">
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
<title>WGDashboard Client</title>
|
<title>WGDashboard Client</title>
|
||||||
<style>
|
<style>
|
||||||
|
|
@ -28,15 +29,18 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</style>
|
</style>
|
||||||
|
<script>
|
||||||
|
window.APP_PREFIX = "{{ APP_PREFIX if APP_PREFIX else '' }}";
|
||||||
|
</script>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<div id="app">
|
<div id="app">
|
||||||
<div id="preloader">
|
<div id="preloader">
|
||||||
<div id="preloader_placeholder">
|
<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>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<script type="module" src="/src/main.js"></script>
|
<script type="module" src="./src/main.js"></script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
|
||||||
|
|
@ -2,8 +2,11 @@ import axios from "axios";
|
||||||
import {useRouter} from "vue-router";
|
import {useRouter} from "vue-router";
|
||||||
|
|
||||||
export const requestURl = (url) => {
|
export const requestURl = (url) => {
|
||||||
return import.meta.env.MODE === 'development' ? '/client' + url
|
if (import.meta.env.MODE === 'development') {
|
||||||
: `${window.location.protocol}//${(window.location.host + window.location.pathname + url).replace(/\/\//g, '/')}`
|
return '/client' + url;
|
||||||
|
}
|
||||||
|
const appPrefix = window.APP_PREFIX || '';
|
||||||
|
return `${window.location.protocol}//${window.location.host}${appPrefix}/client${url}`;
|
||||||
}
|
}
|
||||||
|
|
||||||
// const router = useRouter()
|
// const router = useRouter()
|
||||||
|
|
|
||||||
|
|
@ -40,5 +40,5 @@ export default defineConfig({
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
base: '/static/dist/WGDashboardClient'
|
base: './'
|
||||||
})
|
})
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue