mirror of
https://github.com/Tautulli/Tautulli.git
synced 2025-07-15 01:32:57 -07:00
Improved IP address handling (includes IPv6)
This commit is contained in:
parent
d875f21647
commit
ca472ff597
14 changed files with 178 additions and 220 deletions
|
@ -94,16 +94,12 @@ history_table_options = {
|
|||
"data": "ip_address",
|
||||
"createdCell": function (td, cellData, rowData, row, col) {
|
||||
if (cellData) {
|
||||
if (isPrivateIP(cellData)) {
|
||||
if (cellData != '') {
|
||||
$(td).html(cellData);
|
||||
} else {
|
||||
$(td).html('n/a');
|
||||
}
|
||||
} else {
|
||||
isPrivateIP(cellData).then(function () {
|
||||
$(td).html(cellData || 'n/a');
|
||||
}, function () {
|
||||
external_ip = '<span class="external-ip-tooltip" data-toggle="tooltip" title="External IP"><i class="fa fa-map-marker fa-fw"></i></span>';
|
||||
$(td).html('<a href="javascript:void(0)" data-toggle="modal" data-target="#ip-info-modal">'+ external_ip + cellData + '</a>');
|
||||
}
|
||||
});
|
||||
} else {
|
||||
$(td).html('n/a');
|
||||
}
|
||||
|
@ -253,13 +249,12 @@ history_table_options = {
|
|||
$('#ajaxMsg').fadeOut();
|
||||
|
||||
// Create the tooltips.
|
||||
$('.current-activity-tooltip').tooltip({ container: 'body' });
|
||||
$('.expand-history-tooltip').tooltip({ container: 'body' });
|
||||
$('.external-ip-tooltip').tooltip({ container: 'body' });
|
||||
$('.transcode-tooltip').tooltip({ container: 'body' });
|
||||
$('.media-type-tooltip').tooltip({ container: 'body' });
|
||||
$('.watched-tooltip').tooltip({ container: 'body' });
|
||||
$('.thumb-tooltip').popover({
|
||||
$('body').tooltip({
|
||||
selector: '[data-toggle="tooltip"]',
|
||||
container: 'body'
|
||||
});
|
||||
$('body').popover({
|
||||
selector: '[data-toggle="popover"]',
|
||||
html: true,
|
||||
container: 'body',
|
||||
trigger: 'hover',
|
||||
|
@ -331,22 +326,13 @@ $('.history_table').on('click', '> tbody > tr > td.modal-control', function () {
|
|||
var row = history_table.row( tr );
|
||||
var rowData = row.data();
|
||||
|
||||
function showStreamDetails() {
|
||||
$.ajax({
|
||||
url: 'get_stream_data',
|
||||
data: {
|
||||
row_id: rowData['id'],
|
||||
session_key: rowData['session_key'],
|
||||
user: rowData['friendly_name']
|
||||
},
|
||||
cache: false,
|
||||
async: true,
|
||||
complete: function(xhr, status) {
|
||||
$("#info-modal").html(xhr.responseText);
|
||||
}
|
||||
});
|
||||
}
|
||||
showStreamDetails();
|
||||
$.get('get_stream_data', {
|
||||
row_id: rowData['id'],
|
||||
session_key: rowData['session_key'],
|
||||
user: rowData['friendly_name']
|
||||
}).then(function (jqXHR) {
|
||||
$("#info-modal").html(jqXHR);
|
||||
});
|
||||
});
|
||||
|
||||
// Parent table ip address modal
|
||||
|
@ -355,21 +341,11 @@ $('.history_table').on('click', '> tbody > tr > td.modal-control-ip', function (
|
|||
var row = history_table.row( tr );
|
||||
var rowData = row.data();
|
||||
|
||||
function getUserLocation(ip_address) {
|
||||
if (isPrivateIP(ip_address)) {
|
||||
return "n/a"
|
||||
} else {
|
||||
$.ajax({
|
||||
url: 'get_ip_address_details',
|
||||
data: {ip_address: ip_address},
|
||||
async: true,
|
||||
complete: function(xhr, status) {
|
||||
$("#ip-info-modal").html(xhr.responseText);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
getUserLocation(rowData['ip_address']);
|
||||
$.get('get_ip_address_details', {
|
||||
ip_address: rowData['ip_address']
|
||||
}).then(function (jqXHR) {
|
||||
$("#ip-info-modal").html(jqXHR);
|
||||
});
|
||||
});
|
||||
|
||||
// Parent table delete mode
|
||||
|
@ -545,18 +521,12 @@ function createChildTable(row, rowData) {
|
|||
var childRow = history_child_table[rowData['reference_id']].row(tr);
|
||||
var childRowData = childRow.data();
|
||||
|
||||
function showStreamDetails() {
|
||||
$.ajax({
|
||||
url: 'get_stream_data',
|
||||
data: { row_id: childRowData['id'], user: childRowData['friendly_name'] },
|
||||
cache: false,
|
||||
async: true,
|
||||
complete: function (xhr, status) {
|
||||
$("#info-modal").html(xhr.responseText);
|
||||
}
|
||||
});
|
||||
}
|
||||
showStreamDetails();
|
||||
$.get('get_stream_data', {
|
||||
row_id: childRowData['id'],
|
||||
user: childRowData['friendly_name']
|
||||
}).then(function (jqXHR) {
|
||||
$("#info-modal").html(jqXHR);
|
||||
});
|
||||
});
|
||||
|
||||
// Child table ip address modal
|
||||
|
@ -565,21 +535,11 @@ function createChildTable(row, rowData) {
|
|||
var childRow = history_child_table[rowData['reference_id']].row(tr);
|
||||
var childRowData = childRow.data();
|
||||
|
||||
function getUserLocation(ip_address) {
|
||||
if (isPrivateIP(ip_address)) {
|
||||
return "n/a"
|
||||
} else {
|
||||
$.ajax({
|
||||
url: 'get_ip_address_details',
|
||||
data: { ip_address: ip_address },
|
||||
async: true,
|
||||
complete: function (xhr, status) {
|
||||
$("#ip-info-modal").html(xhr.responseText);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
getUserLocation(childRowData['ip_address']);
|
||||
$.get('get_ip_address_details', {
|
||||
ip_address: childRowData['ip_address']
|
||||
}).then(function (jqXHR) {
|
||||
$("#ip-info-modal").html(jqXHR);
|
||||
});
|
||||
});
|
||||
|
||||
// Child table delete mode
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue