Fifth revision: share-link AI safety, sturdier generation, cleaner UI
All checks were successful
Verify and publish V2 container / build-and-push (push) Successful in 1m0s

- Malformed model JSON is sent back for repair, then retried; a failed job
  starts over once before it fails. Visitors can dismiss failed sets.
- Generated sets get a short distinct name and description; flashcards are
  atomic and have no hints; standard study shows known/learning counts.
- Share links: "In progress" list, finished sets join the normal lists with a
  "New" tag, plain progress steps, newest exam first.
- Share-link AI expires after a week, can be limited to the US or Arizona
  (DB-IP Lite or Cloudflare headers) and is locked by abuse protection
  (migration 8).
- The assistant never answers from general knowledge; MCP and web search
  tools load without a manual test.
- Plain-text copy, no question count in exam mode, filler text removed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Elijah 2026-11-16 09:17:50 -07:00
parent d8df5edf30
commit 85d5c9186d
46 changed files with 1242 additions and 283 deletions

View file

@ -450,6 +450,19 @@ CREATE INDEX drafts_share ON drafts(share_id, created_at);
ALTER TABLE shares ADD COLUMN generate_reset_at INTEGER;
`;
/**
* Share-link AI safety: AI features switch themselves off a week after they are turned on
* (`ai_expires_at`), and abuse protection can lock them (`ai_blocked`, JSON {at, reason}).
* Links that already have AI on get their week from now. A visitor can dismiss a failed set
* from the link (`share_hidden`); the owner still sees it in Drafts.
*/
const shareAiSafety = `
ALTER TABLE shares ADD COLUMN ai_expires_at INTEGER;
ALTER TABLE shares ADD COLUMN ai_blocked TEXT;
UPDATE shares SET ai_expires_at = CAST(strftime('%s', 'now') AS INTEGER) * 1000 + 604800000 WHERE ai LIKE '%true%';
ALTER TABLE drafts ADD COLUMN share_hidden INTEGER NOT NULL DEFAULT 0;
`;
export const MIGRATIONS: Migration[] = [
{ id: 1, name: 'init', sql: init },
{ id: 2, name: 'embeddings', sql: embeddings },
@ -458,4 +471,5 @@ export const MIGRATIONS: Migration[] = [
{ id: 5, name: 'revision3', sql: revision3 },
{ id: 6, name: 'revision4', sql: revision4 },
{ id: 7, name: 'share-generation', sql: shareGeneration },
{ id: 8, name: 'share-ai-safety', sql: shareAiSafety },
];