diff --git a/deluge/ui/web/js/Deluge.js b/deluge/ui/web/js/Deluge.js index a0f086c0e..aa7d091a0 100644 --- a/deluge/ui/web/js/Deluge.js +++ b/deluge/ui/web/js/Deluge.js @@ -23,11 +23,6 @@ Copyright: Ext.namespace('Ext.deluge'); -var Deluge = { - author: 'Damien Churchill ', - version: '1.2-dev' -}; - (function() { /* Add some helper functions to Ext */ Ext.apply(Function.prototype, { diff --git a/deluge/ui/web/server.py b/deluge/ui/web/server.py index 45c8ddd78..14e3d6f9f 100644 --- a/deluge/ui/web/server.py +++ b/deluge/ui/web/server.py @@ -85,6 +85,19 @@ def rpath(path): """ return os.path.join(current_dir, path) +class Config(resource.Resource): + """ + Writes out a javascript file that contains the WebUI configuration + available as Deluge.Config. + """ + + def render(self, request): + return """Deluge = { + author: 'Damien Churchill ', + version: '1.2-dev', + config: %s +}""" % common.json.dumps(component.get("DelugeWeb").config.config) + class GetText(resource.Resource): def render(self, request): request.setHeader("content-type", "text/javascript; encoding=utf-8") @@ -227,6 +240,7 @@ class TopLevel(resource.Resource): "/js/ext-base.js", "/js/ext-all.js", "/js/ext-extensions.js", + "/config.js", "/gettext.js", "/js/deluge-yc.js" ] @@ -235,6 +249,7 @@ class TopLevel(resource.Resource): "/js/ext-base.js", "/js/ext-all-debug.js", "/js/ext-extensions-debug.js", + "/config.js", "/gettext.js", "/js/Deluge.js", "/js/Deluge.Formatters.js", @@ -270,6 +285,7 @@ class TopLevel(resource.Resource): def __init__(self): resource.Resource.__init__(self) + self.putChild("config.js", Config()) self.putChild("css", LookupResource("Css", rpath("css"))) self.putChild("gettext.js", GetText()) self.putChild("flag", Flag())