improve support for a base config parameter

This commit is contained in:
Damien Churchill 2010-03-09 13:27:01 +00:00
parent 6fd3cd56ff
commit e2b78be264
2 changed files with 6 additions and 4 deletions

View File

@ -71,7 +71,7 @@ Deluge.UI = {
Deluge.Events.on("connect", this.onConnect, this);
Deluge.Events.on("disconnect", this.onDisconnect, this);
Deluge.Client = new Ext.ux.util.RpcClient({
url: '/json'
url: Deluge.config.base + 'json'
});
for (var plugin in Deluge.Plugins) {

View File

@ -97,6 +97,7 @@ CONFIG_DEFAULTS = {
"theme": "gray",
# Server Settings
"base": "/",
"port": 8112,
"https": False,
"pkey": "ssl/daemon.pkey",
@ -105,7 +106,7 @@ CONFIG_DEFAULTS = {
UI_CONFIG_KEYS = (
"theme", "sidebar_show_zero", "sidebar_show_trackers",
"show_session_speed"
"show_session_speed", "base"
)
OLD_CONFIG_KEYS = (
@ -404,6 +405,8 @@ class TopLevel(resource.Resource):
theme = CONFIG_DEFAULTS.get("theme")
self.__stylesheets.insert(1, "/css/xtheme-%s.css" % theme)
self.base = component.get("DelugeWeb").config["base"]
@property
def scripts(self):
@ -474,10 +477,9 @@ class TopLevel(resource.Resource):
else:
scripts = self.scripts[:]
base = request.args.get('base', [''])[-1]
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=base)
return template.render(scripts=scripts, stylesheets=self.stylesheets, debug=debug, base=self.base)
class ServerContextFactory: