PWA: register as an Android share target (Share → Lotus Chat) #155

Closed
opened 2026-09-17 22:49:24 -04:00 by jared · 1 comment
Owner

Web Share Target API: add share_target to public/manifest.json (POST, multipart/form-data, files accepting image/video/*, plus text/url). The service worker intercepts the POST to /share-target, stashes the files in Cache/IndexedDB, and redirects to #/share where the app shows the room picker (reuse Forward-to-rooms UI) with the files pre-attached to the composer's upload board. Requires the PWA to be installed; verify iOS ignores it gracefully (it does — no share target support). Docker nginx: the /share-target path must fall through to the SPA.

Web Share Target API: add `share_target` to `public/manifest.json` (`POST`, `multipart/form-data`, `files` accepting image/video/*, plus `text`/`url`). The service worker intercepts the POST to `/share-target`, stashes the files in Cache/IndexedDB, and redirects to `#/share` where the app shows the room picker (reuse Forward-to-rooms UI) with the files pre-attached to the composer's upload board. Requires the PWA to be installed; verify iOS ignores it gracefully (it does — no share target support). Docker nginx: the `/share-target` path must fall through to the SPA.
jared added this to the Features 2026-Q4 milestone 2026-09-17 22:49:24 -04:00
jared added the enhancementpriority: mediumarea: mediaarea: mobile labels 2026-09-17 22:49:24 -04:00
jared self-assigned this 2026-09-17 22:49:24 -04:00
Author
Owner

Done in 96a97a2f (cinny) + a16cc85 (matrix: nginx 303 for /share-target).

  • manifest.json share_target: POST multipart to ./share-target with title/text/url + files (image/video/audio/pdf/text).
  • Service worker intercepts the POST, stashes the form in a Cache API bucket, 303s to /share.
  • /share page: lists the shared files + text, room search, pick a room → files go onto that room's upload board (encrypted first for E2EE rooms, via the composer's own filesToUploadItems) and the title/text/url into the draft, then the room opens; you still press Send. The stash is cleared once placed.
  • nginx/caddy contrib + the prod image: /share-target → 303 /share so a POST that reaches the origin before the worker controls the page doesn't 405. iOS ignores share_target (no support) — nothing else changes there.

Verified headless against the built preview with the SW controlling the page: POST two PNGs + title + text → /share shows both files and the text → pick the DM → both files on the upload board, text in the composer → /share afterwards says nothing is pending. Needs a real Android install to see the entry in the system share sheet — that part can't be emulated.

share page
landed in the room

Done in 96a97a2f (cinny) + a16cc85 (matrix: nginx 303 for `/share-target`). - `manifest.json` `share_target`: POST multipart to `./share-target` with title/text/url + `files` (image/video/audio/pdf/text). - Service worker intercepts the POST, stashes the form in a Cache API bucket, 303s to `/share`. - `/share` page: lists the shared files + text, room search, pick a room → files go onto that room's upload board (encrypted first for E2EE rooms, via the composer's own `filesToUploadItems`) and the title/text/url into the draft, then the room opens; you still press Send. The stash is cleared once placed. - nginx/caddy contrib + the prod image: `/share-target` → 303 `/share` so a POST that reaches the origin before the worker controls the page doesn't 405. iOS ignores `share_target` (no support) — nothing else changes there. Verified headless against the built preview with the SW controlling the page: POST two PNGs + title + text → `/share` shows both files and the text → pick the DM → both files on the upload board, text in the composer → `/share` afterwards says nothing is pending. Needs a real Android install to see the entry in the system share sheet — that part can't be emulated. ![share page](https://code.lotusguild.org/attachments/91da11b7-a14a-4ea1-bd26-029c9ba735cf) ![landed in the room](https://code.lotusguild.org/attachments/7d72856c-8cbf-4ff6-8e62-fe5a6ef7dbe3)
jared closed this issue 2026-09-20 14:14:59 -04:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: LotusGuild/cinny#155