Merge pull request #910 from JackDandy/feature/ChangeIPv6

Change add IPv4 config option when enabling IPv6.
This commit is contained in:
JackDandy 2017-02-09 20:58:26 +00:00 committed by GitHub
commit 323e87f39f
5 changed files with 21 additions and 8 deletions

View file

@ -43,6 +43,7 @@
* Update jQuery 1.8.3 to 2.2.4
* Add one time run to start up that deletes troublemaking compiled files
* Fix reload of homepage after restart in some browsers
* Change add IPv4 config option when enabling IPv6.
[develop changelog]

View file

@ -364,10 +364,7 @@ class SickGear(object):
if sickbeard.WEB_HOST and sickbeard.WEB_HOST != '0.0.0.0':
self.webhost = sickbeard.WEB_HOST
else:
if sickbeard.WEB_IPV6:
self.webhost = '::'
else:
self.webhost = '0.0.0.0'
self.webhost = (('0.0.0.0', '::')[sickbeard.WEB_IPV6], '')[sickbeard.WEB_IPV64]
# web server options
self.web_options = {
@ -387,7 +384,8 @@ class SickGear(object):
# start web server
try:
# used to check if existing SG instances have been started
sickbeard.helpers.wait_for_free_port(self.web_options['host'], self.web_options['port'])
sickbeard.helpers.wait_for_free_port(
sickbeard.WEB_IPV6 and '::1' or self.web_options['host'], self.web_options['port'])
self.webserver = WebServer(self.web_options)
self.webserver.start()

View file

@ -541,11 +541,21 @@
<label for="web_ipv6">
<span class="component-title">Listen on IPv6</span>
<span class="component-desc">
<input type="checkbox" name="web_ipv6" id="web_ipv6"#echo ('', $checked)[$sg_var('WEB_IPV6')]#>
<input type="checkbox" name="web_ipv6" id="web_ipv6" class="enabler"#echo ('', $checked)[$sg_var('WEB_IPV6')]#>
<p>attempt binding to any available IPv6 address</p>
</span>
</label>
</div>
<div id="content_web_ipv6">
<div class="field-pair" style="margin-top:-24px">
<label for="web_ipv64">
<span class="component-desc">
<input type="checkbox" name="web_ipv64" id="web_ipv64"#echo ('', $checked)[$sg_var('WEB_IPV64')]#>
<p>also listen on IPv4</p>
</span>
</label>
</div>
</div>
<div class="field-pair">
<label for="handle_reverse_proxy">

View file

@ -120,6 +120,7 @@ WEB_USERNAME = None
WEB_PASSWORD = None
WEB_HOST = None
WEB_IPV6 = None
WEB_IPV64 = None
HANDLE_REVERSE_PROXY = False
PROXY_SETTING = None
@ -545,7 +546,7 @@ def initialize(console_logging=True):
HOME_SEARCH_FOCUS, USE_IMDB_INFO, IMDB_ACCOUNTS, SORT_ARTICLE, FUZZY_DATING, TRIM_ZERO, \
DATE_PRESET, TIME_PRESET, TIME_PRESET_W_SECONDS, TIMEZONE_DISPLAY, \
WEB_USERNAME, WEB_PASSWORD, CALENDAR_UNPROTECTED, USE_API, API_KEY, WEB_PORT, WEB_LOG, \
ENABLE_HTTPS, HTTPS_CERT, HTTPS_KEY, WEB_IPV6, HANDLE_REVERSE_PROXY
ENABLE_HTTPS, HTTPS_CERT, HTTPS_KEY, WEB_IPV6, WEB_IPV64, HANDLE_REVERSE_PROXY
# Gen Config/Advanced
global BRANCH, CUR_COMMIT_BRANCH, GIT_REMOTE, CUR_COMMIT_HASH, GIT_PATH, CPU_PRESET, ANON_REDIRECT, \
ENCRYPTION_VERSION, PROXY_SETTING, PROXY_INDEXERS, FILE_LOGGING_PRESET
@ -703,6 +704,7 @@ def initialize(console_logging=True):
WEB_PORT = minimax(check_setting_int(CFG, 'General', 'web_port', 8081), 8081, 21, 65535)
WEB_ROOT = check_setting_str(CFG, 'General', 'web_root', '').rstrip('/')
WEB_IPV6 = bool(check_setting_int(CFG, 'General', 'web_ipv6', 0))
WEB_IPV64 = bool(check_setting_int(CFG, 'General', 'web_ipv64', 0))
WEB_LOG = bool(check_setting_int(CFG, 'General', 'web_log', 0))
ENCRYPTION_VERSION = check_setting_int(CFG, 'General', 'encryption_version', 0)
WEB_USERNAME = check_setting_str(CFG, 'General', 'web_username', '')
@ -1439,6 +1441,7 @@ def save_config():
new_config['General']['web_host'] = WEB_HOST
new_config['General']['web_port'] = WEB_PORT
new_config['General']['web_ipv6'] = int(WEB_IPV6)
new_config['General']['web_ipv64'] = int(WEB_IPV64)
new_config['General']['web_log'] = int(WEB_LOG)
new_config['General']['web_root'] = WEB_ROOT
new_config['General']['web_username'] = WEB_USERNAME

View file

@ -4604,7 +4604,7 @@ class ConfigGeneral(Config):
logger.log(u'New API generated')
return m.hexdigest()
def saveGeneral(self, log_dir=None, web_port=None, web_log=None, encryption_version=None, web_ipv6=None,
def saveGeneral(self, log_dir=None, web_port=None, web_log=None, encryption_version=None, web_ipv6=None, web_ipv64=None,
update_shows_on_start=None, show_update_hour=None,
trash_remove_show=None, trash_rotate_logs=None, update_frequency=None, launch_browser=None, web_username=None,
use_api=None, api_key=None, indexer_default=None, timezone_display=None, cpu_preset=None, file_logging_preset=None,
@ -4694,6 +4694,7 @@ class ConfigGeneral(Config):
'Unable to create directory ' + os.path.normpath(https_key) + ', https key directory not changed.']
sickbeard.WEB_IPV6 = config.checkbox_to_value(web_ipv6)
sickbeard.WEB_IPV64 = config.checkbox_to_value(web_ipv64)
sickbeard.HANDLE_REVERSE_PROXY = config.checkbox_to_value(handle_reverse_proxy)
# Advanced