From 3448cb7eebb0063bffb32e2573e602b0d7b46497 Mon Sep 17 00:00:00 2001 From: mappu Date: Mon, 6 Feb 2017 16:20:31 +1300 Subject: [PATCH] don't require extern --- Config.go | 1 - client/dcwebui.js | 5 +++-- main.go | 6 ++---- 3 files changed, 5 insertions(+), 7 deletions(-) diff --git a/Config.go b/Config.go index 0780e0a..48be46c 100644 --- a/Config.go +++ b/Config.go @@ -8,7 +8,6 @@ type Config struct { Web struct { Port int `json:"port"` BindTo string `json:"bind_to"` - Extern string `json:"extern"` Title string `json:"title"` CustomFavicon bool `json:"custom_favicon"` diff --git a/client/dcwebui.js b/client/dcwebui.js index 9c9f1ff..b542a2a 100644 --- a/client/dcwebui.js +++ b/client/dcwebui.js @@ -5,6 +5,7 @@ var SENTINEL_PASSWORD = "************"; var CHAT_SCROLLBACK_LIMIT = 50; // Once over 2x $limit, the first $limit will be trimmed off the list +var EXTERN_ROOT = window.location.protocol + "//" + window.location.host + "/"; var $ = (document.querySelectorAll ? function(s) { @@ -155,7 +156,7 @@ var notify = function(title, body) { case "granted": { new Notification(title, { body: body, - icon: DCWEBUI_CONF.extern + "/favicon.ico" + icon: EXTERN_ROOT + "/favicon.ico" }); } break; @@ -1039,7 +1040,7 @@ window.onload = function() { // Socket event handlers - sock = io.connect(DCWEBUI_CONF.extern); + sock = io.connect(EXTERN_ROOT); sock.on('cls', function() { transition(STATE_READY_FOR_LOGIN); diff --git a/main.go b/main.go index 26c612a..01d355f 100644 --- a/main.go +++ b/main.go @@ -188,11 +188,9 @@ func (this *App) customFaviconHandler(w http.ResponseWriter, r *http.Request) { func (this *App) ConfigRequestHandler(w http.ResponseWriter, r *http.Request) { confStruct := struct { - Extern string `json:"extern"` - Title string `json:"title"` + Title string `json:"title"` }{ - Extern: this.cfg.Web.Extern, - Title: this.cfg.Web.Title, + Title: this.cfg.Web.Title, } confBytes, _ := json.Marshal(confStruct)