Handle PWA launches for both magnet urls and torrent files #596
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
This pull request enables launching Flood as a progressive web app (PWA) with OS integration via both magnet links and torrent files. I have been using these changes locally for a little while now and it is a big quality of life improvement so I thought I would share for anyone else who might be interested.
Screenshots
I uploaded a YouTube video demoing these changes using Microsoft Edge and Windows 11: https://www.youtube.com/watch?v=FfZ0nPHyZUk
All of the different combinations of launching with manet links as well as launching with one or more torrent files all worked as expected, the only exception is when the app is closed dragging multiple torrents onto the app icon just opens the app but does not open the add files dialog as expected (shown near the end of the video), this appears to be a bug with the PWA implementation in Edge/Windows, it works when the app is already open and you drag multiple torrent files onto the app icon, in this case the dialog opens as expected (also shown near the end of the video)
It should be possible to enable corresponding functionality with various other browser / operating system combinations. I tested Chrome / Windows 11 as well and was able to achieve equivalent functionality to the above video, though getting Windows to set the default app for the torrent file type was a bit finnicky, sometimes took a few tries, works every time with Edge.
Types of changes
client/src/public/manifest.json
where I've addedprocotol_handlers
,file_handlers
, andlaunch_handler
properties.client/src/javascript/components/AppWrapper.tsx
where I'm callingwindow.launchQueue.setConsumer
to detect when the app is launched with a torrent file.client/src/javascript/util/fileProcessor.ts
NOTE: To enable the full functionality including launching torrent files from the OS it does require setting a few flags in
edge://flags
orchrome://flags
depending on your browser. How to set these flags as well as any other setup is shown in the YouTube video.Relevant Links: