From: Jaroslav Kysela Date: Wed, 17 Sep 2014 18:24:41 +0000 (+0200) Subject: WEBUI: Show the browser (client) address in Tip in the login info text X-Git-Tag: v4.1~1328 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=81514467bc26ccaee2bf11c5cf62f77a68130299;p=thirdparty%2Ftvheadend.git WEBUI: Show the browser (client) address in Tip in the login info text --- diff --git a/src/webui/comet.c b/src/webui/comet.c index dd6b4dff5..4e4ff28a4 100644 --- a/src/webui/comet.c +++ b/src/webui/comet.c @@ -142,11 +142,16 @@ comet_access_update(http_connection_t *hc, comet_mailbox_t *cmb) htsmsg_t *m = htsmsg_create_map(); const char *username = hc->hc_access ? (hc->hc_access->aa_username ?: "") : ""; + char addrstr[50]; htsmsg_add_str(m, "notificationClass", "accessUpdate"); + tcp_get_ip_str((struct sockaddr*)hc->hc_peer, addrstr, sizeof(addrstr)); + if (!access_noacl) htsmsg_add_str(m, "username", username); + if (addrstr[0]) + htsmsg_add_str(m, "address", addrstr); htsmsg_add_u32(m, "dvr", !http_access_verify(hc, ACCESS_RECORDER)); htsmsg_add_u32(m, "admin", !http_access_verify(hc, ACCESS_ADMIN)); diff --git a/src/webui/static/app/tvheadend.js b/src/webui/static/app/tvheadend.js index 2a9e6256c..46c144a82 100644 --- a/src/webui/static/app/tvheadend.js +++ b/src/webui/static/app/tvheadend.js @@ -313,6 +313,8 @@ function accessUpdate(o) { if ('username' in o) tvheadend.rootTabPanel.setLogin(o.username); + if ('address' in o) + tvheadend.rootTabPanel.setAddress(o.address); if (tvheadend.autorecButton) tvheadend.autorecButton.setDisabled(o.dvr != true); @@ -540,6 +542,10 @@ tvheadend.RootTabPanel = Ext.extend(Ext.TabPanel, { Ext.fly(this.loginItem.tabEl).child('span.x-tab-strip-login', true).innerHTML = text; Ext.fly(this.loginCmdItem.tabEl).child('span.x-tab-strip-login-cmd', true).innerHTML = cmd; }, + + setAddress: function(addr) { + Ext.get(this.loginItem.tabEl).child('span.x-tab-strip-login', true).qtip = addr; + }, onLoginCmdClicked: function(e) { window.location.href = this.login ? 'logout' : 'login';