This repository contains various example plugins for Lemmy. See the Extism documentation for details on how to write plugins. Lemmy-specific details and available hooks are described in the RFC.
Uses the create_local_post
hook to listen for newly created posts, replacing some words and rejecting posts containing specific terms. See go-pdk readme for detailed documentation.
Use the following steps to compile it:
apt install go
# install tinygo: https://tinygo.org/getting-started/install/linux/
cd plugins/go_replace_words
tinygo build -o ../go_replace_words.wasm -target wasip1 -buildmode=c-shared main.go
Listens to new_post
hook which is called after any local or remote post is created. Then calls the url configured in the manifest (plugins/typescript_push_webhook.json
) with the post's ap_id
. See js-pdk readme for setup and detailed documentation.
Use the following steps to compile it:
apt install npm typescript
# use steps in js-pdk readme to install extism-js
cd plugins/typescript_push_webhook
npm install
npm run build
Listens to new_vote
hook, then calls /api/v4/person
to get details about the voter. It only allows downvotes if the user has made at least 5 posts before. See rust-pdk readme for setup and detailed documentation.
Use the following steps to compile it:
apt install cargo
cd plugins/rust_allowed_voters
cargo build
cp target/wasm32-unknown-unknown/debug/rust_allowed_voters.wasm ..
This repository contains test cases for the plugins. To run them install pnpm
and postgresql
, with a database postgres://lemmy:password@localhost:5432/lemmy
. Then compile all the plugins as described above, go into tests
folder and execute ./run.sh
.