-
Notifications
You must be signed in to change notification settings - Fork 143
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Handle PWA launches for both magnet urls and torrent files #596
Open
CoryG89
wants to merge
7
commits into
jesec:master
Choose a base branch
from
CoryG89:pwa-launch-handler
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
sorry for the 2 years late, jesec has been inactive for long time, and I just start to cleanup some old PR. Never try PWA before, I need some time to read doc first. |
trim21
reviewed
Jan 15, 2025
@@ -55,6 +66,17 @@ const AppWrapper: FC<AppWrapperProps> = observer(({children, className}: AppWrap | |||
} | |||
} | |||
|
|||
if ('launchQueue' in window) { | |||
window.launchQueue.setConsumer(async (launchParams) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this can be window.launchQueue?.
I think
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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: