mirror of
https://github.com/Tautulli/Tautulli.git
synced 2025-07-11 07:46:07 -07:00
Move BaseRedirect to webserve
This commit is contained in:
parent
cc05552685
commit
bde6309277
2 changed files with 15 additions and 19 deletions
|
@ -155,6 +155,18 @@ def mako_error_handler(context, error):
|
||||||
raise
|
raise
|
||||||
|
|
||||||
|
|
||||||
|
class BaseRedirect(object):
|
||||||
|
@cherrypy.expose
|
||||||
|
def index(self):
|
||||||
|
raise cherrypy.HTTPRedirect(plexpy.HTTP_ROOT)
|
||||||
|
|
||||||
|
@cherrypy.expose
|
||||||
|
def status(self, *args, **kwargs):
|
||||||
|
path = '/' + '/'.join(args) if args else ''
|
||||||
|
query = '?' + urlencode(kwargs) if kwargs else ''
|
||||||
|
raise cherrypy.HTTPRedirect(plexpy.HTTP_ROOT + 'status' + path + query)
|
||||||
|
|
||||||
|
|
||||||
class WebInterface(object):
|
class WebInterface(object):
|
||||||
|
|
||||||
auth = AuthController()
|
auth = AuthController()
|
||||||
|
|
|
@ -15,12 +15,8 @@
|
||||||
# You should have received a copy of the GNU General Public License
|
# You should have received a copy of the GNU General Public License
|
||||||
# along with Tautulli. If not, see <http://www.gnu.org/licenses/>.
|
# along with Tautulli. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
from __future__ import unicode_literals
|
|
||||||
from future.builtins import object
|
|
||||||
|
|
||||||
import os
|
import os
|
||||||
import sys
|
import sys
|
||||||
from future.moves.urllib.parse import urlencode
|
|
||||||
|
|
||||||
import cherrypy
|
import cherrypy
|
||||||
|
|
||||||
|
@ -29,12 +25,12 @@ if plexpy.PYTHON_VERSION < 3:
|
||||||
import logger
|
import logger
|
||||||
import webauth
|
import webauth
|
||||||
from helpers import create_https_certificates
|
from helpers import create_https_certificates
|
||||||
from webserve import WebInterface
|
from webserve import WebInterface, BaseRedirect
|
||||||
else:
|
else:
|
||||||
from plexpy import logger
|
from plexpy import logger
|
||||||
from plexpy import webauth
|
from plexpy import webauth
|
||||||
from plexpy.helpers import create_https_certificates
|
from plexpy.helpers import create_https_certificates
|
||||||
from plexpy.webserve import WebInterface
|
from plexpy.webserve import WebInterface, BaseRedirect
|
||||||
|
|
||||||
|
|
||||||
def start():
|
def start():
|
||||||
|
@ -133,7 +129,7 @@ def initialize(options):
|
||||||
basic_auth_enabled = False
|
basic_auth_enabled = False
|
||||||
|
|
||||||
if options['http_root'].strip('/'):
|
if options['http_root'].strip('/'):
|
||||||
plexpy.HTTP_ROOT = options['http_root'] = '/' + options['http_root'].strip('/') + '/'
|
plexpy.HTTP_ROOT = options['http_root'] = '/' + str(options['http_root'].strip('/')) + '/'
|
||||||
else:
|
else:
|
||||||
plexpy.HTTP_ROOT = options['http_root'] = '/'
|
plexpy.HTTP_ROOT = options['http_root'] = '/'
|
||||||
|
|
||||||
|
@ -272,18 +268,6 @@ def initialize(options):
|
||||||
cherrypy.server.wait()
|
cherrypy.server.wait()
|
||||||
|
|
||||||
|
|
||||||
class BaseRedirect(object):
|
|
||||||
@cherrypy.expose
|
|
||||||
def index(self):
|
|
||||||
raise cherrypy.HTTPRedirect(plexpy.HTTP_ROOT)
|
|
||||||
|
|
||||||
@cherrypy.expose
|
|
||||||
def status(self, *args, **kwargs):
|
|
||||||
path = '/' + '/'.join(args) if args else ''
|
|
||||||
query = '?' + urlencode(kwargs) if kwargs else ''
|
|
||||||
raise cherrypy.HTTPRedirect(plexpy.HTTP_ROOT + 'status' + path + query)
|
|
||||||
|
|
||||||
|
|
||||||
def proxy():
|
def proxy():
|
||||||
# logger.debug("REQUEST URI: %s, HEADER [X-Forwarded-Host]: %s, [X-Host]: %s, [Origin]: %s, [Host]: %s",
|
# logger.debug("REQUEST URI: %s, HEADER [X-Forwarded-Host]: %s, [X-Host]: %s, [Origin]: %s, [Host]: %s",
|
||||||
# cherrypy.request.wsgi_environ['REQUEST_URI'],
|
# cherrypy.request.wsgi_environ['REQUEST_URI'],
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue