Add router.basePath config option for deployments at non-webroot

This is in preparation of configuring Vue with publicPath: "".
This commit is contained in:
Linus Groh
2020-12-29 19:17:11 +01:00
parent 7db7837dfd
commit 045e635c21
3 changed files with 24 additions and 2 deletions
+18
View File
@@ -63,6 +63,8 @@ window.owntracks.config = {};
- [`fitView`](#onlocationchangefitview)
- [`reloadHistory`](#onlocationchangereloadhistory)
- [`primaryColor`](#primarycolor)
- `router`
- [`basePath`](#routerbasepath)
- [`selectedDevice`](#selecteddevice)
- [`selectedUser`](#selecteduser)
- [`showDistanceTravelled`](#showdistancetravelled)
@@ -435,6 +437,22 @@ Primary color for the user interface (navigation bar and various map elements).
};
```
### `router.basePath`
Base path of the application deployment.
- Type: [`String`]
- Default: `"/"`
- Example:
```js
// Frontend will be reachable at https://example.com/owntracks
window.owntracks.config = {
router: {
basePath: "/owntracks",
},
};
```
### `selectedDevice`
Initial selected device. All devices will be shown by default if `null`. Will be ignored
+3
View File
@@ -71,6 +71,9 @@ const DEFAULT_CONFIG = {
reloadHistory: false,
},
primaryColor: "#3f51b5",
router: {
basePath: "/",
},
selectedDevice: null,
selectedUser: null,
showDistanceTravelled: true,
+3 -2
View File
@@ -1,12 +1,13 @@
import Vue from "vue";
import Router from "vue-router";
import Map from "./views/Map.vue";
import config from "@/config";
import Map from "@/views/Map.vue";
Vue.use(Router);
export default new Router({
mode: "history",
base: process.env.BASE_URL,
base: config.router.basePath,
routes: [
{
path: "/",