Commit Graph
2142 Commits
Author SHA1 Message Date
Linus Rath 687e7cc012 feat: move offline mode onto the encrypted local store
The IndexedDB cache, its crypto, the responder and the page-side sync
go. lib/offline keeps its structure, policy, wipes, sign-out gates and
notices; answers, the outbox and sync now live in lib/store, in a worker
behind lib/store/client/api.ts.

What users get besides that:
- every folder is kept, not just the Inbox and opened ones
- delete for good and empty trash work offline
- a change the server refuses, or that meets a message changed on
  another device, is shown instead of dropped
- a send whose response got lost is looked up by a Message-ID fixed when
  it was queued, then finished, submitted or sent again
- with the store on, a start paints from the local copy, then connects

An account the app drops by itself no longer wipes its data: only a
sign-out or an explicit removal does. The outbox of the old database
moves over once, in lib/offline/migrate-legacy.ts, and the old database
goes only after the store committed. `isNetworkFailure` now counts
timeouts and proxy 5xx. Sends and outbox requests are never answered
from the device.

Tests moved with the code: cache.test.ts and responder.test.ts are
replaced by lib/store/__tests__/, and review-fixes.test.ts, outbox.test.ts
and client-fallback.test.ts now run the real engine on node:sqlite.
Changed assertions: an uncertain send is looked up rather than left alone
forever, destroy and empty trash are queued rather than refused, and #9
(opened folders) became "a folder the server deleted goes", since all
folders are kept.
2026-11-03 05:54:39 +01:00
Linus Rath 7aa12d19b5 chore: fail a Lite build that ships the local store's engine 2026-11-03 05:54:37 +01:00
Linus Rath 062a078e1e feat: keep the local store's engine for a start without a network 2026-11-03 05:54:36 +01:00
Linus Rath 29778da2d4 fix: wait out an unreachable token endpoint instead of counting it toward a sign-out
An existing assertion changes: a token endpoint that can't be reached now answers 503, not 500, because the client counts repeated 500s as permanent and signs the user out.
2026-11-03 05:54:34 +01:00
Linus Rath eb8db7f27d feat: keep offline changes, sends and conflicts in the local store's outbox 2026-11-03 05:30:39 +01:00
Linus Rath 51ccac02ca feat: answer every mail read from the local store, including header forms, identities and quotas, and keep attachments 2026-11-03 05:30:09 +01:00
Linus Rath bad156eaed refactor: let each part of the local store expose its own calls to the page 2026-11-03 04:59:39 +01:00
Linus Rath 6da9a6a6f5 feat: add an encrypted local mail store that syncs in a worker 2026-11-03 04:57:20 +01:00
Linus Rath 1dfe09d321 fix: keep private files and secrets out of standalone builds 2026-11-03 04:14:47 +01:00
Linus Rath af32c846a2 fix: let plugins read the signature auto-insert toggles they may change 2026-11-03 02:46:51 +01:00
Linus Rath 34e016f1c0 test: stop the server-state guard counting empty as-const tuples as state 2026-11-03 02:35:42 +01:00
Linus Rath 5c0ffd7aff fix: let plugins switch the signature auto-insert toggles and refuse the proofreading settings 2026-11-03 02:35:01 +01:00
Linus Rath e2bc222f49 fix: load the assistant's calendar and settings calls on first use so plugin views don't load the calendar store 2026-11-03 01:54:32 +01:00
Linus Rath ddbff7aeb7 Merge the assistant's Files (package D)
# Conflicts:
#	components/email/__tests__/composer-plugin-edit.test.tsx
#	lib/__tests__/plugin-projection.test.ts
2026-11-03 01:48:30 +01:00
Linus Rath 553f7ee883 fix: start a plugin's api calls at once again, not a tick later 2026-11-03 01:38:42 +01:00
Linus Rath e9e07ddb64 Merge main into feat/assistant-everywhere 2026-11-03 01:35:57 +01:00
Linus Rath cf512f0a4e fix: check attachments, shared folders and limits in the assistant's Files calls
Fixes from the review of api.files:
- `files.attach` to a new draft runs `onBeforeAttachmentUpload` for each
  file and the server's total size limit before `compose.open`, which
  runs neither; refused files come back in `refused`
