libredirect / browser_extension

A browser extension that redirects popular sites to alternative privacy friendly frontends
https://libredirect.github.io
GNU General Public License v3.0
3.29k stars 122 forks source link

Redirection exceptions on reddit subdomains are suddenly ignored #978

Open pitsi opened 3 months ago

pitsi commented 3 months ago

I use libredirect to redirect any reddit page from the bloated with js www.reddit.com domain to old.reddit.com because it is snappier. I do not use it to redirect to any teddit/libreddit/redlib/eddrit instance because almost all of them are slow and others die from time to time. The "syntax" follows the one for the teddit frontend, which is the default, so this www.reddit.com/r/debian becomes this old.reddit.com/r/debian.

For that reason, I have the exceptions you see below for the redd.it domain, which is used for the images of reddit (the following is part of the exported json file).

  "exceptions": {
    "regex": [],
    "url": [
      "https://music.youtube.com",
      "https://i.redd.it",
      "https://preview.redd.it"
    ]
  }

And it worked fine for many years. But since yesterday, it redirects me to this login stupidity https://old.reddit.com/login/?dest=https%3A%2F%2Fold.reddit.com%2Fsubmit%3Furl%3Dhttps%253A%252F%252F5jur8ayugckd1.jpeg%253Fteddit_proxy%253Di.redd.it or to this missing image. https://old.reddit.com/l17e9jtgw6kd1.png?teddit_proxy=i.redd.it

What am I doing wrong? Do I need to change to something else because teddit or the addon has changed something? Debian testing/unstable x64, brave 1.69.x and libreddit 2.9.1, taken from the chrome web store.

ManeraKai commented 3 months ago

How are you able to redirect to old.reddit.com using teddit?

pitsi commented 3 months ago

Under settings > services, select reddit as the service, teddit as its frontend and delete every default url under the instances. Then add old.reddit.com.

Teddit was not selected at random. This image url for instance https://i.redd.it/jine923tpfkd1.jpeg (which launches on reddit's "image viewer" for more than a year now), transforms to these if I set the redirection url to old.reddit.com and select as a frontend

libreddit and redlib > https://old.reddit.com/img/jine923tpfkd1.jpeg (error) teddit > https://old.reddit.com/login/?dest=https%3A%2F%2Fold.reddit.com%2Fsubmit%3Furl%3Dhttps%253A%252F%252Fjine923tpfkd1.jpeg%253Fteddit_proxy%253Di.redd.it (reddit bs as I said above) eddrit > https://old.reddit.com/ (faulty or non existant redirection)

So yea, teddit was selected as the redirection frontend by trial and error. But this is not the real issue here.

ManeraKai commented 3 months ago

It will give you errors, and more errors in the future. The redirection is not wrong. It's just designed for teddit. We even redirect from old.reddit.com and thus it will create an infinite loop till the browser cuts it. We removed old.reddit.com from LibRedirect because there's already Old Reddit Redirect

pitsi commented 2 months ago

We even redirect from old.reddit.com and thus it will create an infinite loop till the browser cuts it.

About that. Firefox has that issue here, although it uses the same configuration as brave (exported from brave > imported to firefox). It can not open reddit links while the addon is active. I had mentioned that on the first issue I opened here (#310), but I got no reply back then. But setting teddit as a frontend for reddit and old.reddit.com as a teddit instance makes it redirect all reddit links to old reddit and it works great on brave. That is why I have not installed the extra addon you suggested. It is not needed.

However, all that is offtopic now. The real issue is that libredirect 2.9.1 no longer respects my exceptions for reddit, and I do not know why. It does respect the one for music.youtube.com. I do redirect youtube to yewtu.be, but I do not want to redirect any music youtube link to beatbump because it (as a frontend) is broken and plays nothing.

ManeraKai commented 2 months ago

I think this should be better explained. When you add a URL exception, it would see if it's the exact same. Ex: https://i.redd.it == https://i.redd.it https://i.redd.it != https://i.redd.it/jine923tpfkd1.jpeg

However, if you added a Regex exception, you can do whatever you want, Ex: https:\/{2}i\.redd\.it\/.* == https://i.redd.it == https://i.redd.it/jine923tpfkd1.jpeg

regex101.com will help you.

ManeraKai commented 2 months ago

About that. Firefox has that issue here, although it uses the same configuration as brave (exported from brave > imported to firefox). It can not open reddit links while the addon is active. I had mentioned that on the first issue I opened here (https://github.com/libredirect/browser_extension/issues/310), but I got no reply back then.

It could be that chromium browsers cut this infinite loop, but use the last url and load the page, unlike firefox.

pitsi commented 2 months ago

Correct me if I am wrong, but isn't the url option there so that someone does not have to mess with regex? I set https://i.redd.it/ there and that applies to ANY https://i.reddi.it/* url I go to? Because that is how it was working since 2022 for me.

For that reason, I removed 2.9.1, manually installed 2.9.0 , configured it to exclude i.redd.it and it just works like it used to. This means that something in 2.9.1 broke it.

Last but not least, your suggested regex does work with 2.9.1.

ManeraKai commented 2 months ago

https://i.reddi.it/* url I go to? Because that is how it was working since 2022 for me.

No. URL regex is hard because, you don't know what each user actually wants. Some people just want to bypass the homepage to see the suggestions, not everything that is under that path too. Using regex is more descriptive.

pitsi commented 2 months ago

First of all, since the chromium based browsers do not have an option that disables addon updates, the addon got upgraded to 2.9.1 today and it is broken again.

In my eyes, the url-based exceptions are broken on 2.9.1. If you have any suggestion on a site + frontend combination to test it, please tell me. I partially agree with what you say about regex, but I can not ask others for a new regex syntax every time I have to add an exception!

ManeraKai commented 2 months ago

I think there should be a way to ask the user if he wants to exclude all the sub-paths under the excepted url.

pitsi commented 2 months ago

In order to not have 3 exceptions (for i, v, and preview.redd.it), is there a regex that can exclude all 3 at once? I tried *.redd.it (as url) but it did not work.

ManeraKai commented 2 months ago

This asterisk is a regex symbol. Also, try: https:\/\/(i|v|preview)\.redd\.it

pitsi commented 2 months ago

Well, the asterisk may be a regex symbox, but *.redd.it did not work when set either as a url or as a regex.

Thank you for the complex regex that disables all 3.

ManeraKai commented 2 months ago

Well, the asterisk may be a regex symbox, but *.redd.it did not work when set either as a url or as a regex.

Sorry, the asterisk alone is not a proper symbol, it should be .*. the . means anything, and the * means match the previous token 0 and ∞ times.

pitsi commented 1 month ago

Sorry for bringing this back to the surface, but how can I fix the broken redirection on this url which leads to a single comment? https://www.reddit.com/r/debian/s/pMNc8zgUzX

From here https://old.reddit.com/r/debian/comments/1fypmbi/google_chrome_and_youtube_quality/

ManeraKai commented 3 weeks ago

From here https://old.reddit.com/r/debian/comments/1fypmbi/google_chrome_and_youtube_quality/

This is not a correct old.reddit permalink, the correct link if should be https://old.reddit.com/r/debian/comments/1fypmbi/google_chrome_and_youtube_quality/lqvw83t/ which redirects properly.

pitsi commented 3 weeks ago

That is what I mean. This https://www.reddit.com/r/debian/s/pMNc8zgUzX should redirect to this https://old.reddit.com/r/debian/comments/1fypmbi/google_chrome_and_youtube_quality/lqvw83t/ but it doesn't, proably because that /s/blablabla part, which points to a single comment, does not redirect properly.

ManeraKai commented 3 weeks ago

I have to change the code of redlib for this to work, but we don't support old.reddit, so.

pitsi commented 3 weeks ago

My redirection to old.reddit is set to use teddit as the frontend, I think I explained the reasons above. If there was ONE teddit/redlib/eddrit instance that would be fast and consistent, I would definitely use it over old.reddit, even on mobile, but there isn't.

ManeraKai commented 3 weeks ago

My redirection to old.reddit is set to use teddit as the frontend, I think I explained the reasons above.

I forgot.

Why don't you use Old Reddit Redirect?

pitsi commented 3 weeks ago

As I said when I opened my first issue here, 2.5+ years ago

I use privacy redirect to only redirect reddit to old reddit, twitter to nitter, instagram to bibliogram and youtube to invidious, nothing more than those 4.

I think I had that (or at least a similar) redirection addon for reddit only and I ditched it because privacy redirect could do all the redirects I wanted, from one addon

This means that I still use one addon for all those sites, and that is libredirect.

Offtopic, but bibliogram went eol since then :(