fix starting the web via deluge -u web
allow the theme to be specified in the config file
This commit is contained in:
parent
b43e0f6eaa
commit
c73966bdd1
|
@ -68,7 +68,7 @@ current_dir = os.path.dirname(__file__)
|
|||
|
||||
CONFIG_DEFAULTS = {
|
||||
"port": 8112,
|
||||
"template": "slate",
|
||||
"theme": "slate",
|
||||
"pwd_salt": "16f65d5c79b7e93278a28b60fed2431e",
|
||||
"pwd_md5": "2c9baa929ca38fb5c9eb5b054474d1ce",
|
||||
"base": "",
|
||||
|
@ -220,7 +220,6 @@ class TopLevel(resource.Resource):
|
|||
|
||||
__stylesheets = [
|
||||
"/css/ext-all.css",
|
||||
"/css/xtheme-slate.css",
|
||||
"/css/Spinner.css",
|
||||
"/css/deluge.css"
|
||||
]
|
||||
|
@ -284,6 +283,9 @@ class TopLevel(resource.Resource):
|
|||
self.putChild("themes", static.File(rpath("themes")))
|
||||
self.putChild("tracker", Tracker())
|
||||
|
||||
theme = component.get("DelugeWeb").config["theme"]
|
||||
self.__stylesheets.insert(1, "/css/xtheme-%s.css" % theme)
|
||||
|
||||
@property
|
||||
def scripts(self):
|
||||
return self.__scripts
|
||||
|
@ -313,11 +315,13 @@ class TopLevel(resource.Resource):
|
|||
return template.render(scripts=scripts, stylesheets=self.stylesheets)
|
||||
|
||||
class DelugeWeb(component.Component):
|
||||
|
||||
def __init__(self):
|
||||
super(DelugeWeb, self).__init__("DelugeWeb")
|
||||
self.config = ConfigManager("web.conf", CONFIG_DEFAULTS)
|
||||
|
||||
self.top_level = TopLevel()
|
||||
self.site = server.Site(self.top_level)
|
||||
self.config = ConfigManager("web.conf", CONFIG_DEFAULTS)
|
||||
self.port = self.config["port"]
|
||||
self.web_api = WebApi()
|
||||
|
||||
|
|
|
@ -55,5 +55,6 @@ class Web(_UI):
|
|||
if self.options.port: self.server.port = self.options.port
|
||||
self.server.start()
|
||||
|
||||
web = Web()
|
||||
start = web.start
|
||||
def start():
|
||||
web = Web()
|
||||
web.start()
|
Loading…
Reference in New Issue