- a write is refused when a folder above the target is missing from the
  listing, instead of counting it as not shared
- `onFileMove` reports the item as it was, from where it was, like the
  Files app's own move
- writes are counted against the 20-a-minute limit before the drive is
  listed, so refused writes count and cost no listing
- reads stop the download past 20 MB (`fetchBlobArrayBuffer` with a
  limit) and answer `too_big` when the listed size was wrong
- when the server refuses the new content of a replaced file, the old
  version's copy is taken out of the trash again

The two getText assertions on `fetchBlobArrayBuffer` now expect the
account (undefined for the own drive) and the byte limit, since the
call passes both.
2026-11-03 01:31:05 +01:00
Linus Rath d7cb895ebf Merge branch 'feat/assistant-everywhere' into feat/assistant-d
# Conflicts:
#	lib/__tests__/plugin-permission-coverage.test.ts
2026-11-03 01:19:42 +01:00
Linus Rath 55d9c81210 Merge more actions for the assistant (package C) 2026-11-03 01:13:47 +01:00
Linus Rath 6c3e68ce4e Merge branch 'feat/assistant-everywhere' into feat/assistant-d 2026-11-03 01:01:29 +01:00
Linus Rath 989cfc64a4 fix: offer a plugin the invitation and settings calls only once it was granted their permission 2026-11-03 00:55:50 +01:00
Linus Rath 37aaf05d6d fix: spend a plugin's undo token only once its undo went through, so a failed undo can be tried again 2026-11-03 00:51:30 +01:00
Linus Rath 169100eb12 fix: take the setting names app.getSettings gives, and check hidden, gated and restricted settings on undo too 2026-11-03 00:47:35 +01:00
Linus Rath 8add856aac fix: let plugins only switch off sender favicons and avatars in Junk
Both make the server fetch the sender's domain. The test that every
default value is allowed now also names senderFavicons (on by default,
which a plugin may no longer set); the rest of it is as it was.
2026-11-03 00:46:08 +01:00
Linus Rath d973e9062a fix: give a photo's date only from when it was taken, not when the file changed
exif.test.ts: the case "falls back to the file date" now expects no
date, since IFD0's DateTime is the file's change date, not the date
the photo was taken.
2026-11-03 00:45:56 +01:00
Linus Rath 22a783efe0 fix: check an invitation's sender also when it claims one of the user's own addresses 2026-11-03 00:43:16 +01:00
Linus Rath f7a7828bfa fix: check an image attachment's size before decoding it, and decode on older browsers
The host reads the size a PNG, GIF, JPEG, WebP or BMP declares in its
header first: over 50 megapixels it answers too_big, trackers and tiny
images are never decoded, a format whose header it can't read is
unsupported, and large images are decoded at the target width. A browser
that throws a TypeError on createImageBitmap's options decodes without
them.

The tests' stand-in pictures are now PNG headers instead of JSON (the
code reads the header), so image-shrink.test.ts and
plugin-host-attachment-image.test.ts build them that way, and the first
shrink test expects the resize options on createImageBitmap.
2026-11-03 00:42:53 +01:00
Linus Rath 6ef1397a53 fix: refuse to switch the out-of-office on for a plugin while it forwards mail or that can't be read 2026-11-03 00:42:30 +01:00
Linus Rath f8de35dd85 feat: let plugins count a conversation's messages, and read only the newest 50
api.email.getThread fetches only the newest 50 messages of a thread
(Thread/get, then Email/get for those ids) instead of all of them with
their bodies. api.email.getThreadCount answers the number of messages
from Thread/get, with its own rate limit.

