diff --git a/data/interfaces/default/mobile_devices_table.html b/data/interfaces/default/mobile_devices_table.html index 35c873bf..328e40e4 100644 --- a/data/interfaces/default/mobile_devices_table.html +++ b/data/interfaces/default/mobile_devices_table.html @@ -58,7 +58,7 @@ DOCUMENTATION :: END getPlexPyURL = function () { 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]); } else { $.get('get_plexpy_url').then(function (url) { @@ -74,7 +74,7 @@ DOCUMENTATION :: END var hostname = parser.hostname; 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_private').toggle(false); } else { diff --git a/plexpy/helpers.py b/plexpy/helpers.py index d5ef887f..da5a5df5 100644 --- a/plexpy/helpers.py +++ b/plexpy/helpers.py @@ -1191,9 +1191,10 @@ def get_plexpy_url(hostname=None): else: 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 try: + # Only returns IPv4 address s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) s.setsockopt(socket.SOL_SOCKET, socket.SO_BROADCAST, 1) s.connect(('', 0)) @@ -1206,7 +1207,7 @@ def get_plexpy_url(hostname=None): if not hostname: 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 else: hostname = hostname or plexpy.CONFIG.HTTP_HOST