diff --git a/docs/config.md b/docs/config.md index 243df23..2ee2000 100644 --- a/docs/config.md +++ b/docs/config.md @@ -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 diff --git a/src/config.js b/src/config.js index aa71e5b..f53dc60 100644 --- a/src/config.js +++ b/src/config.js @@ -71,6 +71,9 @@ const DEFAULT_CONFIG = { reloadHistory: false, }, primaryColor: "#3f51b5", + router: { + basePath: "/", + }, selectedDevice: null, selectedUser: null, showDistanceTravelled: true, diff --git a/src/router.js b/src/router.js index ca2369b..18af3f9 100644 --- a/src/router.js +++ b/src/router.js @@ -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: "/",