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