Skip to content

Commit 17a50b2

Browse files
authored
Add captcha plugin (#9)
* Add captcha plugin * fixes * ci * commit lockfiles * fix target * update binary * fix tests * move struct to lemmy * clear captcha after validate
1 parent 2849739 commit 17a50b2

File tree

22 files changed

+6809
-47
lines changed

22 files changed

+6809
-47
lines changed

.gitignore

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,13 @@
55
# tests
66
node_modules
77
tests/.yalc
8-
tests/yalc.lock
98
tests/pict-rs
109
tests/log
1110

1211
# plugins
1312
plugins/rust_allowed_voters/target
14-
plugins/rust_allowed_voters/Cargo.lock
1513
plugins/rust_lingua/target
16-
plugins/rust_lingua/Cargo.lock
14+
plugins/rust_captcha/target
1715
plugins/typescript_push_webhook/dist
1816
plugins/typescript_push_webhook/node_modules
1917

.woodpecker.yml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,16 +29,18 @@ steps:
2929
build_rust_plugins:
3030
image: rust:1.91
3131
commands:
32-
- ./scripts/ci-build-rust.sh rust_allowed_voters
32+
- ./scripts/ci-build-rust.sh rust_allowed_voters debug wasm32-wasip1
3333
- ./scripts/ci-build-rust.sh rust_lingua
34+
- ./scripts/ci-build-rust.sh rust_captcha debug wasm32-wasip1
3435
when:
3536
- event: [pull_request]
3637

3738
build_rust_plugins_release:
3839
image: rust:1.91
3940
commands:
40-
- ./scripts/ci-build-rust.sh rust_allowed_voters release
41+
- ./scripts/ci-build-rust.sh rust_allowed_voters release wasm32-wasip1
4142
- ./scripts/ci-build-rust.sh rust_lingua release
43+
- ./scripts/ci-build-rust.sh rust_captcha release wasm32-wasip1
4244
when:
4345
- event: [tag]
4446

@@ -58,6 +60,7 @@ steps:
5860
environment:
5961
LEMMY_DATABASE_URL: postgres://lemmy:password@database:5432
6062
DO_WRITE_HOSTS_FILE: "1"
63+
DANGER_PLUGIN_SKIP_HASH_CHECK: 1
6164
commands:
6265
- npm install -g corepack@latest && corepack enable pnpm
6366
- apt-get update && apt-get install -y --no-install-recommends --no-install-suggests bash curl postgresql-client ca-certificates

config/config.hjson

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
{
2+
hostname: lemmy
3+
plugins: [
4+
{
5+
file: plugins/rust_captcha.wasm
6+
},
7+
{
8+
file: "plugins/go_replace_words.wasm"
9+
},
10+
{
11+
file: "plugins/rust_allowed_voters.wasm"
12+
allowed_hosts: ["0.0.0.0"]
13+
},
14+
{
15+
file: plugins/typescript_push_webhook.wasm
16+
"allowed_hosts": ["127.0.0.1"],
17+
"config": {
18+
"notify_url": "http://127.0.0.1:8927"
19+
}
20+
}
21+
]
22+
}

config/lemmy_alpha.hjson

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,23 @@
77
admin_password: lemmylemmy
88
site_name: lemmy-alpha
99
}
10+
plugins: [
11+
{
12+
file: plugins/rust_captcha.wasm
13+
},
14+
{
15+
file: "plugins/go_replace_words.wasm"
16+
},
17+
{
18+
file: "plugins/rust_allowed_voters.wasm"
19+
allowed_hosts: ["0.0.0.0"]
20+
},
21+
{
22+
file: plugins/typescript_push_webhook.wasm
23+
"allowed_hosts": ["127.0.0.1"],
24+
"config": {
25+
"notify_url": "http://127.0.0.1:8927"
26+
}
27+
}
28+
]
1029
}

config/lemmy_beta.hjson

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,23 @@
77
admin_password: lemmylemmy
88
site_name: lemmy-beta
99
}
10+
plugins: [
11+
{
12+
file: plugins/rust_captcha.wasm
13+
},
14+
{
15+
file: "plugins/go_replace_words.wasm"
16+
},
17+
{
18+
file: "plugins/rust_allowed_voters.wasm"
19+
allowed_hosts: ["0.0.0.0"]
20+
},
21+
{
22+
file: plugins/typescript_push_webhook.wasm
23+
"allowed_hosts": ["127.0.0.1"],
24+
"config": {
25+
"notify_url": "http://127.0.0.1:8927"
26+
}
27+
}
28+
]
1029
}

lemmy_server

17.4 MB
Binary file not shown.

plugins/go_replace_words.json

Lines changed: 0 additions & 7 deletions
This file was deleted.

plugins/rust_allowed_voters.json

Lines changed: 0 additions & 8 deletions
This file was deleted.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
[build]
2-
target = "wasm32-unknown-unknown"
2+
target = "wasm32-wasip1"

plugins/rust_allowed_voters/.gitignore

Lines changed: 0 additions & 2 deletions
This file was deleted.

0 commit comments

Comments
 (0)