]> git.ipfire.org Git - thirdparty/tvheadend.git/commitdiff
WEBUI: Show the browser (client) address in Tip in the login info text
authorJaroslav Kysela <perex@perex.cz>
Wed, 17 Sep 2014 18:24:41 +0000 (20:24 +0200)
committerJaroslav Kysela <perex@perex.cz>
Wed, 17 Sep 2014 18:24:41 +0000 (20:24 +0200)
src/webui/comet.c
src/webui/static/app/tvheadend.js

index dd6b4dff50310ff0ad54da0b573a9aa7f9b21b2e..4e4ff28a4cd0b50d40d90dcf2bd8866980bee430 100644 (file)
@@ -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));
 
index 2a9e6256c9535264881aacafb4560eaa39c39bb2..46c144a82b994a35fb11fed7d7f9a9c3abc99d3c 100644 (file)
@@ -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';