diff --git a/deluge/ui/web/server.py b/deluge/ui/web/server.py index f9d5f379d..44ea65c4e 100644 --- a/deluge/ui/web/server.py +++ b/deluge/ui/web/server.py @@ -406,9 +406,6 @@ class TopLevel(resource.Resource): theme = CONFIG_DEFAULTS.get("theme") self.__stylesheets.insert(1, "themes/css/xtheme-%s.css" % theme) - self.base = component.get("DelugeWeb").config["base"] - - @property def scripts(self): return self.__scripts @@ -480,7 +477,9 @@ class TopLevel(resource.Resource): template = Template(filename=rpath("index.html")) 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: @@ -534,6 +533,7 @@ class DelugeWeb(component.Component): self.https = self.config["https"] self.pkey = self.config["pkey"] self.cert = self.config["cert"] + self.base = self.config["base"] self.web_api = WebApi() self.auth = Auth() diff --git a/deluge/ui/web/web.py b/deluge/ui/web/web.py index c4e51b343..a2b57655a 100644 --- a/deluge/ui/web/web.py +++ b/deluge/ui/web/web.py @@ -53,6 +53,9 @@ class Web(_UI): self.__server = None 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", help="Fork the web interface process into the background", action="store_true", default=False) @@ -103,6 +106,9 @@ class Web(_UI): import server self.__server = server.DelugeWeb() + + if self.options.base: + self.server.base = self.options.base if self.options.port: self.server.port = self.options.port