Fix referrer handling when opening links#7417
Merged
Merged
Conversation
efb4f5ff-1298-471a-8973-3d47447115dc
approved these changes
May 14, 2025
PikachuEXE
approved these changes
May 15, 2025
kommunarr
approved these changes
May 15, 2025
PikachuEXE
added a commit
to PikachuEXE/FreeTube
that referenced
this pull request
May 15, 2025
* development: Fix referrer handling when opening links (FreeTubeApp#7417)
PikachuEXE
added a commit
to PikachuEXE/FreeTube
that referenced
this pull request
May 15, 2025
* custom-builds/current: Fix referrer handling when opening links (FreeTubeApp#7417)
This file contains hidden or 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
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.
Pull Request Type
Related issue
Description
When switching to using
window.open()for handling link opening, I didn't realise that Electron handles the referrers differently forhttp://localhost/index.htmlURLs and custom URL schemes like ourapp://bundle/index.htmlURLs. So while I dev mode the referrer URL was available, in our production builds Electron always returns{ url: '', policy: 'strict-origin-when-cross-origin' }even when the request is to open the same URL as the one that the request is coming from.To workaround that this pull request switches to checking the current URL of the webcontents as that is always available. As we no longer need the referrer I also simplified the code on the other end, so we no longer have separate code paths for Electron and outside of Electron.
Testing
Please test the Create New Window button in the navigation bar, as well as clicking on external links (e.g. Patreon link in a video description), in both development mode and a production build, I have created a build for this branch here: https://github.com/absidue/FreeTube/actions/runs/15031380448
Desktop