From 3c442e48a58ae99b7a9708d2d0595ee2637ce7fa Mon Sep 17 00:00:00 2001 From: Guillaume FAUVET Date: Thu, 7 Dec 2017 15:33:01 +0100 Subject: [PATCH] upd: view.main (api et wsclientbuilder en fonction de si local ou pas) upd: view.vue-config (gstore.data.is_local : bool) --- view/main.js | 15 ++++++++------- view/vue-config.js | 1 + 2 files changed, 9 insertions(+), 7 deletions(-) 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