WEBUI: Show the browser (client) address in Tip in the login info text

This commit is contained in:
Jaroslav Kysela 2014-09-17 20:24:41 +02:00
parent 3c0ca052db
commit 81514467bc
2 changed files with 11 additions and 0 deletions

View 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));

View 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';