Restructure LiveAtlasServerDefinition

This commit is contained in:
James Lyne 2021-07-25 02:02:42 +01:00
parent e61d0def04
commit 355c0c71cf
4 changed files with 10 additions and 15 deletions

11
src/index.d.ts vendored
View File

@ -41,13 +41,10 @@ interface LiveAtlasGlobalConfig {
}
interface LiveAtlasServerDefinition {
id: string
label?: string
}
interface LiveAtlasDynmapServerDefinition extends LiveAtlasServerDefinition {
type: 'dynmap',
dynmap: DynmapUrlConfig,
id: string;
label?: string;
type: 'dynmap'
dynmap: DynmapUrlConfig;
}
// Messages defined directly in LiveAtlas and used for all servers

View File

@ -19,7 +19,6 @@ import {
LiveAtlasArea,
LiveAtlasCircle,
LiveAtlasDimension,
LiveAtlasDynmapServerDefinition,
LiveAtlasLine,
LiveAtlasMarker,
LiveAtlasMarkerSet,
@ -51,8 +50,8 @@ export default class DynmapMapProvider extends MapProvider {
private updateTimestamp: Date = new Date();
private updateInterval: number = 3000;
constructor(config: LiveAtlasDynmapServerDefinition) {
super(config as LiveAtlasServerDefinition);
constructor(config: LiveAtlasServerDefinition) {
super(config);
}
private static buildServerConfig(response: any): DynmapServerConfig {

View File

@ -34,11 +34,10 @@ import {
LiveAtlasGlobalConfig,
LiveAtlasGlobalMessageConfig,
LiveAtlasServerMessageConfig,
LiveAtlasDynmapServerDefinition,
LiveAtlasPlayer,
LiveAtlasCircle,
LiveAtlasLine,
LiveAtlasArea, LiveAtlasMarker, LiveAtlasMarkerSet
LiveAtlasArea, LiveAtlasMarker, LiveAtlasMarkerSet, LiveAtlasServerDefinition
} from "@/index";
import DynmapMapProvider from "@/providers/DynmapMapProvider";

View File

@ -1,4 +1,4 @@
import {LiveAtlasDynmapServerDefinition, LiveAtlasGlobalConfig, LiveAtlasServerDefinition} from "@/index";
import {LiveAtlasGlobalConfig, LiveAtlasServerDefinition} from "@/index";
import ConfigurationError from "@/errors/ConfigurationError";
import {DynmapUrlConfig} from "@/dynmap";
@ -64,7 +64,7 @@ const validateLiveAtlasConfiguration = (config: any): Map<string, LiveAtlasServe
return result;
};
const validateDynmapConfiguration = (config: DynmapUrlConfig): Map<string, LiveAtlasDynmapServerDefinition> => {
const validateDynmapConfiguration = (config: DynmapUrlConfig): Map<string, LiveAtlasServerDefinition> => {
const check = '\nCheck your standalone/config.js file exists and is being loaded correctly.';
if (!config) {
@ -91,7 +91,7 @@ const validateDynmapConfiguration = (config: DynmapUrlConfig): Map<string, LiveA
throw new ConfigurationError(`Dynmap sendmessage URL is missing. ${check}`);
}
const result = new Map<string, LiveAtlasDynmapServerDefinition>();
const result = new Map<string, LiveAtlasServerDefinition>();
result.set('dynmap', {
id: 'dynmap',
label: 'dynmap',