(Re)move some config store properties
This commit is contained in:
parent
1d27e05f7c
commit
e809f28455
4
src/dynmap.d.ts
vendored
4
src/dynmap.d.ts
vendored
@ -44,19 +44,16 @@ type DynmapUrlConfig = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
interface DynmapServerConfig {
|
interface DynmapServerConfig {
|
||||||
version: string;
|
|
||||||
defaultMap?: string;
|
defaultMap?: string;
|
||||||
defaultWorld?: string;
|
defaultWorld?: string;
|
||||||
defaultZoom: number;
|
defaultZoom: number;
|
||||||
followMap?: string;
|
followMap?: string;
|
||||||
followZoom: number;
|
followZoom: number;
|
||||||
showLayerControl: boolean;
|
|
||||||
title: string;
|
title: string;
|
||||||
loginEnabled: boolean;
|
loginEnabled: boolean;
|
||||||
maxPlayers: number;
|
maxPlayers: number;
|
||||||
grayHiddenPlayers: boolean;
|
grayHiddenPlayers: boolean;
|
||||||
expandUI: boolean;
|
expandUI: boolean;
|
||||||
hash: number;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
interface DynmapComponentConfig {
|
interface DynmapComponentConfig {
|
||||||
@ -65,6 +62,7 @@ interface DynmapComponentConfig {
|
|||||||
coordinatesControl?: CoordinatesControlOptions;
|
coordinatesControl?: CoordinatesControlOptions;
|
||||||
clockControl ?: ClockControlOptions;
|
clockControl ?: ClockControlOptions;
|
||||||
linkControl: boolean;
|
linkControl: boolean;
|
||||||
|
layerControl: boolean;
|
||||||
logoControls: Array<LogoControlOptions>;
|
logoControls: Array<LogoControlOptions>;
|
||||||
chatBox?: DynmapChatBoxConfig;
|
chatBox?: DynmapChatBoxConfig;
|
||||||
chatSending?: DynmapChatSendingConfig;
|
chatSending?: DynmapChatSendingConfig;
|
||||||
|
@ -25,7 +25,7 @@ export default class LayerManager {
|
|||||||
private readonly map: Map;
|
private readonly map: Map;
|
||||||
|
|
||||||
constructor(map: Map) {
|
constructor(map: Map) {
|
||||||
const showControl = computed(() => useStore().state.configuration.showLayerControl);
|
const showControl = computed(() => useStore().state.components.layerControl);
|
||||||
this.map = map;
|
this.map = map;
|
||||||
this.layerControl = new LiveAtlasLayerControl({}, {},{
|
this.layerControl = new LiveAtlasLayerControl({}, {},{
|
||||||
position: 'topleft',
|
position: 'topleft',
|
||||||
|
@ -52,19 +52,16 @@ export default class DynmapMapProvider extends MapProvider {
|
|||||||
|
|
||||||
private static buildServerConfig(response: any): DynmapServerConfig {
|
private static buildServerConfig(response: any): DynmapServerConfig {
|
||||||
return {
|
return {
|
||||||
version: response.dynmapversion || '',
|
|
||||||
grayHiddenPlayers: response.grayplayerswhenhidden || false,
|
grayHiddenPlayers: response.grayplayerswhenhidden || false,
|
||||||
defaultMap: response.defaultmap || undefined,
|
defaultMap: response.defaultmap || undefined,
|
||||||
defaultWorld: response.defaultworld || undefined,
|
defaultWorld: response.defaultworld || undefined,
|
||||||
defaultZoom: response.defaultzoom || 0,
|
defaultZoom: response.defaultzoom || 0,
|
||||||
followMap: response.followmap || undefined,
|
followMap: response.followmap || undefined,
|
||||||
followZoom: response.followzoom || 0,
|
followZoom: response.followzoom || 0,
|
||||||
showLayerControl: response.showlayercontrol && response.showlayercontrol !== 'false', //Sent as a string for some reason
|
|
||||||
title: response.title.replace(titleColoursRegex, '') || 'Dynmap',
|
title: response.title.replace(titleColoursRegex, '') || 'Dynmap',
|
||||||
loginEnabled: response['login-enabled'] || false,
|
loginEnabled: response['login-enabled'] || false,
|
||||||
maxPlayers: response.maxcount || 0,
|
maxPlayers: response.maxcount || 0,
|
||||||
expandUI: response.sidebaropened && response.sidebaropened !== 'false', //Sent as a string for some reason
|
expandUI: response.sidebaropened && response.sidebaropened !== 'false', //Sent as a string for some reason
|
||||||
hash: response.confighash || 0,
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -153,6 +150,7 @@ export default class DynmapMapProvider extends MapProvider {
|
|||||||
chatBalloons: false,
|
chatBalloons: false,
|
||||||
playerMarkers: undefined,
|
playerMarkers: undefined,
|
||||||
coordinatesControl: undefined,
|
coordinatesControl: undefined,
|
||||||
|
layerControl: response.showlayercontrol && response.showlayercontrol !== 'false', //Sent as a string for some reason
|
||||||
linkControl: false,
|
linkControl: false,
|
||||||
clockControl: undefined,
|
clockControl: undefined,
|
||||||
logoControls: [],
|
logoControls: [],
|
||||||
@ -667,16 +665,16 @@ export default class DynmapMapProvider extends MapProvider {
|
|||||||
throw new Error(response.error);
|
throw new Error(response.error);
|
||||||
}
|
}
|
||||||
|
|
||||||
const store = useStore(),
|
const config = DynmapMapProvider.buildServerConfig(response);
|
||||||
config = DynmapMapProvider.buildServerConfig(response);
|
|
||||||
|
|
||||||
this.updateInterval = response.updaterate || 3000;
|
this.updateInterval = response.updaterate || 3000;
|
||||||
|
|
||||||
store.commit(MutationTypes.SET_SERVER_CONFIGURATION, config);
|
this.store.commit(MutationTypes.SET_SERVER_CONFIGURATION, config);
|
||||||
store.commit(MutationTypes.SET_SERVER_MESSAGES, DynmapMapProvider.buildMessagesConfig(response));
|
this.store.commit(MutationTypes.SET_SERVER_CONFIGURATION_HASH, response.confighash || 0);
|
||||||
store.commit(MutationTypes.SET_WORLDS, this.buildWorlds(response));
|
this.store.commit(MutationTypes.SET_SERVER_MESSAGES, DynmapMapProvider.buildMessagesConfig(response));
|
||||||
store.commit(MutationTypes.SET_COMPONENTS, this.buildComponents(response));
|
this.store.commit(MutationTypes.SET_WORLDS, this.buildWorlds(response));
|
||||||
store.commit(MutationTypes.SET_LOGGED_IN, response.loggedin || false);
|
this.store.commit(MutationTypes.SET_COMPONENTS, this.buildComponents(response));
|
||||||
|
this.store.commit(MutationTypes.SET_LOGGED_IN, response.loggedin || false);
|
||||||
}
|
}
|
||||||
|
|
||||||
async loadWorldConfiguration(): Promise<void> {
|
async loadWorldConfiguration(): Promise<void> {
|
||||||
|
@ -158,7 +158,6 @@ export const mutations: MutationTree<State> & Mutations = {
|
|||||||
// Sets configuration options from the initial config fetch
|
// Sets configuration options from the initial config fetch
|
||||||
[MutationTypes.SET_SERVER_CONFIGURATION](state: State, config: DynmapServerConfig) {
|
[MutationTypes.SET_SERVER_CONFIGURATION](state: State, config: DynmapServerConfig) {
|
||||||
state.configuration = Object.assign(state.configuration, config);
|
state.configuration = Object.assign(state.configuration, config);
|
||||||
state.configurationHash = config.hash;
|
|
||||||
},
|
},
|
||||||
|
|
||||||
// Sets configuration hash
|
// Sets configuration hash
|
||||||
|
@ -88,19 +88,16 @@ export const state: State = {
|
|||||||
servers: new Map(),
|
servers: new Map(),
|
||||||
|
|
||||||
configuration: {
|
configuration: {
|
||||||
version: '',
|
|
||||||
defaultMap: '',
|
defaultMap: '',
|
||||||
defaultWorld: '',
|
defaultWorld: '',
|
||||||
defaultZoom: 0,
|
defaultZoom: 0,
|
||||||
followMap: '',
|
followMap: '',
|
||||||
followZoom: 0,
|
followZoom: 0,
|
||||||
showLayerControl: false,
|
|
||||||
title: '',
|
title: '',
|
||||||
loginEnabled: false,
|
loginEnabled: false,
|
||||||
maxPlayers: 0,
|
maxPlayers: 0,
|
||||||
grayHiddenPlayers: false,
|
grayHiddenPlayers: false,
|
||||||
expandUI: false,
|
expandUI: false,
|
||||||
hash: 0,
|
|
||||||
},
|
},
|
||||||
configurationHash: undefined,
|
configurationHash: undefined,
|
||||||
|
|
||||||
@ -183,6 +180,9 @@ export const state: State = {
|
|||||||
//Optional "link" component. Adds button to copy url for current position
|
//Optional "link" component. Adds button to copy url for current position
|
||||||
linkControl: false,
|
linkControl: false,
|
||||||
|
|
||||||
|
//Layers control
|
||||||
|
layerControl: false,
|
||||||
|
|
||||||
//Optional "logo" controls.
|
//Optional "logo" controls.
|
||||||
logoControls: [],
|
logoControls: [],
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user