mirror of
https://github.com/moparisthebest/SickRage
synced 2025-03-04 10:29:52 -05:00
Merge pull request #558 from Zwooosh/dev
Don't add portnumber when restarting with reverse proxy enabled
This commit is contained in:
commit
e0558ea4cd
@ -55,7 +55,7 @@ from sickbeard import db
|
|||||||
from sickbeard.tv import TVShow
|
from sickbeard.tv import TVShow
|
||||||
from sickbeard import logger
|
from sickbeard import logger
|
||||||
from sickbeard.version import SICKBEARD_VERSION
|
from sickbeard.version import SICKBEARD_VERSION
|
||||||
from sickbeard.databases.mainDB import MIN_DB_VERSION
|
from sickbeard.databases.mainDB import MIN_DB_VERSION
|
||||||
from sickbeard.databases.mainDB import MAX_DB_VERSION
|
from sickbeard.databases.mainDB import MAX_DB_VERSION
|
||||||
|
|
||||||
from sickbeard.webserveInit import initWebServer
|
from sickbeard.webserveInit import initWebServer
|
||||||
@ -338,6 +338,7 @@ def main():
|
|||||||
'username': sickbeard.WEB_USERNAME,
|
'username': sickbeard.WEB_USERNAME,
|
||||||
'password': sickbeard.WEB_PASSWORD,
|
'password': sickbeard.WEB_PASSWORD,
|
||||||
'enable_https': sickbeard.ENABLE_HTTPS,
|
'enable_https': sickbeard.ENABLE_HTTPS,
|
||||||
|
'handle_reverse_proxy': sickbeard.HANDLE_REVERSE_PROXY,
|
||||||
'https_cert': sickbeard.HTTPS_CERT,
|
'https_cert': sickbeard.HTTPS_CERT,
|
||||||
'https_key': sickbeard.HTTPS_KEY,
|
'https_key': sickbeard.HTTPS_KEY,
|
||||||
})
|
})
|
||||||
|
@ -4,14 +4,17 @@
|
|||||||
#set curSBHost = $sbHost
|
#set curSBHost = $sbHost
|
||||||
#set curSBHttpPort = $sbHttpPort
|
#set curSBHttpPort = $sbHttpPort
|
||||||
#set curSBHttpsEnabled = $sbHttpsEnabled
|
#set curSBHttpsEnabled = $sbHttpsEnabled
|
||||||
|
#set curSBHandleReverseProxy = $sbHandleReverseProxy
|
||||||
#except NameMapper.NotFound:
|
#except NameMapper.NotFound:
|
||||||
#set curSBHost = "localhost"
|
#set curSBHost = "localhost"
|
||||||
#set curSBHttpPort = $sickbeard.WEB_PORT
|
#set curSBHttpPort = $sickbeard.WEB_PORT
|
||||||
#set curSBHttpsEnabled = "False"
|
#set curSBHttpsEnabled = "False"
|
||||||
|
#set curSBHandleReverseProxy = "False"
|
||||||
#end try
|
#end try
|
||||||
sbRoot = "$sbRoot";
|
sbRoot = "$sbRoot";
|
||||||
sbHttpPort = "$curSBHttpPort";
|
sbHttpPort = "$curSBHttpPort";
|
||||||
sbHttpsEnabled = "$curSBHttpsEnabled";
|
sbHttpsEnabled = "$curSBHttpsEnabled";
|
||||||
|
sbHandleReverseProxy = "$curSBHandleReverseProxy";
|
||||||
sbHost = "$curSBHost";
|
sbHost = "$curSBHost";
|
||||||
//-->
|
//-->
|
||||||
</script>
|
</script>
|
||||||
|
@ -1,7 +1,14 @@
|
|||||||
if (sbHttpsEnabled != "False" && sbHttpsEnabled != 0)
|
if (sbHandleReverseProxy != "False" && sbHandleReverseProxy != 0)
|
||||||
var sb_base_url = 'https://'+sbHost+':'+sbHttpPort+sbRoot;
|
// Don't add the port to the url if using reverse proxy
|
||||||
|
if (sbHttpsEnabled != "False" && sbHttpsEnabled != 0)
|
||||||
|
var sb_base_url = 'https://'+sbHost+sbRoot;
|
||||||
|
else
|
||||||
|
var sb_base_url = 'http://'+sbHost+sbRoot;
|
||||||
else
|
else
|
||||||
var sb_base_url = 'http://'+sbHost+':'+sbHttpPort+sbRoot;
|
if (sbHttpsEnabled != "False" && sbHttpsEnabled != 0)
|
||||||
|
var sb_base_url = 'https://'+sbHost+':'+sbHttpPort+sbRoot;
|
||||||
|
else
|
||||||
|
var sb_base_url = 'http://'+sbHost+':'+sbHttpPort+sbRoot;
|
||||||
|
|
||||||
var base_url = window.location.protocol+'//'+window.location.host+sbRoot;
|
var base_url = window.location.protocol+'//'+window.location.host+sbRoot;
|
||||||
var is_alive_url = sbRoot+'/home/is_alive';
|
var is_alive_url = sbRoot+'/home/is_alive';
|
||||||
@ -12,7 +19,7 @@ var num_restart_waits = 0;
|
|||||||
function is_alive() {
|
function is_alive() {
|
||||||
timeout_id = 0;
|
timeout_id = 0;
|
||||||
$.get(is_alive_url, function(data) {
|
$.get(is_alive_url, function(data) {
|
||||||
|
|
||||||
// if it's still initalizing then just wait and try again
|
// if it's still initalizing then just wait and try again
|
||||||
if (data.msg == 'nope') {
|
if (data.msg == 'nope') {
|
||||||
$('#shut_down_loading').hide();
|
$('#shut_down_loading').hide();
|
||||||
@ -36,11 +43,11 @@ function is_alive() {
|
|||||||
}, 'jsonp');
|
}, 'jsonp');
|
||||||
}
|
}
|
||||||
|
|
||||||
$(document).ready(function()
|
$(document).ready(function()
|
||||||
{
|
{
|
||||||
|
|
||||||
is_alive();
|
is_alive();
|
||||||
|
|
||||||
$(document).ajaxError(function(e, jqxhr, settings, exception) {
|
$(document).ajaxError(function(e, jqxhr, settings, exception) {
|
||||||
num_restart_waits += 1;
|
num_restart_waits += 1;
|
||||||
|
|
||||||
@ -49,7 +56,7 @@ $(document).ready(function()
|
|||||||
$('#restart_message').show();
|
$('#restart_message').show();
|
||||||
is_alive_url = sb_base_url+'/home/is_alive';
|
is_alive_url = sb_base_url+'/home/is_alive';
|
||||||
|
|
||||||
// if https is enabled or you are currently on https and the port or protocol changed just wait 5 seconds then redirect.
|
// if https is enabled or you are currently on https and the port or protocol changed just wait 5 seconds then redirect.
|
||||||
// This is because the ajax will fail if the cert is untrusted or the the http ajax requst from https will fail because of mixed content error.
|
// This is because the ajax will fail if the cert is untrusted or the the http ajax requst from https will fail because of mixed content error.
|
||||||
if ((sbHttpsEnabled != "False" && sbHttpsEnabled != 0) || window.location.protocol == "https:") {
|
if ((sbHttpsEnabled != "False" && sbHttpsEnabled != 0) || window.location.protocol == "https:") {
|
||||||
if (base_url != sb_base_url) {
|
if (base_url != sb_base_url) {
|
||||||
|
@ -95,6 +95,8 @@ class PageTemplate(Template):
|
|||||||
self.sbHttpPort = sickbeard.WEB_PORT
|
self.sbHttpPort = sickbeard.WEB_PORT
|
||||||
self.sbHttpsPort = sickbeard.WEB_PORT
|
self.sbHttpsPort = sickbeard.WEB_PORT
|
||||||
self.sbHttpsEnabled = sickbeard.ENABLE_HTTPS
|
self.sbHttpsEnabled = sickbeard.ENABLE_HTTPS
|
||||||
|
self.sbHandleReverseProxy = sickbeard.HANDLE_REVERSE_PROXY
|
||||||
|
|
||||||
if cherrypy.request.headers['Host'][0] == '[':
|
if cherrypy.request.headers['Host'][0] == '[':
|
||||||
self.sbHost = re.match("^\[.*\]", cherrypy.request.headers['Host'], re.X | re.M | re.S).group(0)
|
self.sbHost = re.match("^\[.*\]", cherrypy.request.headers['Host'], re.X | re.M | re.S).group(0)
|
||||||
else:
|
else:
|
||||||
@ -941,7 +943,7 @@ class ConfigGeneral:
|
|||||||
sickbeard.SUBTITLES_DEFAULT = config.checkbox_to_value(subtitles)
|
sickbeard.SUBTITLES_DEFAULT = config.checkbox_to_value(subtitles)
|
||||||
|
|
||||||
sickbeard.save_config()
|
sickbeard.save_config()
|
||||||
|
|
||||||
@cherrypy.expose
|
@cherrypy.expose
|
||||||
def generateKey(self):
|
def generateKey(self):
|
||||||
""" Return a new randomized API_KEY
|
""" Return a new randomized API_KEY
|
||||||
@ -1597,7 +1599,7 @@ class ConfigProviders:
|
|||||||
sickbeard.KAT_TRUSTED = config.checkbox_to_value(kat_trusted)
|
sickbeard.KAT_TRUSTED = config.checkbox_to_value(kat_trusted)
|
||||||
sickbeard.KAT_RATIO = kat_ratio
|
sickbeard.KAT_RATIO = kat_ratio
|
||||||
sickbeard.KAT_VERIFIED = config.checkbox_to_value(kat_verified)
|
sickbeard.KAT_VERIFIED = config.checkbox_to_value(kat_verified)
|
||||||
|
|
||||||
sickbeard.PUBLICHD_RATIO = publichd_ratio
|
sickbeard.PUBLICHD_RATIO = publichd_ratio
|
||||||
|
|
||||||
sickbeard.TORRENTDAY_USERNAME = torrentday_username.strip()
|
sickbeard.TORRENTDAY_USERNAME = torrentday_username.strip()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user