Lartsch / FediAct

Chrome/Firefox extension that simplifies interactions on other Mastodon instances than your own.
MIT License
459 stars 15 forks source link

FediAct breaks Worldle #42

Closed wlonkly closed 1 year ago

wlonkly commented 1 year ago

As of I think, v0.9.8 v0.9.8.5, FediAct has prevented some images from displaying on the country-guessing game Worldle in Firefox.

The symptoms are that the progress boxes when you make a guess do not load, and the country and flag vector images after the first one (on "guess neighbours", for instance).

Expected behavior:

Behavior with FediAct enabled:

I haven't been able to figure out exactly why, although I did observe this error in the console:

SyntaxError: JSON.parse: unexpected character at line 1 column 1 of the JSON data | inject.min.js:1:22960

and inject.min.js is from Fediact. But I haven't been able to track down the connection.

Unfortunately since the interaction is occurring early, adding wordle.teuteuf.fr to the denylist in the extension does not solve the problem.

wlonkly commented 1 year ago

Confirmed that 0.9.7.1 did not have the issue, give me a moment and I'll find which release it started in.

wlonkly commented 1 year ago

The problem started in 0.9.8.5, Worldle still works correctly with 0.9.8.4.

wlonkly commented 1 year ago

Ah it's in here: https://github.com/Lartsch/FediAct/blob/v0.9.8.5/src/inject.js#L1462-L1468

I think it needs to trap an exception if https://<location>/api/v1/instance returns something that is not the expected Mastodon JSON. Looks like worldle.teuteuf.fr returns the game HTML at any URL path, including that one: https://worldle.teuteuf.fr/api/v1/instance

Or maybe it's enough to check content-type?

I'd work up a patch but I'm not set up for extension development and testing. (I still have no idea why it breaks Worldle in that specific way, either!)

Lartsch commented 1 year ago

Hi there, thanks for posting the issue and good job pointing it out! Yes, this check requires some additional processing. Seems like the endpoint is kinda popular and there would be too much false-positives ;) If the check succeeds, some event listeners are set up to provide the functionality. I can imagine that these somehow mess with the website you mentioned, so improving the check should fix this issue too. Will look into this tomorrow, Cheers

Lartsch commented 1 year ago

Should be fixed with https://github.com/Lartsch/FediAct/commit/8926e8ad80c41c7898c8bf883179df3d09b77a2c / v0.9.8.6

wlonkly commented 1 year ago

Unfortunately the problem is still happening in v0.9.8.7 in Worldle. The JSON error is gone now, but I guess that was a red herring, sorry!

I dug around a little bit more and I can't find the conflict between the site and this extension. One thing I did notice is that the images disappear the moment FediAct is enabled -- I don't have to reload for them to disappear.

The other thing I noticed is that if I disable opacity: 0 (from Worldle's .opacity-0 class in chunk.css) then the problem goes away. So for some reason, that opacity which is usually being overridden... somehow (probably during fade-in?) is still being applied when FediAct is enabled.

(Although I'm eyeing the @keyframes animations -- I don't have enough front-end skills to know if that would interfere though.)