IMAP and Gmail sync into a per-account SQLite store, with the mail read and composed in the browser. moved whole from src/servers/sidecar/email (14 files), src/servers/api/email, officer_db/src/email, and the Screens/Dashboard/Email tree. what changed on the way out: - credentials are encrypted. the column was plaintext jsonb holding an IMAP app password that the SMTP transport read straight out of the row; it is now AES-256-GCM under this plugin's own 'email' secret-store purpose, sealed and opened in queries.ts alone so nothing above it can hold ciphertext by accident. no plaintext fallback on read - a value that does not verify is an error. - the router derives its prefix from mountPrefix() instead of the literal '/api/email', which was only correct for a first-party publisher. - the frontend became panels.ts + layout.ts. the two panel appTypes that were null are now declared, because the platform screen used to override them by panel id and a plugin has no such hook. - account management became a modal. it was a section in the platform's Settings, which a plugin cannot contribute to, and a panel does not work either: PluginScreen renders the workspace locked, so a panel outside the default layout is unreachable. it follows Compose, which had already solved this. - 17 palette classes replaced with semantic tokens. not verified: this has never run. it was switched off in the platform on 2026-08-13 and its table was never created, so nothing has exercised sync, sending or the UI since. the first install is the first test.
31 lines
1.3 KiB
TypeScript
31 lines
1.3 KiB
TypeScript
import { useGlobal } from 'hooks/useGlobal';
|
|
import { Dialog, DialogContent, DialogHeader, DialogTitle } from '@/components/ui/dialog';
|
|
import { EmailAccounts } from './EmailAccounts';
|
|
|
|
/*
|
|
Account management, as a modal rather than a settings page or a panel.
|
|
|
|
It was a section in the platform's Settings → Integrations, which a plugin cannot contribute to: a plugin
|
|
contributes panels and nothing else. A panel was the obvious replacement and does not work either —
|
|
`PluginScreen` renders the workspace `locked`, so a panel outside the default layout is unreachable and
|
|
one inside it would spend a quarter of the screen on a form you touch twice a year.
|
|
|
|
So it follows Compose, which had already solved the same problem here: a global holds "is it open", any
|
|
panel can set it, and the panel that mounts the modal renders it once.
|
|
*/
|
|
export const useAccountsModal = () => useGlobal<boolean>('EMAIL_ACCOUNTS_OPEN', false);
|
|
|
|
export const AccountsModal = () => {
|
|
const [open, setOpen] = useAccountsModal();
|
|
return (
|
|
<Dialog open={open} onOpenChange={setOpen}>
|
|
<DialogContent className="max-h-[85vh] max-w-3xl overflow-y-auto">
|
|
<DialogHeader>
|
|
<DialogTitle>Email accounts</DialogTitle>
|
|
</DialogHeader>
|
|
<EmailAccounts />
|
|
</DialogContent>
|
|
</Dialog>
|
|
);
|
|
};
|