Skip to content
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

Redirect to a specific instagram account when a page contains an instagram embed #14

Open
signaleleven opened this issue Nov 14, 2024 · 4 comments · Fixed by #15
Open

Comments

@signaleleven
Copy link
Contributor

signaleleven commented Nov 14, 2024

Occasionally (not always, which I realize it's very annoying in a bug report) when a page contains a instagram embedded post, I get AUTOMATICALLY redirected to https://www.picuki.com/profile/ajax (which has nothing to do with the embedded post, and I suspect the name "ajax" might be a clue on the root cause?)
Switching to imginn causes the same behavior, but redirecting to imginn of course.

The page linked below, for instance, seems to trigger the bug fairly regularly on Firefox. Scroll until the embedded instagram post, and the browser will navigate to the profile mentioned above, which is very confusing, as it takes you away from the page you are reading. Hitting "back" usually lets you stay on the page, but when the tab loses focus, the redirect happens again.

https://www.ilpost.it/2024/10/05/mastruzzo-scrivere-ai-prigionieri-politici-russi/

I'm not sure what other information I can offer, please let me know.

@signaleleven
Copy link
Contributor Author

While trying to replicate the bug, especially the redirect that happens when the tab loses focus, I realized that when the tab loses focus a POST request to instagram is ussued (which is incidentally blocked by my adblocker, we'll see if it's relevant - probably not)

image

it's a redirect to instagram.com/ajax which is a big indication of why that specific user (whoever they are) is what I get redirected to.

https://github.com/claromes/socialswitch/blob/main/firefox/background.js#L40
This seems to suggest that the specific request (surely triggered by the embed) is intercepted by the extension (instagram.com/ is valid, including if the handle is ajax, it's so weird that they use /ajax for their internal stuff...)
Instagram internally probably can get away with it because a GET request for instagram.com/ is always for the user, and a POST request is only for their internal tracking or whatever that request is doing (I really don't want to know).

Blocklisting "ajax" as a handle in your code is bad because it would make the extension not work for that specific user, but perhaps intercepting and discarding POST requests for /ajax would solve the issue without side effects.

Sorry, I never developed an extension and I don't think I can test my theory quickly.

signaleleven added a commit to signaleleven/socialswitch that referenced this issue Dec 1, 2024
claromes added a commit that referenced this issue Dec 11, 2024
@claromes
Copy link
Owner

@signaleleven Thank you for the issue and the PR. It has already been updated in the AMO, with proper credits in the Release Notes section.

@signaleleven
Copy link
Contributor Author

Can this be reopened? I still see the issue on Firefox mobile (after upgrading to the new version).
Does firefox mobile use the same extension code as firefox desktop?

@claromes
Copy link
Owner

Curious. I tested it on mobile, and the links that had this issue were resolved. The version I am using is 133.0.3. It's the same code.
Please send me the link that's causing the problem.

@claromes claromes reopened this Dec 23, 2024
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 a pull request may close this issue.

2 participants