Files
Marcos Paulo 92ca84d293
ci / ci (macos-latest) (push) Has been cancelled
ci / ci (ubuntu-latest) (push) Has been cancelled
ci / ci (windows-latest) (push) Has been cancelled
feat: engine commands for publications and read-only share links
publish.list|enable|disable and share.link.create|list|revoke over the bound server, token only in the minted URL, read-only and unbound sessions refused. Built by MiniMax M3.1 Flash (OpenCode Zen free route); verified from a clean checkout of the staged files: notescraft-engine tests 729 pass, clippy -D warnings clean. Integration tests use a stub server speaking the server's JSON.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-20 18:28:17 -03:00

4.6 KiB

Capture and publish: share targets, quick capture, web clipper, publish

Source: research (mobile-platform.md findings on Obsidian mobile quick capture and share targets; security-and-server.md adjacent features ranking: web clipper, email-to-note, voice transcription, publish, OCR, read-only links). All except the share target and quick capture need a server-readable (non-E2EE) vault.

Problem

Notes start outside the app: a link in a browser, text in another app, a voice thought, a photo of a page. Today the user must open NotesCraft, create a note and paste. On a phone that is the main reason notes never get written. Publishing a note as a web page needs a third-party service.

Goal

One action from anywhere puts content into the vault (inbox note, daily note or chosen folder), and a note or folder can be published read-only on the owner's own domain.

Non-Goals

Hosting for other people's domains, comments, analytics, a rich-text CMS, offline OCR on the device in v1.

Design (ranked by value over effort)

  1. Quick capture (P0, phone and desktop): a command note.capture {text, title?, target?} and a global shortcut / phone sheet that appends to the daily note or creates Inbox/<timestamp>.md; works with no vault window open on desktop through the control channel.
  2. Share target (P0 phone): Android intent filter for text/plain and image/*, iOS share extension (native Swift, writes into the app group container, picked up on next launch); both call note.capture; images land in the attachment folder with an embed.
  3. Web clipper (P1): a bookmarklet-free approach: POST /v1/vaults/{v}/capture {url?, title, markdown, source} on the sync server (device token) so a browser extension, a shortcut or curl can drop a clipped page; the server stores it as Clips/<title>.md with frontmatter (source, clipped), and file sync delivers it. The extension itself is out of scope (a documented API).
  4. Email to note (P1): an inbound webhook on the homelab (n8n exists) calls the same capture endpoint.
  5. Voice memo (P1): record on the phone, save .m4a into attachments with an embed note; transcription runs on the homelab (whisper-class model, server-readable vaults only) and appends the transcript; shows "transcribing..." state.
  6. Publish (P1): publish.enable {folder|note} marks content public; the server renders Markdown to static HTML (reusing crates/markdown, no new parser) under https://<host>/p/<vault slug>/<path> behind Traefik, with theme, backlinks off by default; unpublish deletes. Read-only share links with an expiry token are the same renderer behind a secret path.
  7. OCR (P2): a server job turns an image attachment into text appended under the embed.

Acceptance Criteria

  • Given text shared from another phone app, then within 5 seconds a note exists in Inbox/ with the text and a creation date, even if the app was closed (picked up on next start for iOS).
  • Given curl -H "Authorization: Bearer <token>" -d '{"title":"T","markdown":"# x","url":"https://e.x"}' .../capture, then Clips/T.md appears on every paired device with source: https://e.x.
  • Given a published folder, then an anonymous GET of a note page returns HTML with no script, the vault's other notes are not reachable, and unpublishing returns 404 within a minute.
  • Given an expired share link, then 404.

Open Questions

  1. Which transcription model on the homelab (the cluster has GPU workloads; needs a capacity check per HOMELAB_OPERATIONS.md)?
  2. Subdomain per user for publish, or one host with slugs? Recommended: one host, slugs.

Tasks

  1. Engine: note.capture command, inbox rules, tests. Done 2026-10-20 by the orchestrator (MiniMax and GLM were both out of quota): crates/engine/src/capture/, 5 rule tests and 9 command tests (daily append, heading block, inbox numbering, folder target, attachment, size limits, read-only, open buffer with undo, hostile params).
  2. Server: /capture endpoint with size caps and audit; docs for a clipper.
  3. Phone: share target spike (Android intent first).
  4. Server: static renderer and /p/... and /s/... routes, share links, rate limits (done 2026-10-20 by MiniMax M3.1 Flash via the harness: src/publish/, raw HTML escaped, strict CSP, publish: false honoured; verified). Engine commands publish.list|enable|disable and share.link.create|list|revoke done 2026-10-20 by MiniMax M3.1 Flash (OpenCode Zen free route; tests use a stub server because the engine does not depend on the server crate). Publish UI is open.
  5. Voice memo and transcription job (after a capacity decision).