From 81514467bc26ccaee2bf11c5cf62f77a68130299 Mon Sep 17 00:00:00 2001 From: Jaroslav Kysela Date: Wed, 17 Sep 2014 20:24:41 +0200 Subject: [PATCH] WEBUI: Show the browser (client) address in Tip in the login info text --- src/webui/comet.c | 5 +++++ src/webui/static/app/tvheadend.js | 6 ++++++ 2 files changed, 11 insertions(+) diff --git a/src/webui/comet.c b/src/webui/comet.c index dd6b4dff..4e4ff28a 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 2a9e6256..46c144a8 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';