allow the base path to be specified by a command line switch on deluge-web
This commit is contained in:
parent
5a9b671c85
commit
67bcaa267a
|
@ -406,9 +406,6 @@ class TopLevel(resource.Resource):
|
||||||
theme = CONFIG_DEFAULTS.get("theme")
|
theme = CONFIG_DEFAULTS.get("theme")
|
||||||
self.__stylesheets.insert(1, "themes/css/xtheme-%s.css" % theme)
|
self.__stylesheets.insert(1, "themes/css/xtheme-%s.css" % theme)
|
||||||
|
|
||||||
self.base = component.get("DelugeWeb").config["base"]
|
|
||||||
|
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def scripts(self):
|
def scripts(self):
|
||||||
return self.__scripts
|
return self.__scripts
|
||||||
|
@ -480,7 +477,9 @@ class TopLevel(resource.Resource):
|
||||||
|
|
||||||
template = Template(filename=rpath("index.html"))
|
template = Template(filename=rpath("index.html"))
|
||||||
request.setHeader("content-type", "text/html; charset=utf-8")
|
request.setHeader("content-type", "text/html; charset=utf-8")
|
||||||
return template.render(scripts=scripts, stylesheets=self.stylesheets, debug=debug, base=self.base)
|
base = component.get("DelugeWeb").base
|
||||||
|
|
||||||
|
return template.render(scripts=scripts, stylesheets=self.stylesheets, debug=debug, base=base)
|
||||||
|
|
||||||
class ServerContextFactory:
|
class ServerContextFactory:
|
||||||
|
|
||||||
|
@ -534,6 +533,7 @@ class DelugeWeb(component.Component):
|
||||||
self.https = self.config["https"]
|
self.https = self.config["https"]
|
||||||
self.pkey = self.config["pkey"]
|
self.pkey = self.config["pkey"]
|
||||||
self.cert = self.config["cert"]
|
self.cert = self.config["cert"]
|
||||||
|
self.base = self.config["base"]
|
||||||
self.web_api = WebApi()
|
self.web_api = WebApi()
|
||||||
self.auth = Auth()
|
self.auth = Auth()
|
||||||
|
|
||||||
|
|
|
@ -53,6 +53,9 @@ class Web(_UI):
|
||||||
self.__server = None
|
self.__server = None
|
||||||
|
|
||||||
group = OptionGroup(self.parser, "Web Options")
|
group = OptionGroup(self.parser, "Web Options")
|
||||||
|
group.add_option("-b", "--base", dest="base",
|
||||||
|
help="Set the base path that the ui is running on (proxying)",
|
||||||
|
action="store", default=None)
|
||||||
group.add_option("-f", "--fork", dest="fork",
|
group.add_option("-f", "--fork", dest="fork",
|
||||||
help="Fork the web interface process into the background",
|
help="Fork the web interface process into the background",
|
||||||
action="store_true", default=False)
|
action="store_true", default=False)
|
||||||
|
@ -103,6 +106,9 @@ class Web(_UI):
|
||||||
|
|
||||||
import server
|
import server
|
||||||
self.__server = server.DelugeWeb()
|
self.__server = server.DelugeWeb()
|
||||||
|
|
||||||
|
if self.options.base:
|
||||||
|
self.server.base = self.options.base
|
||||||
|
|
||||||
if self.options.port:
|
if self.options.port:
|
||||||
self.server.port = self.options.port
|
self.server.port = self.options.port
|
||||||
|
|
Loading…
Reference in New Issue