elk icon indicating copy to clipboard operation
elk copied to clipboard

feat: add support for the Web Share Target API

Open horvbalint opened this issue 1 year ago • 3 comments

Hi everyone,

I noticed that there is currently no support for the Web Share Target API in Elk, so I implemented basic support for it :) I talked with @userquin on Discord and he opened this issue in the repo: https://github.com/elk-zone/elk/issues/1093

Web Share Target API would allow users (on supported platforms) who have Elk installed as a PWA, to choose some media (image/video) and choose Elk in the OS's share-with dialog. This would open Elk and automatically upload the media and focus the compose section of the home page. If not some media but some text or an URL was shared, then again the compose textarea is focused and the text is inserted inside it.

I hope that my changes are OK as the codebase and TypeScript is pretty new for me. I had to extend the ManifestOptions interface of 'vite-plugin-pwa', because it didn't know about the share_target field of the WebApp Manifest and I am not sure if this is the right thing to do.

Here is an example on how the share screen would look like: Screenshot_2023-01-13-21-55-29-199_com miui gallery

closes #1093

horvbalint avatar Jan 13 '23 21:01 horvbalint