Do not open popup when not needed
rugk opened this issue · 4 comments
Background
In #84 @hueyy implemented support for Mastodon v4.
I also plan to enable "skip popup" by default now, since the popup is not a known concept for Mastodon v4 users now.
However, the problem then persists that if you enable "popup closing" (see #44) this the popup quickly opens and closes, which is just not needed, really, as we just do that to re-implement/keep the legacy way of how it worked. See #83 (comment).
Proposed solution
The content script needs to communicate the username or other data back to the background script where to navigate, which then triggers the tab navigation…
Actually, easier: Instead of opening target="_blank"
we can just switch to the default target/target "_self_"
, i.e. the same window in the content script triggers. The redirect should work as usual. This still needs to pass that setting to the content script from the background script, but that is okay/possible reasonably.
- we can remove the legacy code that closes the popup or so then, it should not happen. (but we need to keep care of how other Fediverse instances do it then)
Also UI things:
- maybe invert the logic of the popup setting if it by defailts opens no popup to be "Open in new popup".
Alternatives
Leave it as it is. I consider this an iteration over the previous features, as it is "just" a minor inconvenience and opens a new popup. And would be quite some implementation effort, as it changes the add-on again fundamentally.
Additional context
@hueyy are you interested in having a look here for further improving the whole mechanism? It goes into simpler WebExtension stuff. There are also maintenance tasks like #50 and I've found another extension that did the same as we did (unfortunately only now), that may have done things better or can at least be used for inspiration: raikasdev/mastodon4-redirect#6
Hey! I have also thought about an another idea: What if instead of redirecting or something, the follow/interact button clicks are listened to, preventing default listeners and then using OAuth to do the action?
I believe that people will want to still be on the users page maybe after the action as (at least on) Mastodon4 requires you to go to other instances to view older posts.
- Roni
While that may be possible, I see a technical risk here. The TL;DR is that you cannot see who you are interacting with, because a website may fake/show anything, where you can click on.
I elaborated on this on Mastodon already, because a different extension works like that, but have not yet proven it by testing it out.