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

Add PeerTube support #112

Open
jeena opened this issue Jun 28, 2023 · 3 comments
Open

Add PeerTube support #112

jeena opened this issue Jun 28, 2023 · 3 comments
Labels
enhancement New feature or request help wanted Extra attention is needed

Comments

@jeena
Copy link

jeena commented Jun 28, 2023

Background

This extension solves the problem for Mastodon, the same problem we have for PeerTube too.

Proposed solution

Extend it with support for PeerTube.

Alternatives

I tried to fork it and to rewrite it but once I did I realized that it's very big and I would need to understand a lot of details to be able to do it so after two days of trying I gave up for now.

Another alternative would be to rewrite it into a framework with plugin support so people could write simple plugins to make it work with other software like PixelFed, Lemmy, PeerTube, /kbin and all other fediverse apps which have similar problems.

Additional context

@jeena jeena added the enhancement New feature or request label Jun 28, 2023
@rugk rugk added the help wanted Extra attention is needed label Jul 23, 2023
@rugk
Copy link
Owner

rugk commented Jul 23, 2023

The thing is we have a dropdown again, no tab opening, so it technically needs a content script just like new Mastodon.

the abo button:
grafik

the comment field click triggers this:
grafik

(from https://video.blender.org/)

  • Also it would be possible to trigger directly on the clicks into the comment box + abo button (but in case of the latter that would break RSS abo functionality as you basically cannot click the button then 🙈 )
  • Alternatively, we have a problem... 🤔

So some UX thoughts need to be done here in any case.

@rugk
Copy link
Owner

rugk commented Jul 23, 2023

I tried to fork it and to rewrite it but once I did I realized that it's very big and I would need to understand a lot of details to be able to do it so after two days of trying I gave up for now.

Ah in any case thanks for trying to contribute. If you have any questions feel free to ask.

Basically you may need to register a new type and handler for your Fediverse site and add it here to the others:

const FEDIVERSE_MODULE = Object.freeze({

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:

async function onTabUpdate(tabId, changeInfo) {

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.:

window.open(`/interact/${tootId}`, "_blank");

See #86 when that changes. But for now, this is the basic way.

@rugk
Copy link
Owner

rugk commented Jul 23, 2023

As that is a good basic explanation to get started, I just dumped it to https://github.com/rugk/mastodon-simplified-federation/wiki/Development, though GitHub does not do inline code citations there unfortunately.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants