Plugin examples / docs ?

submitted by kinda mostly

Hello! I've been mostly away from Lemmy/Piefed for a bit (important to take a break for mental health) but, was hoping that someone could point me to Piefed plugin examples/docs.

I have been experimenting with open-source small language models (recently, Hugging Face's SmolLM series) both professionally and on my own time and had some excellent accessibility use cases pointed out to me (ex. generating image alt text if absent) that I'd like to look into the practicality of making optionally available to Pixelfed. Because the models that I'm looking at are so small (I can run them on my android phone!), I'm confident that they could be used server-side without resource issues. And I'd also like to see if I can do any more fun, non-AI stuff with plugins too.

Thanks!

1

Log in to comment

6 Comments

Piefed has a simple plugin system added a few months back, general docs for dev can be found here:

https://join.piefed.social/docs/developers/

Which will get you to codeberg for the full repo

Plugin docs here:

https://codeberg.org/rimu/pyfedi/src/branch/main/docs/PLUGINS.md

And the stable API here

https://stable.wjs018.xyz/api/alpha/swagger

I don't think we have good documentation for it. Above you have the announcement post, a community intended to discuss plugin development and share examples, and PieFed's code with an example plugin and the plugin system. It's still early days so it has some first plugin hooks but not a complete set of functionality for various tasks. I think the developers welcome people finding use-cases and expanding on the concept, though.

Edit: Thanks curbstickle for reminding me, and there is some official documentation:

I think the developers welcome people finding use-cases and expanding on the concept

Absolutely! It was actually an admin reaching out like this that led me to add some hooks for plugins to use and to create the onboarding plugin.

Thanks very much!

I think hendrik covered the basics. Plugins within piefed are pretty basic right now since there are only so many hooks that they can tap into. However, if you come up with a use case that the current set of hooks don't allow you to do, please reach out and we can add more hooks in as the need arises.

The system itself can be extremely powerful, but similarly dangerous. Plugins have full access to the piefed database and any functions/modules in the codebase. If you want an example of a plugin that is currently being used in production (by at least two instances I know of) you could look at the onboarding plugin that I wrote.

Good stuff! Thanks very much.