plugin-host-thread.test.ts now expects getThreadEmails to be called with
{ newest: 50 }, the new option that limits what is fetched.
2026-11-03 00:38:07 +01:00
Linus Rath d68970126e feat: tell plugins when the open message's attachments can't be read from this login 2026-11-03 00:33:59 +01:00
Linus Rath 9ce4d01807 fix: keep the reader still while the list changes, and give Pro tabs no list ticks 2026-11-03 00:30:56 +01:00
Linus Rath e716f529cd test: match template sync and server-state guard to current behaviour 2026-11-03 00:29:56 +01:00
Linus Rath 23c410ddea fix: ask the server whether a folder is shared before a plugin's move, filter or archive files mail there 2026-11-03 00:29:02 +01:00
Linus Rath 08bc05a20b Merge branch 'feat/assistant-everywhere' into feat/assistant-b 2026-11-03 00:24:50 +01:00
Linus Rath 267ca40522 Merge branch 'feat/assistant-everywhere' into feat/assistant-c 2026-11-03 00:24:12 +01:00
Linus Rath 12dc2ce3c8 feat: let plugins find, read, attach, save and create files in Files 2026-11-03 00:17:46 +01:00
Linus Rath 6edf7f80a5 fix: let plugins stop an attachment saved to Files, as they can stop an upload 2026-11-03 00:17:45 +01:00
Linus Rath 70ffd7f000 fix: leave the Files trash out of search results 2026-11-03 00:17:44 +01:00
Linus Rath c34c0d4173 fix: hand Stalwart 1.0 symlinks to plugins as files, not folders 2026-11-03 00:17:44 +01:00
Linus Rath 82c3c969be fix: keep calendar.deleteEvent working for callers whose client names no account 2026-11-03 00:00:17 +01:00
Linus Rath 363c797178 feat: let a plugin dialog fill the window's visible height, so a chat fits above a phone's keyboard 2026-11-02 23:59:57 +01:00
Linus Rath 0fb8f44cc4 test: expect the out-of-office's forward flag in vacation.get
vacation.get now also says whether the out-of-office forwards mail
(forwardActive, from the area c host APIs), so the test that pins the
whole answer names it too. The other fields are as they were.
2026-11-02 23:56:35 +01:00
Linus Rath ad36f8d382 fix: show the side panel only where the plugin does, and keep it steady
- The button and the panel of Calendar, Contacts, Files and Settings
  show only when the plugin's shouldShow says yes, so a plugin switched
  off for these views (admin, user or no service) leaves no button that
  opens an empty panel, and no extra rows in Contacts and Settings.
- Files: while the details are open the panel steps aside there only;
  the other views keep it as the user left it. With both stored open the
  details fold when the page loads.
- Resizing stops where the view keeps its 480 px, so a drag or the arrow
  keys no longer fold the panel away (and the handle keeps the focus).
- Settings and Contacts render the same element with or without the
  panel, so a form keeps what was typed when the panel starts docking.
- Contacts on a phone: the panel button sits over an open contact too.
- The panel buttons of the reader and the views have one name, "Plugin
  panel", with aria-pressed, and name the plugin's panel shortcut in
  their title; the open panels are named landmarks.

The reader tests look the button up by its new name and pressed state
(viewer-toolbar-over-side-panel, reader-plugin-surfaces,
viewer-plugin-panel-width), since "Show/Hide plugin panel" is gone.
2026-11-02 23:54:53 +01:00
Linus Rath a256beb918 fix: tell each plugin whether it may show the side panel
api.host.features.sidePanel now says whether this plugin may offer the
app-side-panel (ui:side-panel granted), not only that the webmail has
it. A plugin enabled before an update added the permission can then say
so instead of offering a switch that does nothing. The host computes the
assistant's flags per plugin for a frame's init and for each push.

plugin-host-features.test.ts: the host bridge assertions take the
assistant's flags as the test plugin sees them (it lacks ui:side-panel,
so sidePanel is false there).
2026-11-02 23:54:52 +01:00
Linus Rath d5c558d747 fix: undo the first filter rule again, which left its script active and in place 2026-11-02 23:49:14 +01:00
Linus Rath fb3affb452 test: give the HTML reading time checks room on a busy machine 2026-11-02 23:40:32 +01:00
Linus Rath ecaad2b3d9 Merge branch 'feat/assistant-everywhere' into feat/assistant-f 2026-11-02 23:37:41 +01:00
Linus Rath 2bc9b0ccc6 test: check that attachment text is read only from accounts this login shows 2026-11-02 23:37:35 +01:00
Linus Rath 4356ccadb7 fix: load the attachment readers only when needed and read two files at a time at most 2026-11-02 23:37:34 +01:00
Linus Rath 774aeeb313 fix: read PDF attachments only as far as needed, with a time limit and no scripts 2026-11-02 23:31:47 +01:00