ipfs / ipfs-companion

Browser extension that simplifies access to IPFS resources on the web
https://docs.ipfs.tech/install/ipfs-companion/
Creative Commons Zero v1.0 Universal
2.04k stars 323 forks source link

[MV3 Beta Bug] Redirect infinite loop with Brave when hitting "purple IPFS button" #1283

Closed BigLep closed 9 months ago

BigLep commented 9 months ago

Describe the bug I can get Brave into a redirect loop

To Reproduce Steps to reproduce the behavior:

  1. Use external Kubo node (e.g., IPFS Desktop)
  2. Clear all redirect rules.
  3. Go to https://explore.ipld.io
  4. Browser bar becomes http://explore.ipld.io.ipns.localhost:8080/
  5. Hit purpose "IPFS" button in address bar
  6. Browser redirects to https://explore-ipld-io.ipns.dweb.link/ but white screen image
  7. Refresh redirects to http://explore.ipld.io.ipns.localhost:8080/
  8. After that I can't reproduce it. It seems to be a first-time issue. I have to clear redirect rules to trigger this again.

Versions

whizzzkid commented 9 months ago

@BigLep on step 6 you just see a white screen? Is the browser still redirecting? The purple button is shipped by brave, it has its own quirks. Since the purple button redirects to dweb.link instead of staying on what the current url is, companion is seeing this url for the first time. Once the URL is known and rule is added it should work from there. Maybe I can add a manual rule if it's brave.

lidel commented 9 months ago

@BigLep just for the record, what are your settings on brave://settings/ipfs, mainly resolution method? Gateway?

2023-09-20_18-19

BigLep commented 9 months ago

Here's more info:

brave://settings/ipfs

image

Here's a screen recording:

https://github.com/ipfs/ipfs-companion/assets/85411/8b1808ff-bda3-4a5a-a273-02d86225faa7

whizzzkid commented 9 months ago

@BigLep this is a very weird edge case, looks like since you have the Method to resolve IPFS resources set to Gateway, this interferes with companion behaviour. Because brave does not find the Gateway it believes public resolution is required to dweb.link, which gets observed by companion and back to localhost. it's a timing issue I believe, where dweb.link just takes long enough to not be redirected by companion's rule. Because if you directly try to go to https://dweb.link/ipns/explore.ipld.io/ it just resolves fine. It's if the double redirection, first from brave then from companion, which makes it hard. I'm looking into if I can reliably resolve the urls and then reload.