Skip to content

Fix referrer handling when opening links#7417

Merged
FreeTubeBot merged 1 commit into
FreeTubeApp:developmentfrom
absidue:fix-url-referrer
May 15, 2025
Merged

Fix referrer handling when opening links#7417
FreeTubeBot merged 1 commit into
FreeTubeApp:developmentfrom
absidue:fix-url-referrer

Conversation

@absidue

@absidue absidue commented May 14, 2025

Copy link
Copy Markdown
Member

Pull Request Type

  • Bugfix

Related issue

Description

When switching to using window.open() for handling link opening, I didn't realise that Electron handles the referrers differently for http://localhost/index.html URLs and custom URL schemes like our app://bundle/index.html URLs. 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

  • OS: Windows
  • OS Version: 10
  • FreeTube version: e62b195

@github-actions github-actions Bot added the PR: waiting for review For PRs that are complete, tested, and ready for review label May 14, 2025
@FreeTubeBot FreeTubeBot enabled auto-merge (squash) May 14, 2025 21:30
@FreeTubeBot FreeTubeBot merged commit a26fe66 into FreeTubeApp:development May 15, 2025
5 checks passed
@github-actions github-actions Bot removed the PR: waiting for review For PRs that are complete, tested, and ready for review label 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)
@absidue absidue deleted the fix-url-referrer branch May 15, 2025 05:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Clicking on Open New Window icon doesnt open new window

5 participants