diff --git a/deluge/ui/web/json_api.py b/deluge/ui/web/json_api.py index 6a16ffe36..d2f438bc5 100644 --- a/deluge/ui/web/json_api.py +++ b/deluge/ui/web/json_api.py @@ -785,6 +785,10 @@ class WebApi(JSONComponent): def get_plugin_info(self, name): return component.get("Web.PluginManager").get_plugin_info(name) + @export + def get_plugin_resources(self, name): + return component.get("Web.PluginManager").get_plugin_resources(name) + @export def register_event_listener(self, event): """ diff --git a/deluge/ui/web/pluginmanager.py b/deluge/ui/web/pluginmanager.py index 464a17de8..8a9007173 100644 --- a/deluge/ui/web/pluginmanager.py +++ b/deluge/ui/web/pluginmanager.py @@ -135,3 +135,17 @@ class PluginManager(PluginManagerBase, component.Component): def update(self): pass + + def get_plugin_resources(self, name): + # Get the plugin instance + try: + plugin = component.get("WebPlugin." + name) + except KeyError: + log.info("Plugin has no web ui") + return + info = gather_info(plugin) + info["name"] = name + info["scripts"] = ["/js/%s/%s" % (name.lower(), os.path.basename(s)) for s in info["scripts"]] + info["debug_scripts"] = ["/js/%s/%s" % (name.lower(), os.path.basename(s)) for s in info["debug_scripts"]] + del info["script_directories"] + return info \ No newline at end of file