mirror of
https://github.com/ankitects/anki.git
synced 2025-09-18 14:02:21 -04:00
Add ability for pages created by add-ons to opt in to API
This commit is contained in:
parent
d752a43e2a
commit
07909a54e2
1 changed files with 8 additions and 1 deletions
|
@ -70,6 +70,9 @@ class PageContext(enum.Enum):
|
|||
REVIEWER = 2
|
||||
# something in /_anki/pages/
|
||||
NON_LEGACY_PAGE = 3
|
||||
# Do not use this if you present user content (e.g. content from cards), as it's a
|
||||
# security issue.
|
||||
ADDON_PAGE = 4
|
||||
|
||||
|
||||
@dataclass
|
||||
|
@ -645,7 +648,11 @@ def _check_dynamic_request_permissions():
|
|||
aqt.mw.taskman.run_on_main(warn)
|
||||
abort(403)
|
||||
|
||||
if context == PageContext.NON_LEGACY_PAGE or context == PageContext.EDITOR:
|
||||
if (
|
||||
context == PageContext.NON_LEGACY_PAGE
|
||||
or context == PageContext.EDITOR
|
||||
or context == PageContext.ADDON_PAGE
|
||||
):
|
||||
pass
|
||||
elif context == PageContext.REVIEWER and request.path in (
|
||||
"/_anki/getSchedulingStatesWithContext",
|
||||
|
|
Loading…
Reference in a new issue