Commit Graph
193 Commits
Author SHA1 Message Date
admin 62e0e2a48c Modified by www.SourceFiles.app 2026-08-07 04:12:33 +00:00
admin 00b437e0d0 Modified by www.SourceFiles.app 2026-08-07 04:12:33 +00:00
admin 147a6f2b13 Modified by www.SourceFiles.app 2026-08-07 04:12:32 +00:00
admin 39ad1ae76a Modified by www.SourceFiles.app 2026-08-07 04:12:32 +00:00
admin 2d14990a1b Modified by www.SourceFiles.app 2026-08-07 04:12:31 +00:00
admin 359d73471a Modified by www.SourceFiles.app 2026-08-07 04:12:31 +00:00
admin aced914db5 Modified by www.SourceFiles.app 2026-08-07 04:12:30 +00:00
admin 3f3a4eaab7 Modified by www.SourceFiles.app 2026-08-07 04:12:29 +00:00
admin 57fff3171a Modified by www.SourceFiles.app 2026-08-07 04:12:29 +00:00
admin 9032ae3397 Modified by www.SourceFiles.app 2026-08-07 04:12:28 +00:00
admin 70fb824c28 Modified by www.SourceFiles.app 2026-08-07 04:12:27 +00:00
admin eb9f80cbe6 Modified by www.SourceFiles.app 2026-08-07 04:12:27 +00:00
admin 8e66e2fcf4 Modified by www.SourceFiles.app 2026-08-07 04:12:26 +00:00
admin 732799a8ad Modified by www.SourceFiles.app 2026-08-07 04:12:25 +00:00
admin 4198028ce1 Modified by www.SourceFiles.app 2026-08-07 04:12:25 +00:00
admin b21c4f6d18 Modified by www.SourceFiles.app 2026-08-07 04:12:22 +00:00
admin 696851d0c2 Modified by www.SourceFiles.app 2026-08-07 04:12:21 +00:00
admin 8b09c90832 Modified by www.SourceFiles.app 2026-08-07 04:12:21 +00:00
admin b0f4844ef9 Modified by www.SourceFiles.app 2026-08-07 04:12:20 +00:00
admin 1375981a9c Modified by www.SourceFiles.app 2026-08-07 04:12:19 +00:00
admin ffd94f8b64 Modified by www.SourceFiles.app 2026-08-07 04:12:18 +00:00
admin 534ef5c12d Modified by www.SourceFiles.app 2026-08-07 04:12:18 +00:00
admin 622e2b1bff Modified by www.SourceFiles.app 2026-08-07 04:12:17 +00:00
admin 2b58c9a4c6 Modified by www.SourceFiles.app 2026-08-07 04:12:16 +00:00
admin 83db1f9794 Modified by www.SourceFiles.app 2026-08-07 04:12:16 +00:00
admin 14772127f9 Modified by www.SourceFiles.app 2026-08-07 04:12:15 +00:00
admin be50ebdddb Modified by www.SourceFiles.app 2026-08-07 04:12:14 +00:00
admin bf71683be3 Modified by www.SourceFiles.app 2026-08-07 04:12:14 +00:00
admin 3cead1afbc Modified by www.SourceFiles.app 2026-08-07 04:12:13 +00:00
admin 23be17af07 Modified by www.SourceFiles.app 2026-08-07 04:12:13 +00:00
admin 086251b56b Modified by www.SourceFiles.app 2026-08-07 04:12:11 +00:00
admin e00aeed92d Modified by www.SourceFiles.app 2026-08-07 04:12:10 +00:00
admin b47054231e Modified by www.SourceFiles.app 2026-08-07 04:12:09 +00:00
admin 80e00adb98 Modified by www.SourceFiles.app 2026-08-07 04:12:08 +00:00
admin 371d5c00f7 Modified by www.SourceFiles.app 2026-08-07 04:12:08 +00:00
admin f7cb80cdb3 Modified by www.SourceFiles.app 2026-08-07 04:12:07 +00:00
admin b14a5c527a Modified by www.SourceFiles.app 2026-08-07 04:12:07 +00:00
admin ca0b1327ab Modified by www.SourceFiles.app 2026-08-07 04:12:06 +00:00
admin b004b3d46b Modified by www.SourceFiles.app 2026-08-07 04:12:05 +00:00
admin 60c6f16c31 Modified by www.SourceFiles.app 2026-08-07 04:12:04 +00:00
admin 9afcb77dad Modified by www.SourceFiles.app 2026-08-07 04:12:03 +00:00
admin 501026093c Modified by www.SourceFiles.app 2026-08-07 04:12:01 +00:00
admin a334cb5f8e Modified by www.SourceFiles.app 2026-08-07 04:11:58 +00:00
admin 956d75d39e Modified by www.SourceFiles.app 2026-08-07 04:11:57 +00:00
admin 4b77f3a978 Modified by www.SourceFiles.app 2026-08-07 04:11:56 +00:00
admin 475f98932b Modified by www.SourceFiles.app 2026-08-07 03:22:14 +00:00
admin 9ac1637043 Modified by www.SourceFiles.app 2026-08-07 03:14:02 +00:00
admin 933549e345 Modified by www.SourceFiles.app 2026-08-07 03:14:02 +00:00
adminandClaude Opus 5 d2d4e49fa6 Add embedded IMAP/SMTP mail for staff
Admins configure one mail server; each staff member gets their own mailbox
login. Read, reply and compose against real IMAP/SMTP.

