Skip to content

Commit 3aa5aad

Browse files
authored
Rename plugin hooks (#4)
1 parent 3bbe901 commit 3aa5aad

File tree

6 files changed

+20
-20
lines changed

6 files changed

+20
-20
lines changed

.woodpecker.yml

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -6,28 +6,18 @@ steps:
66
when:
77
- event: pull_request
88

9-
build_rust_plugin:
10-
image: rust:1.81
11-
commands:
12-
- rustup target add wasm32-unknown-unknown
13-
- cd plugins/rust_allowed_voters
14-
- cargo build
15-
- cp target/wasm32-unknown-unknown/debug/rust_allowed_voters.wasm ..
16-
when:
17-
- event: [pull_request, tag]
18-
199
build_typescript_plugin:
2010
# need to use ubuntu instead of debian because extism-js requires newer glibc version
2111
# https://github.com/extism/js-pdk/issues/129
2212
image: ubuntu
2313
commands:
24-
- apt-get update && apt-get install -y --no-install-recommends --no-install-suggests node-typescript wget gzip ca-certificates npm
25-
- wget --quiet https://github.com/extism/js-pdk/releases/download/v1.4.0/extism-js-x86_64-linux-v1.4.0.gz -O extism-js.gz
14+
- apt-get update && apt-get install -y --no-install-recommends --no-install-suggests node-typescript curl ca-certificates npm
15+
- curl https://github.com/extism/js-pdk/releases/download/v1.4.0/extism-js-x86_64-linux-v1.4.0.gz -L -o extism-js.gz
2616
- gzip -d extism-js.gz
2717
- chmod +x extism-js
2818
- mv extism-js /usr/local/bin/
2919
# for wasm-merge, version in ubuntu repo is too old
30-
- wget --quiet https://github.com/WebAssembly/binaryen/releases/download/version_122/binaryen-version_122-x86_64-linux.tar.gz -O binaryen.tar.gz
20+
- curl https://github.com/WebAssembly/binaryen/releases/download/version_122/binaryen-version_122-x86_64-linux.tar.gz -L -o binaryen.tar.gz
3121
- tar -xvzf binaryen.tar.gz
3222
- mv binaryen-version_122/bin/* /usr/local/bin/
3323
- cd plugins/typescript_push_webhook
@@ -36,6 +26,16 @@ steps:
3626
when:
3727
- event: [pull_request, tag]
3828

29+
build_rust_plugin:
30+
image: rust:1.81
31+
commands:
32+
- rustup target add wasm32-unknown-unknown
33+
- cd plugins/rust_allowed_voters
34+
- cargo build
35+
- cp target/wasm32-unknown-unknown/debug/rust_allowed_voters.wasm ..
36+
when:
37+
- event: [pull_request, tag]
38+
3939
build_go_plugin:
4040
image: tinygo/tinygo:latest
4141
backend_options:
@@ -54,11 +54,11 @@ steps:
5454
DO_WRITE_HOSTS_FILE: "1"
5555
commands:
5656
- npm install -g corepack@latest && corepack enable pnpm
57-
- apt-get update && apt-get install -y --no-install-recommends --no-install-suggests bash curl postgresql-client golang wget ca-certificates
57+
- apt-get update && apt-get install -y --no-install-recommends --no-install-suggests bash curl postgresql-client golang curl ca-certificates
5858
# install tinygo to compile wasm plugins
5959
# https://tinygo.org/getting-started/install/linux/#ubuntu-debian
60-
- wget -q https://github.com/tinygo-org/tinygo/releases/download/v0.36.0/tinygo_0.36.0_amd64.deb
61-
- dpkg -i tinygo_0.36.0_amd64.deb
60+
- curl https://github.com/tinygo-org/tinygo/releases/download/v0.36.0/tinygo_0.36.0_amd64.deb -L -o tinygo.deb
61+
- dpkg -i tinygo.deb
6262
- bash tests/prepare.sh
6363
- cd tests/
6464
- pnpm i

lemmy_server

11.1 KB
Binary file not shown.

plugins/go_replace_words/main.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ func metadata() int32 {
2929
}
3030

3131
// This hook gets called when a local user creates a new post
32-
//go:wasmexport create_local_post
32+
//go:wasmexport before_create_local_post
3333
func create_local_post() int32 {
3434
// Load user parameters into a map, to make sure we return all the same fields later
3535
// and dont drop anything

plugins/rust_allowed_voters/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ pub fn metadata() -> FnResult<Json<Metadata>> {
2323
}
2424

2525
#[plugin_fn]
26-
pub fn post_vote(
26+
pub fn before_post_vote(
2727
Json(vote): Json<HashMap<String, Value>>,
2828
) -> FnResult<Json<HashMap<String, Value>>> {
2929
let lemmy_url = config::get("lemmy_url")?.unwrap();
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
declare module "main" {
22
export function metadata();
3-
export function new_post();
3+
export function after_create_local_post();
44
}

plugins/typescript_push_webhook/src/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ export function metadata() {
1313
Host.outputString(JSON.stringify(metadata));
1414
}
1515

16-
export function new_post() {
16+
export function after_create_local_post() {
1717
const params = JSON.parse(Host.inputString());
1818
if (params["name"] != "Notification") {
1919
// Ignore posts with a different title, otherwise unrelated tests will throw

0 commit comments

Comments
 (0)