mirror of
https://github.com/ankitects/anki.git
synced 2025-11-06 20:57:13 -05:00
./check
This commit is contained in:
parent
0db28a7101
commit
c76f013b16
2 changed files with 6 additions and 5 deletions
|
|
@ -720,6 +720,7 @@ post_handlers = {
|
||||||
for handler in exposed_backend_list
|
for handler in exposed_backend_list
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
def _extract_collection_post_request(path: str) -> DynamicRequest | NotFound:
|
def _extract_collection_post_request(path: str) -> DynamicRequest | NotFound:
|
||||||
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}")
|
||||||
|
|
@ -767,7 +768,7 @@ def _check_dynamic_request_permissions():
|
||||||
"/_anki/i18nResources",
|
"/_anki/i18nResources",
|
||||||
"/_anki/congratsInfo",
|
"/_anki/congratsInfo",
|
||||||
# TODO: Unsure about this
|
# TODO: Unsure about this
|
||||||
"/_anki/nextCardData"
|
"/_anki/nextCardData",
|
||||||
):
|
):
|
||||||
pass
|
pass
|
||||||
else:
|
else:
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
// Copyright: Ankitects Pty Ltd and contributors
|
// Copyright: Ankitects Pty Ltd and contributors
|
||||||
// License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
// License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
||||||
import { CardAnswer, SchedulingStates } from "@generated/anki/scheduler_pb";
|
import type { CardAnswer, SchedulingStates } from "@generated/anki/scheduler_pb";
|
||||||
import { nextCardData } from "@generated/backend";
|
import { nextCardData } from "@generated/backend";
|
||||||
import { bridgeCommand } from "@tslib/bridgecommand";
|
import { bridgeCommand } from "@tslib/bridgecommand";
|
||||||
import { writable } from "svelte/store";
|
import { writable } from "svelte/store";
|
||||||
|
|
@ -8,20 +8,20 @@ import { writable } from "svelte/store";
|
||||||
export function setupReviewer(iframe: HTMLIFrameElement) {
|
export function setupReviewer(iframe: HTMLIFrameElement) {
|
||||||
const cardClass = writable("");
|
const cardClass = writable("");
|
||||||
let answer_html = "";
|
let answer_html = "";
|
||||||
let states: SchedulingStates | undefined;
|
let _states: SchedulingStates | undefined = undefined;
|
||||||
|
|
||||||
function updateHtml(htmlString) {
|
function updateHtml(htmlString) {
|
||||||
iframe.contentWindow?.postMessage({ type: "html", value: htmlString }, "*");
|
iframe.contentWindow?.postMessage({ type: "html", value: htmlString }, "*");
|
||||||
}
|
}
|
||||||
|
|
||||||
async function showQuestion(answer: CardAnswer | null) {
|
async function showQuestion(answer: CardAnswer | null) {
|
||||||
let resp = await nextCardData({
|
const resp = await nextCardData({
|
||||||
answer: answer || undefined,
|
answer: answer || undefined,
|
||||||
});
|
});
|
||||||
// TODO: "Congratulation screen" logic
|
// TODO: "Congratulation screen" logic
|
||||||
const question = resp.nextCard?.front || "";
|
const question = resp.nextCard?.front || "";
|
||||||
answer_html = resp.nextCard?.back || "";
|
answer_html = resp.nextCard?.back || "";
|
||||||
states = resp.nextCard?.states;
|
_states = resp.nextCard?.states;
|
||||||
console.log({ resp });
|
console.log({ resp });
|
||||||
updateHtml(question);
|
updateHtml(question);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue