mirror of
https://github.com/ankitects/anki.git
synced 2026-01-09 12:03:56 -05:00
Added: Extra media endpoint for cors
This commit is contained in:
parent
06a4cd1916
commit
73f161088f
2 changed files with 3 additions and 1 deletions
|
|
@ -62,6 +62,7 @@ flask_cors.CORS(
|
||||||
r"/_anki/js/vendor/mathjax/output/chtml/fonts/woff-v2/.*.woff": {
|
r"/_anki/js/vendor/mathjax/output/chtml/fonts/woff-v2/.*.woff": {
|
||||||
"origins": "*"
|
"origins": "*"
|
||||||
},
|
},
|
||||||
|
r"/media/.*": {"origins": "*"},
|
||||||
r"/*": {"origins": "127.0.0.1"},
|
r"/*": {"origins": "127.0.0.1"},
|
||||||
},
|
},
|
||||||
)
|
)
|
||||||
|
|
@ -481,6 +482,7 @@ def _extract_request(
|
||||||
if not aqt.mw.col:
|
if not aqt.mw.col:
|
||||||
return NotFound(message=f"collection not open, ignore request for {path}")
|
return NotFound(message=f"collection not open, ignore request for {path}")
|
||||||
|
|
||||||
|
path = path.removeprefix("media/")
|
||||||
path = hooks.media_file_filter(path)
|
path = hooks.media_file_filter(path)
|
||||||
return LocalFileRequest(root=aqt.mw.col.media.dir(), path=path)
|
return LocalFileRequest(root=aqt.mw.col.media.dir(), path=path)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -101,7 +101,7 @@ addEventListener("keydown", (e) => {
|
||||||
});
|
});
|
||||||
|
|
||||||
const base = document.createElement("base");
|
const base = document.createElement("base");
|
||||||
base.href = "/";
|
base.href = "/media/";
|
||||||
document.head.appendChild(base);
|
document.head.appendChild(base);
|
||||||
|
|
||||||
function pycmd(cmd: string) {
|
function pycmd(cmd: string) {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue