mirror of
https://github.com/Tautulli/Tautulli.git
synced 2025-07-30 03:28:31 -07:00
Check IPv6 HTTP host when retrieving app URL
This commit is contained in:
parent
ed53d66aa7
commit
894eaf0365
2 changed files with 5 additions and 4 deletions
|
@ -58,7 +58,7 @@ DOCUMENTATION :: END
|
||||||
|
|
||||||
getPlexPyURL = function () {
|
getPlexPyURL = function () {
|
||||||
var deferred = $.Deferred();
|
var deferred = $.Deferred();
|
||||||
if (location.hostname !== "localhost" && location.hostname !== "127.0.0.1") {
|
if (location.hostname !== "localhost" && location.hostname !== "127.0.0.1" && location.hostname !== "[::1]") {
|
||||||
deferred.resolve(location.href.split('/settings')[0]);
|
deferred.resolve(location.href.split('/settings')[0]);
|
||||||
} else {
|
} else {
|
||||||
$.get('get_plexpy_url').then(function (url) {
|
$.get('get_plexpy_url').then(function (url) {
|
||||||
|
@ -74,7 +74,7 @@ DOCUMENTATION :: END
|
||||||
var hostname = parser.hostname;
|
var hostname = parser.hostname;
|
||||||
var protocol = parser.protocol;
|
var protocol = parser.protocol;
|
||||||
|
|
||||||
if (hostname === '127.0.0.1' || hostname === 'localhost') {
|
if (hostname === 'localhost' || hostname === '127.0.0.1' || hostname === '[::1]') {
|
||||||
$('#api_qr_localhost').toggle(true);
|
$('#api_qr_localhost').toggle(true);
|
||||||
$('#api_qr_private').toggle(false);
|
$('#api_qr_private').toggle(false);
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -1191,9 +1191,10 @@ def get_plexpy_url(hostname=None):
|
||||||
else:
|
else:
|
||||||
scheme = 'http'
|
scheme = 'http'
|
||||||
|
|
||||||
if hostname is None and plexpy.CONFIG.HTTP_HOST == '0.0.0.0':
|
if hostname is None and plexpy.CONFIG.HTTP_HOST in ('0.0.0.0', '::'):
|
||||||
import socket
|
import socket
|
||||||
try:
|
try:
|
||||||
|
# Only returns IPv4 address
|
||||||
s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
|
s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
|
||||||
s.setsockopt(socket.SOL_SOCKET, socket.SO_BROADCAST, 1)
|
s.setsockopt(socket.SOL_SOCKET, socket.SO_BROADCAST, 1)
|
||||||
s.connect(('<broadcast>', 0))
|
s.connect(('<broadcast>', 0))
|
||||||
|
@ -1206,7 +1207,7 @@ def get_plexpy_url(hostname=None):
|
||||||
|
|
||||||
if not hostname:
|
if not hostname:
|
||||||
hostname = 'localhost'
|
hostname = 'localhost'
|
||||||
elif hostname == 'localhost' and plexpy.CONFIG.HTTP_HOST != '0.0.0.0':
|
elif hostname == 'localhost' and plexpy.CONFIG.HTTP_HOST not in ('0.0.0.0', '::'):
|
||||||
hostname = plexpy.CONFIG.HTTP_HOST
|
hostname = plexpy.CONFIG.HTTP_HOST
|
||||||
else:
|
else:
|
||||||
hostname = hostname or plexpy.CONFIG.HTTP_HOST
|
hostname = hostname or plexpy.CONFIG.HTTP_HOST
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue