17 Commits
Author SHA1 Message Date
tajniak81andClaude Opus 5.5 9d674e9699 Add invite links with approval, sharing switches, page views and unused-file cleanup
CI / go (Media) (push) Successful in 14m33s
CI / go (Server) (push) Failing after 23m30s
CI / go (Web-App) (push) Canceled after 0s
CI / frontend (push) Failing after 9m30s
CI / desktop (ubuntu-latest) (push) Successful in 1h21m24s
CI / mobile (push) Failing after 4m16s
CI / docker (push) Successful in 1h1m25s
Docs / build (push) Successful in 14m59s
Docs / deploy (push) Skipped
CI / desktop (macos-latest) (push) Canceled after 0s
CI / desktop (windows-latest) (push) Canceled after 0s
Phase G of docs/AFFINE.md (ADR-17):

- Invite links: one per workspace (member or guest, optional end date,
  optional admin approval) on a new /join page. Requests are approved
  (optionally as another role) or declined from workspace settings;
  join_request, join_approved and join_declined notifications reach the
  inbox, phones and the email digest. Workspace admins decide, else the
  organization's admins, else superadmins. Signup honours ?redirect=.
- Workspace switches: allowSharing (off makes every share link answer 404
  until it is back on) and urlPreview (chat apps may show private pages'
  titles). docwell-web writes title and Open Graph tags for known
  link-preview bots, asking docwell-server via DOCWELL_PREVIEW_API_URL;
  search engines are left out.
- Page analytics: page_views counts opens per page, person and day from
  the existing visit call and share-link reads; editors see totals, a
  daily chart and recent viewers in the Info panel. analytics.prune
  drops rows after 400 days.
- Unused files: attachments whose id appears in no page's Yjs state,
  page icon or comment (older than a day) are listed and deleted from
  workspace settings.
- Migration, schema snapshot, OpenAPI, generated clients, translations
  in five languages, phone inbox, compose files and user docs.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-16 15:59:55 +01:00
tajniak81andClaude Opus 5.5 0640004895 Add database relations and rollups, full-page records, and translate the admin panel and phone app
CI / go (Server) (push) Failing after 4m38s
CI / go (Web-App) (push) Successful in 12m18s
Docs / build (push) Canceled after 0s
Docs / deploy (push) Canceled after 0s
CI / frontend (push) Failing after 7m49s
CI / desktop (ubuntu-latest) (push) Successful in 1h25m30s
CI / mobile (push) Failing after 5m14s
CI / docker (push) Successful in 39m26s
CI / desktop (macos-latest) (push) Canceled after 0s
CI / desktop (windows-latest) (push) Canceled after 0s
Databases (ADR-13 follow-ups):
- Relation properties link records to another database, on the same page
  or on any page the reader can open (read live and read-only, like synced
  pages). Cells list the linked titles; clicking one opens the record.
- Rollup properties work out counts, sums, averages, medians, min/max,
  ranges, earliest/latest dates and checked counts over related records.
  Neither is stored: views compute them before drawing (linked.ts), so they
  follow both databases live, and rollups sort and filter as numbers.
- Exports (Markdown, HTML, PDF, Word) resolve them for same-page databases.
- A record opens as a full page at /p/<page>/r/<database>/<record>, with
  "Open as full page" on the side panel and "Back to the page".

Edgeless mode (ADR-14 follow-ups):
- History previews show a version's canvas and count canvas changes.
- Comments can be anchored to canvas elements (anchor {element}); elements
  with open threads show a badge that opens the thread.
- Workspaces choose how new pages open (workspaces.default_page_mode); the
  per-device choice now defaults to following the workspace.
- Phones edit the canvas once a page is opened for editing; the page note
  shows the page title.

Languages:
- The admin panel speaks English, Polish, German, French and Spanish, with
  a picker sharing the web app's setting and a key parity test.
- The phone app speaks the same five, follows the phone's language (and
  Android's per-app language setting), and has its own parity test.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-15 17:11:47 +01:00
tajniak81andClaude Opus 5.5 ec11abd8b8 Add page properties, tags, All docs, collections and journals
Phase B (items 1-6) of docs/AFFINE.md.

Properties: workspaces define custom page properties (text, number,
checkbox, date, select, multi-select, person, link) in the new
workspace_properties collection; pages keep their values in
pages.properties, checked against each property's type. The Info panel
under the title shows tags, custom and built-in properties, following
each property's visibility; the Info side panel shows them all, with the
page's collections and the journal. Settings gains Page properties and
Tags sections.

Tags: coloured, per workspace (tags collection, pages.tags); create from
the picker, rename, recolour, merge and delete. Search filters by tag.

All docs: GET /workspaces/{id}/docs lists the pages the caller can open
with their properties, narrowed by space, tag, collection or filter
rules evaluated on the server. The view shows a list, grid or cards,
groups and orders by any property, picks the properties shown, and acts
on several pages at once (tag, move, trash, collect).

Collections (page_collections): saved rules plus pages added or taken
out by hand, private to their creator until shared with the workspace,
listed in the sidebar.

Journals: one page per person and day in a private journal space
(spaces.journal_owner) that workspace admins do not see into, made on
first use. A week strip marks days with pages, new days can start from
a template, and dates in read mode open that day's journal.

The migration and schema snapshot, OpenAPI spec and generated Go, TS and
Dart types are updated (the Dart generator learns untyped values), the
mobile editor bundle is rebuilt, the new strings are translated into all
five languages, and the user guide covers the new features.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-14 16:35:42 +01:00
tajniak81andClaude Opus 5.5 631b929433 Add OAuth and OIDC sign-in, two-step codes, audit log, API tokens and webhooks
Sign-in:
- Google, GitHub, Microsoft and any OpenID Connect provider, set up in the
  admin panel (secrets are write-only). PocketBase talks to the provider,
  and docwell-server keeps the state and PKCE verifier. Accounts a
  provider creates follow the sign-up switch and the domain list; refused
  ones are removed again.
- Two-step sign-in with an authenticator app (TOTP), set up under "Your
  account", with ten single-use recovery codes. After any first factor
  (password, email code, provider) the session is held behind a
  five-minute challenge: five tries, each code works once. Turning it off
  needs a code. Managers can reset it for someone who lost their phone.
  Both the web app and the admin panel ask for the code.

Integrations:
- Personal API tokens ("dw_…") that act as their owner, read-only or
  read-write, with optional expiry. Only a hash is stored, and the token is
  shown once. Tokens cannot manage tokens or two-step sign-in. Admins see
  and can revoke their organization's tokens.
- Workspace webhooks for page, comment and space events. Deliveries are
  HMAC-SHA256 signed and retried (10 s, 1 min, 5 min), with a 30-day log
  and a test button. Loopback and link-local addresses are refused
  (DOCWELL_WEBHOOKS_ALLOW_LOCAL is for development).

