From a28e5ce9b0f519fb37c6113f86dbe65d00956d9c Mon Sep 17 00:00:00 2001 From: mappu Date: Mon, 6 Feb 2017 16:25:49 +1300 Subject: [PATCH] remove extra /conf/ request --- client/dcwebui.js | 8 ++++---- client/index.htm | 1 - main.go | 20 +------------------- 3 files changed, 5 insertions(+), 24 deletions(-) diff --git a/client/dcwebui.js b/client/dcwebui.js index b542a2a..9a48d5d 100644 --- a/client/dcwebui.js +++ b/client/dcwebui.js @@ -786,7 +786,7 @@ var updateTitle = function() { var sock = {}; var hub_state = 0; // [disconnected, sent-nick, connected] var hub_last_nick = ''; -var hub_hubname = DCWEBUI_CONF.title; +var hub_hubname = "Loading..."; var pm_tabs = {}; // nick => tabid var next_tabid = 1; @@ -918,7 +918,8 @@ var transition = function(new_state) { $("#chatbox").disabled = true; } break; - case STATE_ACTIVE: { + case STATE_ACTIVE: { + write("tab-main").system("Now talking on "+hub_hubname); $("#chatbox").disabled = false; $("#chatbox").spellcheck = true; } break; @@ -941,7 +942,7 @@ window.onload = function() { show_joins = persistence_get("show_joins", false); - document.title = DCWEBUI_CONF.title; + document.title = hub_hubname; // "Loading..."; // HTML event handlers @@ -1063,7 +1064,6 @@ window.onload = function() { } }); sock.on('hubname', function(s) { - write("tab-main").system("Now talking on "+s); hub_hubname = s; updateTitle(); }); diff --git a/client/index.htm b/client/index.htm index 25ed861..c495e0d 100644 --- a/client/index.htm +++ b/client/index.htm @@ -53,7 +53,6 @@ - \ No newline at end of file diff --git a/main.go b/main.go index 01d355f..a60b4b1 100644 --- a/main.go +++ b/main.go @@ -164,6 +164,7 @@ func (this *App) SocketIOServer(so socketio.Socket) { log.Printf("[%s] Client connected", so.Id()) so.Emit("cls") + so.Emit("hubname", this.cfg.Web.Title) so.Emit("raw", this.cfg.App.MotdHTML+"
") so.Emit("sys", "Enter a name to connect as (or name:pass for a registered nick)") @@ -185,22 +186,6 @@ func (this *App) customFaviconHandler(w http.ResponseWriter, r *http.Request) { http.ServeFile(w, r, "favicon.ico") } -func (this *App) ConfigRequestHandler(w http.ResponseWriter, r *http.Request) { - - confStruct := struct { - Title string `json:"title"` - }{ - Title: this.cfg.Web.Title, - } - confBytes, _ := json.Marshal(confStruct) - - // - - w.Header().Set("Content-Type", "text/javascript") - w.WriteHeader(200) - fmt.Fprintf(w, "var DCWEBUI_CONF = %s;\n", string(confBytes)) -} - func (this *App) StaticRequestHandler(w http.ResponseWriter, r *http.Request) { fileName := r.URL.Path[1:] if fileName == "" { @@ -250,9 +235,6 @@ func (this *App) RunServer() { }) http.Handle("/socket.io/", server) - // Configuration handler - http.HandleFunc("/conf", this.ConfigRequestHandler) - if this.cfg.Web.CustomFavicon { http.HandleFunc("/favicon.ico", this.customFaviconHandler) }