Harden private media and backup recovery; add V2 deployment and migration guides

This commit is contained in:
Elijah 2026-11-11 19:31:32 -07:00
parent c549c34f60
commit ffaa1f6afa
19 changed files with 623 additions and 14 deletions

View file

@ -682,7 +682,7 @@ export default function AiSettings() {
</div>
)}
<p className="mt-2.5 text-xs text-ink-3">
API keys are encrypted on the server and never sent back to the browser. A ChatGPT, Claude or Gemini app subscription is separate from API access and cannot be used here: each provider bills API usage on its own.
API keys are encrypted on the server and never sent back to the browser. These connections use each provider's API billing. ChatGPT plan sign-in requires a separate approved integration for remotely hosted apps; it is not configured in this installation.
</p>
</Section>

View file

@ -132,6 +132,7 @@ export function QuizRunner(p: RunnerProps) {
const tick = useLatest(p.onTick);
const finish = useLatest(p.onFinish);
const elapsedRef = useLatest(elapsed);
const autoSubmitted = useRef(false);
const total = p.questions.length;
const index = Math.min(p.index, total - 1);
@ -168,7 +169,10 @@ export function QuizRunner(p: RunnerProps) {
if (elapsed > 0 && elapsed % 10 === 0) tick.current?.(elapsed);
}, [elapsed, tick]);
useEffect(() => {
if (remaining === 0 && !p.finishing) finish.current(elapsedRef.current);
if (remaining === 0 && !p.finishing && !autoSubmitted.current) {
autoSubmitted.current = true;
finish.current(elapsedRef.current);
}
}, [remaining, p.finishing, finish, elapsedRef]);
useEffect(() => {
topRef.current?.scrollIntoView({ block: 'start' });

View file

@ -106,6 +106,10 @@ export default function SessionPage() {
const back = attempt.quizId ? `/quizzes/${attempt.quizId}` : attempt.classId ? `/classes/${attempt.classId}` : '/';
const exit = async () => {
await flush();
if (Object.keys(pending.current.answers).length > 0 || pending.current.flags !== undefined || pending.current.currentIndex !== undefined || pending.current.elapsedSec !== undefined) {
toast.error('Your latest progress has not been saved. Stay here and retry when connected.');
return;
}
void refresh();
navigate(back);
};
@ -165,6 +169,9 @@ export default function SessionPage() {
setFinishing(true);
try {
await flush();
if (Object.keys(pending.current.answers).length > 0 || pending.current.flags !== undefined || pending.current.currentIndex !== undefined || pending.current.elapsedSec !== undefined) {
throw new Error('Your latest progress has not been saved. Reconnect and submit again.');
}
const res = await api.post<{ attempt: Attempt }>(`/api/attempts/${attempt.id}/complete`, { elapsedSec });
qc.setQueryData(qk.attempt(attempt.id), res.attempt);
void refresh();

View file

@ -21,7 +21,7 @@
--line-strong: #d3cec1;
--ink: #1b1a17;
--ink-2: #57534a;
--ink-3: #8b867a;
--ink-3: #6f6a60;
--accent: #2747d8;
--accent-hover: #1c37b5;
--accent-ink: #ffffff;
@ -57,7 +57,7 @@
--line-strong: #46423a;
--ink: #f3f0e9;
--ink-2: #bcb7ab;
--ink-3: #8a857a;
--ink-3: #aaa496;
--accent: #91a6ff;
--accent-hover: #adbdff;
--accent-ink: #0f1430;