IMAP and SMTP are raw TCP, so none of this can run in a browser — every
operation is a TanStack Start server function. mail.functions.ts ships to
the client bundle, so imapflow/nodemailer/mailparser and the crypto
helpers are imported inside handlers, never at the top level. Verified
that Nitro inlines all three into .output/server/_libs, since the Docker
runner stage copies only .output and has no node_modules.

Note this ties the app to the Node deployment: the default local build
targets Cloudflare Workers, which cannot open IMAP sockets.

Credential handling, since a mailbox password grants full read and send
access to someone's mail:

- user_mailboxes has RLS enabled, no policies, and SELECT revoked from
  anon and authenticated. Verified: teacher and admin both see zero rows
  and no ciphertext; only service_role can read it. The revoke is belt and
  braces — Supabase's default privileges had granted SELECT, leaving the
  table one stray policy away from leaking.
- Passwords are sealed with AES-256-GCM using MAIL_CRED_KEY from
  .env.secret, so a database dump alone opens nothing. GCM also makes
  tampering fail the auth tag instead of decrypting to garbage.
- Provisioning verifies credentials against the live IMAP server before
  storing them, so typos surface at setup rather than as a broken inbox.

Message bodies render as plain text; sender HTML is never injected, which
would execute sender-controlled markup and leak read receipts via
tracking pixels.

Mailboxes are limited to admins and teachers. Students are excluded
deliberately — external mail for minors carries archiving, monitoring and
consent obligations that should be chosen, not inherited.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-07-26 10:46:47 -04:00
adminandClaude Opus 5 53ab6b92b5 Let admins edit, deactivate and delete forms
The database already permitted all three (forms admin manage is FOR ALL);
this was purely a missing UI. Create and edit now share one editor, since
the only differences are the initial values and insert vs update.

Three hazards in the existing data model shaped this rather than just
adding buttons:

- form_responses.form_id is ON DELETE CASCADE, so deleting a form
  permanently destroys its submissions. The confirmation names the
  response count and points to deactivating instead. Verified: deleting a
  form with two responses leaves zero.

- The list filtered active = true for everyone, so deactivating a form
  hid it from the only people who could reactivate it. Admins now see
  inactive forms with a badge; families still see only active ones.

- Responses key their answers by field *label* in data_json, so renaming
  a field strands existing answers under the old key. The editor warns
  when the form already has responses. Deliberately not migrating old
  answers — guessing which old label maps to which new one would risk
  silently rewriting submitted data.

Also strips fields with blank labels on save, shows a response count per
form, and gives the response list an empty state.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-07-26 10:26:42 -04:00