Add option for custom login URL. Fixes #381.

This commit is contained in:
James Lyne 2022-06-17 13:44:42 +01:00
parent 46c4e6d3eb
commit e37ed130f5
5 changed files with 16 additions and 1 deletions

View File

@ -180,6 +180,10 @@
// Disable the markers button and list
disableMarkerUI: false,
// Custom URL to redirect to when logging in is required
// This URL will need to handle the login process and redirect users back to LiveAtlas
customLoginUrl: null
},
// Config version. Do not modify.

1
src/index.d.ts vendored
View File

@ -126,6 +126,7 @@ interface LiveAtlasUIConfig {
compactPlayerMarkers: boolean;
disableContextMenu: boolean;
disableMarkerUI: boolean;
customLoginUrl: string | null;
}
export type LiveAtlasUIElement = 'layers' | 'chat' | LiveAtlasSidebarSection;

View File

@ -205,7 +205,11 @@ export const actions: ActionTree<State, State> & Actions = {
if(data) {
await state.currentMapProvider!.login(data);
} else {
commit(MutationTypes.SHOW_UI_MODAL, 'login');
if(state.ui.customLoginUrl) {
window.location.href = state.ui.customLoginUrl;
} else {
commit(MutationTypes.SHOW_UI_MODAL, 'login');
}
}
},

View File

@ -142,6 +142,10 @@ export const mutations: MutationTree<State> & Mutations = {
state.ui.playersSearch = uiConfig.playersSearch;
}
if(typeof uiConfig.customLoginUrl === 'string') {
state.ui.customLoginUrl = uiConfig.customLoginUrl;
}
state.servers = config.servers;
if(state.currentServer && !state.servers.has(state.currentServer.id)) {

View File

@ -88,6 +88,7 @@ export type State = {
compactPlayerMarkers: boolean;
disableContextMenu: boolean;
disableMarkerUI: boolean;
customLoginUrl: string | null;
screenWidth: number;
screenHeight: number;
@ -230,6 +231,7 @@ export const state: State = {
compactPlayerMarkers: false,
disableContextMenu: false,
disableMarkerUI: false,
customLoginUrl: null,
screenWidth: window.innerWidth,
screenHeight: window.innerHeight,