tomouchuu / mastodon-translate

Tampermonkey Script to add option to Translate Toots
The Unlicense
24 stars 2 forks source link

CSP Issue #14

Closed tomouchuu closed 6 years ago

tomouchuu commented 6 years ago

your mastodon translate script doesn't seem to be working for me. I've been to settings and enabled it, and refreshed the page but it doesn't seem to add the translate option to the menu. Console implies it might be because of CSP headers.

Via rx14 - https://niu.moe/@rx14/98959035341618015


Looks to be working for me on chrome but firefox is just not working and seeing a CSP error when going from preferences to the feed. Need to investigate the script across tampermonkey versions.

tomouchuu commented 6 years ago

So it turns out it's not a CSP issue which is good (as that would likely be a problem with tampermonkey itself).

What's actually happening is that the event that adds the translate option to the toot dropdown on chrome is the icon itself. On firefox though it's the button so the function to add the translate toot is never added. Need to come up with a cross-browser fix for this!

RX14 commented 6 years ago

It broke again in FF 57 suing greasemonkey :(

tomouchuu commented 6 years ago

Should be fixed in the latest update, I didn't know about the greasemonkey naming changes so have added those now.

Let me know if that's fixed it and I'll close the issue, thanks for letting me know!

RX14 commented 6 years ago

It works, however it seemed intermittently working at the start. I'll keep my eye on it and make another bug if it persists, but it seems to work fine now. You can close this.

tomouchuu commented 6 years ago

Great thanks!

RX14 commented 6 years ago

Seems that loading https://niu.moe/ doesn't load the script, but loading https://niu.moe/<anything> does.

tomouchuu commented 6 years ago

Yeah, this is related to #2 I don't want to just have load on any site you visit but can't hardcode in every mastodon instance. Ideally I'd want it to ask the user on first install or something.

Though just had a thought to maybe load on every site you visit but only activate if it finds some mastodon specific markup or something.

RX14 commented 6 years ago

Perhaps it's a greasemonkey bug that the redirect from / to /web doesn't load the script. At least it used to do that before FF57 iirc.