mirror of
https://github.com/codex-storage/deluge.git
synced 2025-02-20 07:08:30 +00:00
[Web] Fix error in WebApi in standalone mode
In GTKUI standalone mode, WebApi.enable would try to connect to daemon if web.conf had the 'default_daemon' option set, causing the client calls to break.
This commit is contained in:
parent
38e0bc1257
commit
e370d7dbdd
@ -383,10 +383,12 @@ class WebApi(JSONComponent):
|
|||||||
client.set_disconnect_callback(None)
|
client.set_disconnect_callback(None)
|
||||||
|
|
||||||
def enable(self):
|
def enable(self):
|
||||||
if not client.is_classicmode():
|
|
||||||
client.set_disconnect_callback(self._on_client_disconnect)
|
|
||||||
client.register_event_handler("PluginEnabledEvent", self._json.get_remote_methods)
|
client.register_event_handler("PluginEnabledEvent", self._json.get_remote_methods)
|
||||||
client.register_event_handler("PluginDisabledEvent", self._json.get_remote_methods)
|
client.register_event_handler("PluginDisabledEvent", self._json.get_remote_methods)
|
||||||
|
|
||||||
|
if not client.is_classicmode():
|
||||||
|
client.set_disconnect_callback(self._on_client_disconnect)
|
||||||
|
|
||||||
if component.get("DelugeWeb").config["default_daemon"]:
|
if component.get("DelugeWeb").config["default_daemon"]:
|
||||||
# Sort out getting the default daemon here
|
# Sort out getting the default daemon here
|
||||||
default = component.get("DelugeWeb").config["default_daemon"]
|
default = component.get("DelugeWeb").config["default_daemon"]
|
||||||
@ -395,6 +397,7 @@ class WebApi(JSONComponent):
|
|||||||
return self._connect_daemon(*host[1:])
|
return self._connect_daemon(*host[1:])
|
||||||
else:
|
else:
|
||||||
return self._connect_daemon()
|
return self._connect_daemon()
|
||||||
|
|
||||||
return defer.succeed(True)
|
return defer.succeed(True)
|
||||||
|
|
||||||
def _on_client_disconnect(self, *args):
|
def _on_client_disconnect(self, *args):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user