Commit fa55c2c9 authored by echel0n's avatar echel0n

Replaced get_lan_ip with get_internal_ip

parent 87a989dc
......@@ -56,8 +56,8 @@ from sickrage.core.databases.cache import CacheDB
from sickrage.core.databases.config import ConfigDB, CustomStringEncryptedType
from sickrage.core.databases.main import MainDB
from sickrage.core.enums import MultiEpNaming, DefaultHomePage, NzbMethod, TorrentMethod, CheckPropersInterval
from sickrage.core.helpers import generate_secret, make_dir, get_lan_ip, restore_app_data, get_disk_space_usage, get_free_space, launch_browser, \
torrent_webui_url, encryption, md5_file_hash, flatten
from sickrage.core.helpers import generate_secret, make_dir, restore_app_data, get_disk_space_usage, get_free_space, launch_browser, torrent_webui_url, \
encryption, md5_file_hash, flatten
from sickrage.core.logger import Logger
from sickrage.core.nameparser.validator import check_force_season_folders
from sickrage.core.processors import auto_postprocessor
......
......@@ -35,7 +35,7 @@ from sickrage.core.databases import SRDatabaseBase, SRDatabase, IntFlag
from sickrage.core.enums import DefaultHomePage, MultiEpNaming, CpuPreset, CheckPropersInterval, \
FileTimestampTimezone, ProcessMethod, NzbMethod, TorrentMethod, SearchFormat, UserPermission, PosterSortDirection, HomeLayout, PosterSortBy, \
HistoryLayout, TimezoneDisplay, UITheme, TraktAddMethod, SeriesProviderID
from sickrage.core.helpers import generate_api_key, generate_secret, get_lan_ip
from sickrage.core.helpers import generate_api_key, generate_secret
from sickrage.core.tv.show.coming_episodes import ComingEpsLayout, ComingEpsSortBy
from sickrage.notification_providers.nmjv2 import NMJv2Location
from sickrage.search_providers import SearchProviderType
......
......@@ -809,13 +809,6 @@ def create_https_certificates(ssl_cert, ssl_key):
return True
def get_lan_ip():
"""Return IP of system."""
s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
s.connect(('8.8.8.8', 1))
return s.getsockname()[0]
def anon_url(*url):
"""
Return a URL string consisting of the Anonymous redirect URL and an arbitrary number of values appended.
......@@ -1587,7 +1580,7 @@ def torrent_webui_url(reset=False):
sickrage.app.client_web_urls['torrent'] = ''
return sickrage.app.client_web_urls['torrent']
torrent_ui_url = re.sub('localhost|127.0.0.1', sickrage.app.web_host or get_lan_ip(), sickrage.app.config.torrent.host or '', re.I)
torrent_ui_url = re.sub('localhost|127.0.0.1', sickrage.app.web_host or get_internal_ip(), sickrage.app.config.torrent.host or '', re.I)
def test_exists(url):
try:
......
......@@ -27,7 +27,7 @@ from urllib.parse import urlparse
import upnpclient
import sickrage
from sickrage.core.helpers import get_lan_ip
from sickrage.core.helpers import get_internal_ip
class UPNPClient(object):
......@@ -129,7 +129,7 @@ class UPNPClient(object):
return device
def _find_internal_ip_on_device_network(self, upnp_dev):
lan_ip = get_lan_ip()
lan_ip = get_internal_ip()
parsed_url = urlparse(upnp_dev.location)
upnp_dev_net = ipaddress.ip_network(parsed_url.hostname + '/24', strict=False)
......
......@@ -33,7 +33,7 @@ from tornado.ioloop import IOLoop
from tornado.web import Application, RedirectHandler, StaticFileHandler
import sickrage
from sickrage.core.helpers import create_https_certificates, get_lan_ip, launch_browser
from sickrage.core.helpers import create_https_certificates, launch_browser, get_internal_ip
from sickrage.core.webserver.handlers.account import AccountLinkHandler, AccountUnlinkHandler, AccountIsLinkedHandler
from sickrage.core.webserver.handlers.announcements import AnnouncementsHandler, MarkAnnouncementSeenHandler, AnnouncementCountHandler
from sickrage.core.webserver.handlers.api import ApiSwaggerDotJsonHandler, ApiPingHandler
......@@ -499,7 +499,7 @@ class WebServer(threading.Thread):
if not sickrage.app.no_launch and sickrage.app.config.general.launch_browser:
sickrage.app.scheduler.add_job(launch_browser,
args=[('http', 'https')[sickrage.app.config.general.enable_https],
(get_lan_ip(), sickrage.app.web_host)[sickrage.app.web_host != ''],
(get_internal_ip(), sickrage.app.web_host)[sickrage.app.web_host != ''],
sickrage.app.config.general.web_port])
sickrage.app.log.info("SiCKRAGE :: STARTED")
......@@ -507,8 +507,8 @@ class WebServer(threading.Thread):
sickrage.app.log.info(f"SiCKRAGE :: CONFIG VERSION:[v{sickrage.app.config.db.version}]")
sickrage.app.log.info(f"SiCKRAGE :: DATABASE VERSION:[v{sickrage.app.main_db.version}]")
sickrage.app.log.info(f"SiCKRAGE :: DATABASE TYPE:[{sickrage.app.db_type}]")
sickrage.app.log.info(
f"SiCKRAGE :: URL:[{('http', 'https')[sickrage.app.config.general.enable_https]}://{(get_lan_ip(), sickrage.app.web_host)[sickrage.app.web_host != '']}:{sickrage.app.config.general.web_port}/{sickrage.app.config.general.web_root}]")
sickrage.app.log.info(f"SiCKRAGE :: URL:[{('http', 'https')[sickrage.app.config.general.enable_https]}://{(get_internal_ip(), sickrage.app.web_host)[sickrage.app.web_host != '']}:{sickrage.app.config.general.web_port}/{sickrage.app.config.general.web_root}]")
self.io_loop.start()
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment