mirror of
https://github.com/discourse/discourse.git
synced 2026-08-06 13:08:40 +08:00
Previously, Discourse only registered as a Level 1 Web Share Target — a `GET` text-only handler that could not receive images or other files from the OS share sheet. This change registers a modern `POST`/`multipart/form-data` share target. The service worker intercepts the incoming share, stashes the shared title, text, url, and files in the Cache API, and redirects to a `share-target` route that opens a modal asking whether to start a new topic, a new message, or save the content to add to the next reply. Topics and messages open the composer pre-filled with the shared text and uploaded files; the reply option buffers the content and injects it into the next reply composer that opens. ### Notes - The file `accept` list covers images, video, audio, PDFs, and common document types; the server still enforces `authorized_extensions`. - Adds a `composer:uploader-ready` app event so shared files are only handed to the uploader once it is bound, avoiding a race on cold composer open. - Only Android Chromium-based browsers currently implement file-capable share targets; iOS has no Web Share Target support. --------- Co-authored-by: Penar Musaraj <pmusaraj@gmail.com> |
||
|---|---|---|
| .. | ||
| login.html.erb | ||
| service-worker.js.erb | ||
| show.html.erb | ||