allow the base path to be specified by a command line switch on deluge-web

This commit is contained in:
Damien Churchill 2010-03-20 12:01:02 +00:00
parent 5a9b671c85
commit 67bcaa267a
2 changed files with 10 additions and 4 deletions

View File

@ -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()

View File

@ -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