Lemmy Plugins
Plugin support will be added in the upcoming 1.0 release. You can already start developing plugins now.
Follow these steps:
- Follow the normal setup instructions, using
:nightlytags to get the latest development version. - Specify plugins in
lemmy.hjson(docs):
plugins: [{
file: "https://github.com/LemmyNet/lemmy-plugins/releases/download/0.1.3/rust_lingua.wasm",
hash: "e1f58029f2ecca5127a4584609494120683b691fc63a543979ea071f32cf690f",
allowed_hosts: ["0.0.0.0"]
}]
- You can skip the hash check by setting the env var
DANGER_PLUGIN_SKIP_HASH_CHECK.
Plugins are implemented using Extism and Webassembly. They can be written in any language that compiles to Wasm. Checkout the documentation for general development instructions.
The lemmy-plugins repo contains various example plugins written in different languages.
API before hooks
These are called before a given API endpoint is invoked, with the raw JSON data submitted by the user, and need to return data in the same format. Useful for moderation bots which can alter or reject posts.
Examples:
local_post_before_createwith data CreatePostlocal_comment_before_updatewith data EditCommentfederated_post_before_receivewith PostInsertForm- Search the code for
plugin_hook_beforeto find all available hooks
API after hooks
Called after an endpoint was successfully invoked and gets passed the API return data. Useful for notifications.
Examples:
local_post_after_createwith data CreatePostlocal_comment_after_updatewith data EditCommentfederated_post_after_receivewith Post- Search the code for
plugin_hook_beforeto find all available hooks
Captcha Plugin
get_captchagenerates a new captcha, returns CaptchaResponsevalidate_captchatakes CaptchaAnswer and should return error if the answer is wrong