mirror of
https://github.com/ankitects/anki.git
synced 2025-09-19 06:22:22 -04:00
Add add-on scripts to editor CSP (#3942)
This commit is contained in:
parent
1e74e8e86e
commit
79b19a17a3
1 changed files with 5 additions and 1 deletions
|
@ -752,8 +752,12 @@ def legacy_page_data() -> Response:
|
|||
# have access to our internal API, and is a security risk.
|
||||
if page.context == PageContext.EDITOR:
|
||||
port = aqt.mw.mediaServer.getPort()
|
||||
csp_paths = (
|
||||
f"http://127.0.0.1:{port}/_anki/",
|
||||
f"http://127.0.0.1:{port}/_addons/",
|
||||
)
|
||||
response.headers["Content-Security-Policy"] = (
|
||||
f"script-src http://127.0.0.1:{port}/_anki/"
|
||||
f"script-src {' '.join(csp_paths)}"
|
||||
)
|
||||
return response
|
||||
else:
|
||||
|
|
Loading…
Reference in a new issue