From 67bcaa267a71ddf798a5dc4b8c6714b97e2dbdaf Mon Sep 17 00:00:00 2001 From: Damien Churchill Date: Sat, 20 Mar 2010 12:01:02 +0000 Subject: [PATCH] allow the base path to be specified by a command line switch on deluge-web --- deluge/ui/web/server.py | 8 ++++---- deluge/ui/web/web.py | 6 ++++++ 2 files changed, 10 insertions(+), 4 deletions(-) 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