diff --git a/view/main.js b/view/main.js index fc67124..00bd819 100755 --- a/view/main.js +++ b/view/main.js @@ -16,17 +16,18 @@ import wrapper_vue from './vue/wrapper.vue' /* (2) Initialisation ---------------------------------------------------------*/ -/* (1) API */ -window.api = new API("http://ndli1718/api/v/1.0/"); - -/* (2) wsclient */ -window.wsc = new WSClientBuilder("wss://websocket.xdrm.io"); - -/* (3) global store init */ +/* (1) global store init */ require('./vue-config'); window.gstore.add('server', window._SERVER); window.infobox = new InfoBox(gstore.data.info); +/* (2) API */ +window.api = new API(gstore.data.is_local ? 'http://ndli1718/api/v/1.0/' : 'https://ndli1718.xdrm.io/api/v/1.0/'); + +/* (3) wsclient */ +window.wsc = new WSClientBuilder(gstore.data.is_local ? 'ws://localhost:9999' : 'wss://websocket.xdrm.io'); + + /* (4) Init vue router */ Vue.use(VueRouter); const router = new VueRouter({ diff --git a/view/vue-config.js b/view/vue-config.js index 2ea0a30..2a20b14 100644 --- a/view/vue-config.js +++ b/view/vue-config.js @@ -34,6 +34,7 @@ gstore.add('menu_item', { }); gstore.add('URI', document.URL.replace(/^(?:\/\/|[^\/]+)*/, '')); +gstore.add('is_local', document.URL.replace(/^http:\/\/([^\/]+).*$/, '$1') == 'ndli1718'); gstore.add('min_menu', false); // Proccess current page from url