Mobile app (Android):
- Sign-in to any server, with authenticator codes. The server address and
token are kept in secure storage; a dropped connection never signs out.
- Workspaces, recent pages, spaces and a foldable page tree; search; the
inbox with mark-read.
- Pages open read-only in the shared editor from their saved content and
join the live document to edit (with the native toolbar). Page links in
the text open in the app (new "navigate" bridge message).
- Comments: threads, replies, resolve.
- "Save to Docwell" in the Android share sheet makes a page from shared
text, with web addresses as links.
- Offline reading: every answer the app reads is kept on the phone, and
used when the server can't be reached.
- Push through UnifiedPush (ntfy, NextPush, ...). The app uses the Android
connector directly; the umbrella package pulls in a native crypto build
for Linux that breaks `dart run` and tests.
Server:
- /me/devices registers a phone's UnifiedPush endpoint and Web Push keys
(new push_devices collection). Each notification is also pushed,
encrypted with RFC 8291 aes128gcm so the distributor can't read it; the
app drops messages that don't decrypt. Endpoints answering 404/410 are
forgotten. Endpoints follow the webhook address rules.
- /collab accepts the apps' own origins ("null" for the mobile editor page,
wails:// for the desktop app). Sign-in is a token in the first message,
not a cookie, so this opens no cross-site hijacking.
Tried on an Android 15 emulator: sign-in, browsing, reading, live editing,
sharing and offline reading. Not covered: push end to end (no distributor
on the emulator), iOS, and YouTube embeds, which refuse to play from the
app's local editor page (error 153).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
39 lines
1.5 KiB
JavaScript
39 lines
1.5 KiB
JavaScript
// SPDX-License-Identifier: AGPL-3.0-or-later
|
|
|
|
/// <reference path="../pb_data/types.d.ts" />
|
|
|
|
// push_devices: phones that get push notifications. endpoint is the
|
|
// UnifiedPush address the phone's distributor (ntfy, …) gave the app;
|
|
// docwell-server POSTs each notification there, encrypted to the app's
|
|
// Web Push keys (RFC 8291). A device whose endpoint
|
|
// answers 404 or 410 is deleted.
|
|
|
|
migrate(
|
|
(app) => {
|
|
const users = app.findCollectionByNameOrId("users");
|
|
app.save(
|
|
new Collection({
|
|
type: "base",
|
|
name: "push_devices",
|
|
fields: [
|
|
{ name: "user", type: "relation", collectionId: users.id, maxSelect: 1, required: true, cascadeDelete: true },
|
|
{ name: "endpoint", type: "text", required: true, max: 1000 },
|
|
// The app's Web Push keys (base64url): messages are encrypted to them.
|
|
{ name: "p256dh", type: "text", required: true, max: 200 },
|
|
{ name: "auth", type: "text", required: true, max: 100 },
|
|
{ name: "name", type: "text", max: 100 },
|
|
{ name: "created", type: "autodate", onCreate: true, onUpdate: false },
|
|
{ name: "updated", type: "autodate", onCreate: true, onUpdate: true },
|
|
],
|
|
indexes: [
|
|
"CREATE UNIQUE INDEX idx_push_devices_endpoint ON push_devices (endpoint)",
|
|
"CREATE INDEX idx_push_devices_user ON push_devices (user)",
|
|
],
|
|
}),
|
|
);
|
|
},
|
|
(app) => {
|
|
app.delete(app.findCollectionByNameOrId("push_devices"));
|
|
},
|
|
);
|