-
Notifications
You must be signed in to change notification settings - Fork 21
Development
Basically you may need to register a new type and handler for your Fediverse site and add it here to the others: https://github.com/rugk/mastodon-simplified-federation/blob/1c54aec0381d959239d458c8f81383c6ad9b2588/src/background/modules/AutoRemoteFollow.js#L31
That detect handler does all the detection work and is called automatically, just use the existing ones as a reference: https://github.com/rugk/mastodon-simplified-federation/blob/main/src/background/modules/Detect/Friendica.js
That, however, is only for catching URL redirections. Now the tricky part is just ahead…
The tricky part is then to have a content script like https://github.com/rugk/mastodon-simplified-federation/blob/main/src/content_script/mastodonInject.js that intercepts the button clicks or whatever you actually want. You then need to add this to be injected into each tab here: https://github.com/rugk/mastodon-simplified-federation/blob/1c54aec0381d959239d458c8f81383c6ad9b2588/src/background/modules/AutoRemoteFollow.js#L157
The thing is to make sure you cause no false-positives (properly detect the website is an instance of the service) striking a balance between it being constrained enough like that, but also being flexible enough so that a website/slightly-modified or differently configured instance or an instance that may be running a more recent/upgraded software version still works. Sounds complicated but well, you'll see that and if there happens to be a breaking change in the Fediverse software then well… this add-on needs to be fixed again and upgraded.
The aim of all that content script currently just is to trigger opening a window/popup so the URL catching/detection you implemented earlier triggers. See here e.g.: https://github.com/rugk/mastodon-simplified-federation/blob/1c54aec0381d959239d458c8f81383c6ad9b2588/src/content_script/mastodonInject.js#L37
See https://github.com/rugk/mastodon-simplified-federation/issues/86 when that changes. But for now, this is the basic way.