Audit log: sign-ins (including failures and second steps, filed under the
account's organization) and every successful change request, by route and
path ids, never bodies. Superadmins see everything and org admins their
organization. It is searchable and exportable as CSV in the admin panel's
new Security page, and kept for DOCWELL_AUDIT_RETENTION_DAYS (365).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-01 09:31:45 +01:00
tajniak81andClaude Opus 5.5 63bf9ae273 Add templates, backlinks, table of contents, math and diagrams
Editor blocks:
- Math with KaTeX, inline ($...$) and as blocks ($$...$$). Clicking a
  formula opens its LaTeX source.
- Mermaid diagrams. The text is stored and each client draws it, with a
  live preview while editing. Mermaid uses strict security.
- Draw.io and Excalidraw drawings, stored as SVG attachments that carry
  the editable scene. Draw.io opens diagrams.net in a frame (address set
  by DOCWELL_DRAWIO_URL). Excalidraw loads React only when opened.
- A table of contents block that follows the page's headings.
- "[[" page links, and following a page link inside the app (Ctrl/Cmd
  click while editing).

Mermaid and Excalidraw are handed in by the host, so the single-file
mobile bridge leaves them out. There diagrams show as their text and
drawings as pictures.

Pages now record which pages they link to, kept current on every save
and backfilled at startup. A page lists the pages linking to it that
the reader can open. Any editor can mark a page as a template, and an
empty page offers the workspace's templates. Applying one copies its
content as a history version, and an untitled page also takes the
template's title.

Markdown and HTML export keep Mermaid, math, drawings and mentions, and
Markdown import turns mermaid fences back into diagrams. Attachments
named .svg are typed image/svg+xml and served inline under the existing
sandbox CSP, so drawings display.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-31 22:55:03 +01:00
tajniak81andClaude Opus 5.5 7968e82cc2 Add page-level permissions and guests
Pages can now be shared with people and groups beyond their space, and
restricted so that only those grants count. A grant covers the page and
everything under it. Space admins always keep access, and an editor who
restricts a page keeps editor through a grant of their own.

Sharing a page with someone from the organization who is outside the
workspace adds them as a guest. Anyone else gets a guest invite that
carries the page grant, which is made when they accept. Guests see a
"limited" space holding only the pages shared with them.

The page tree, breadcrumbs, search, favorites, recents, trash and import
all follow the page role. Public links skip restricted subtrees. Grants
are cleaned up when a member leaves or a group is deleted.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-31 21:39:50 +01:00
tajniak81andClaude Opus 5.5 92cd81fd96 Add the slash menu, bubble menu, mentions and inline comments
Editor:
- "/" opens a filterable block menu (text, headings, lists, quote, code,
  divider, and image or file upload when the host can store files).
- Selecting text shows a formatting toolbar (bold, italic, strike, code,
  link) and, for anyone who may comment, a Comment button.
- "@" finds people in the page's workspace; the mention node is always in
  the schema so documents with mentions open in every client.
- The popups are plain DOM in the design system's slash-menu style, so
  the framework-free mobile bridge keeps building and can use them.
- Menu words come from the host; the web app passes English or Polish.

Inline comments (basic): commenters cannot edit the document, so a
comment's anchor is a pair of Yjs relative positions stored with the
comment rather than a mark in the text. Highlights follow local edits by
mapping and are re-resolved when comments change or remote edits arrive.
Pages get a comments panel (side column, or a bottom sheet on narrow
screens). Authors and space admins can delete comments.

Server: comments collection and endpoints, and a people lookup any
workspace member may use for mentions.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-31 17:25:19 +01:00
tajniak81andClaude Opus 5.5 dac6d6da63 Add public share links and the share dialog
Editors can give a page a public link that anyone can read without an
account, optionally with the pages under it. The link is the stored
token, so editors can copy it again later; turning sharing off deletes
it and the URL stops working. Reads through a link never reach trashed
pages, pages outside the shared subtree, or their attachments, and are
marked noindex.

The page header gets a Share button: the dialog explains who can open
the page through its space, lists the space's people and groups, copies
the page link and manages the public link. Shared pages open at
/share/<token> in a read-only view with a tree of the shared subpages.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-31 17:09:07 +01:00
tajniak81andClaude Opus 5.5 011833fcef Add Markdown and HTML import and export
docwell-server converts between page documents and Markdown or HTML (a
new convert package), so every client and the API get the same results.
Pages export as a download from the page menu; spaces import one page
per .md, .txt or .html file, taking a leading level-1 heading as the
title. Import keeps only what the editor schema knows, which drops
scripts, styles, event handlers and javascript: links; tables become
one paragraph per row until the editor has tables.

The UI package gains DwMenu, a small accessible action menu.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-31 17:04:39 +01:00
tajniak81andClaude Opus 5.5 25e7ca19a5 Add full-text search with Bleve and the Ctrl+K palette
docwell-server keeps a Bleve index of page titles and text in
DOCWELL_DATA_DIR. Instead of hooking every write, an indexer polls
PocketBase for pages whose "updated" moved (titles, saved content, trash
and restore all touch it) and sweeps out purged pages every ten minutes.
The index can be thrown away at any time: it rebuilds from the database,
and superadmins can trigger a rebuild.

Searches are limited to the spaces the caller can open, match the last
word as a prefix and forgive one wrong letter. Snippets come back as
plain text with match offsets, so clients never render server HTML.

In the web app, Ctrl+K or the sidebar's search box opens a palette that
shows recent pages until something is typed.

The server containers get a /data volume for the index.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-31 16:57:55 +01:00
tajniak81andClaude Opus 5.5 e49b1ab34f Add page attachments with images and file blocks
Editors upload files to a page (attach button, paste or drop); images go
into the document as images and other files as download cards. Files are
stored in a new attachments collection, so PocketBase's local or S3
storage applies, and docwell-server streams them after checking the
reader's page access.

Documents keep the file's API path. Because <img> tags cannot send the
Authorization header, clients load files with a short-lived signed file
token (?token=) instead of the session token. Uploads are limited by
DOCWELL_MAX_UPLOAD_MB (default 50), their type is sniffed from the
content, and only images, PDFs and media are served inline, so an
uploaded HTML or SVG file never runs on the API's origin.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-31 16:51:56 +01:00
tajniak81andClaude Opus 5.5 b0e36fcfaf Add favorites and recently visited pages
Pages can be starred from their header; favorites show in the sidebar
above the spaces, and Home lists the pages visited last. Both are per
user and per workspace, and are filtered by the caller's current rights,
so pages that moved out of reach or into the trash drop out. Visits are
trimmed to the newest 50 per workspace.

The icon set gains the glyphs the rest of Phase 1 needs, and DwIcon can
draw a filled variant for on/off states.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-31 16:44:02 +01:00
tajniak81andClaude Opus 5.5 34660c6b46 Add workspace groups with space grants
Workspace admins create groups of members, and space admins grant a role
to a whole group. A member's space role is now the highest of their own
grant and their groups' grants. Leaving a workspace drops its group
memberships, and deleting a group removes its space grants (they are not
a real relation, so PocketBase cannot cascade them).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-31 16:39:21 +01:00
tajniak81andClaude Opus 5.5 342d073460 Add invites and magic-link sign-in
Managers invite people into their organization and workspace admins into
their workspace; the email links to a new /invite page that creates the
account (or attaches an existing one without an organization) and adds the
workspace membership. Invites bypass the signup rules, store only a token
hash, expire after seven days, and return the link so it can be passed on
when mail is not configured. Inviting someone already in the organization
adds them to the workspace directly.

Magic links reuse PocketBase's email OTP: the email now carries a link to
/magic-link next to the code, and the admin settings gain a switch for it.
Managers can also send a user a password-reset email.

The dev proxies read DOCWELL_DEV_API so a dev server can target another
docwell-server.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-31 16:32:55 +01:00
tajniak81andClaude Opus 5.5 ba394b8fac Finish Phase 0: lint, codegen, contributor docs and the two remaining spikes
Repository basics:
- CONTRIBUTING.md and CODE_OF_CONDUCT.md (Contributor Covenant 2.1)
- SPDX AGPL-3.0-or-later headers on all hand-written sources, checked in CI
- golangci-lint (shared .golangci.yml), ESLint and Prettier, all run in CI

API codegen from api/openapi.yaml (npm run generate, drift fails CI):
- Go types via oapi-codegen in Server/internal/api
- a contract test that the router and the spec list the same routes
- Dart models via Phone-App/tool/generate_api.dart; the app uses them

Spike: shared Tiptap editor in a Flutter WebView (ADR-4)
- @docwell/editor-bridge builds the editor into one HTML page with a
  versioned JSON protocol; Phone-App hosts it with webview_flutter and a
  native toolbar. Integration test passes on an Android API 35 emulator.
- flutter_inappwebview dropped: its Android plugin fails on AGP 9.

Spike: Wails v3 desktop (ADR-11)
- system tray, docwell:// deep links (page and space only) with
  single-instance hand-off, and the built-in updater with a required
  ed25519 signing key. Verified on Windows.
- regenerated build assets register the scheme and drop template
  placeholders.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-31 16:11:07 +01:00
tajniak81andClaude Opus 5.5 a96c6ad3ce Add spaces, the page tree and the Docwell design system
Spaces and pages:
- Spaces inside workspaces, open or private, with admin/editor/commenter/viewer
  roles that cascade from the workspace role (rules in internal/access)
- Page tree per space with fractional position keys, move with cycle checks,
  trash that hides whole subtrees, restore and permanent delete
- OpenAPI, TypeScript client, and web app sidebar tree with drag-and-drop,
  page, space, trash and space settings views (EN + PL)

Design system:
- Tokens, type scale, radii and shadows from the design kit in
  @docwell/ui/theme.css; Inter, Source Serif 4 and JetBrains Mono bundled
- Vue ports of Button, TextField, Badge, Callout, Icon, Breadcrumbs,
  SlashMenu and PageTreeItem, plus Logo; favicons and web manifest
- Web app and admin panel restyled on the new tokens, in light and dark

Also: fix the Vite dev server crashing on /config.json, and stop tracking
the local Design/ and docs/ folders.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-31 11:14:31 +01:00
tajniak81andClaude Opus 5.5 03f3434c10 Add organizations with cascading user rights
Same model as DriverVault, with organizations above workspaces:

- users get a role (user, admin, superadmin) and at most one
  organization; existing instance admins become superadmins
- rights cascade: superadmins own everything, org admins own their
  organization's workspaces, others get their workspace role
  (owner > admin > member > guest) while they stay in the org
- nobody grants a role above their own, acts on someone ranked above
  them, or changes their own role; rules live in internal/access as
  pure, tested functions
- self-service organizations: an org-less user creates one and becomes
  its admin; the last admin can delete it and is demoted
- endpoints for users, orgs, workspaces and members; token cache is
  dropped when a user's rights change
- admin panel: Users and Organizations pages scoped to the caller
- web app: organization page, workspace list, workspace settings with
  member management (EN/PL)
- fix: organization name missing after login/refresh, and stale tokens
  redirecting public pages to sign-in

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-30 22:53:11 +01:00