Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Setting CORS is failing on python3.10 deluge2.1.1 with recent fix #36

Open
JosephBrooksbank opened this issue Nov 7, 2022 · 2 comments

Comments

@JosephBrooksbank
Copy link

JosephBrooksbank commented Nov 7, 2022

Hi, I've been trying to get this plugin working to no avail. I saw that there was an issue with CORS that was fixed recently, so I built the egg myself from source on py3.10. I've enabled it and it shows in the webui, but enabling CORS and attempting to set allowed domains is failing with

11:21:52 [INFO    ][webapi.core                   :61  ] Patching webui for CORS...
11:21:52 [WARNING ][deluge.core.rpcserver         :246 ] An exception occurred while sending RPC_ERROR to client. Wrapping it and resending. Error to send(causing exception goes next):
Traceback (most recent call last):
  File "/usr/lib/python3.10/site-packages/deluge/core/rpcserver.py", line 334, in dispatch
    ret = self.factory.methods[method](*args, **kwargs)
  File "/config/plugins/WebAPI-0.4.0-py3.10.egg/webapi/core.py", line 47, in set_config
    self.patch_web_ui()
  File "/config/plugins/WebAPI-0.4.0-py3.10.egg/webapi/core.py", line 63, in patch_web_ui
    cmp_json = component.get('JSON')
  File "/usr/lib/python3.10/site-packages/deluge/component.py", line 486, in get
    return _ComponentRegistry.components[name]
KeyError: 'JSON'

11:21:52 [ERROR   ][deluge.core.rpcserver         :1512] Exception calling RPC request: 'JSON'
Traceback (most recent call last):
  File "/usr/lib/python3.10/site-packages/deluge/core/rpcserver.py", line 334, in dispatch
    ret = self.factory.methods[method](*args, **kwargs)
  File "/config/plugins/WebAPI-0.4.0-py3.10.egg/webapi/core.py", line 47, in set_config
    self.patch_web_ui()
  File "/config/plugins/WebAPI-0.4.0-py3.10.egg/webapi/core.py", line 63, in patch_web_ui
    cmp_json = component.get('JSON')
  File "/usr/lib/python3.10/site-packages/deluge/component.py", line 486, in get
    return _ComponentRegistry.components[name]
KeyError: 'JSON'

I can look at it more when I'm off work, but help would be appreciated

@JosephBrooksbank
Copy link
Author

JosephBrooksbank commented Nov 7, 2022

Looking into it more, it seems this issue is happening with 3.8 too, and the solution there is to turn off CORS, which isn't super helpful.

EDIT: Since I am still early into the project, to get around the CORS issue I simply moved frameworks to nextJS to implement a proxy API to hit deluge, since the backend doesn't respect CORS headers. All frontend requests go to /api/deluge, rather than to deluge_url/json directly.

@idlesign
Copy link
Owner

idlesign commented Nov 8, 2022

Hi,

KeyError: 'JSON'

The substantial thing here is to investigate the reason why Deluge's JSON component is not available is some cases.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants