Skip to content

Make rate limiting message configurable#15

Closed
dsaxton wants to merge 3 commits into
damus-io:masterfrom
dsaxton:custom-ratelimit-message
Closed

Make rate limiting message configurable#15
dsaxton wants to merge 3 commits into
damus-io:masterfrom
dsaxton:custom-ratelimit-message

Conversation

@dsaxton
Copy link
Copy Markdown
Contributor

@dsaxton dsaxton commented Sep 24, 2024

Just a humble PR to make the rate-limiting message configurable.

Testing:

Edit messages under [filters.ratelimit] in noteguard.toml then

$ make build-linux
...
$ ./test/delayed | ./target/x86_64-unknown-linux-musl/release/noteguard
{"id":"68421a122cef086512b2c5bd29ca6285ced8bd8e302e347e3c5d90466c860a76","action":"accept"}
{"id":"68421a122cef086512b2c5bd29ca6285ced8bd8e302e347e3c5d90466c860a76","action":"accept"}
{"id":"68421a122cef086512b2c5bd29ca6285ced8bd8e302e347e3c5d90466c860a76","action":"accept"}
{"id":"68421a122cef086512b2c5bd29ca6285ced8bd8e302e347e3c5d90466c860a76","action":"accept"}
{"id":"68421a122cef086512b2c5bd29ca6285ced8bd8e302e347e3c5d90466c860a76","action":"accept"}
{"id":"68421a122cef086512b2c5bd29ca6285ced8bd8e302e347e3c5d90466c860a76","action":"accept"}
{"id":"68421a122cef086512b2c5bd29ca6285ced8bd8e302e347e3c5d90466c860a76","action":"accept"}
{"id":"68421a122cef086512b2c5bd29ca6285ced8bd8e302e347e3c5d90466c860a76","action":"accept"}
{"id":"68421a122cef086512b2c5bd29ca6285ced8bd8e302e347e3c5d90466c860a76","action":"reject","msg":"this is my custom message"}
{"id":"68421a122cef086512b2c5bd29ca6285ced8bd8e302e347e3c5d90466c860a76","action":"reject","msg":"this is my custom message"}
{"id":"68421a122cef086512b2c5bd29ca6285ced8bd8e302e347e3c5d90466c860a76","action":"reject","msg":"this is my custom message"}
{"id":"68421a122cef086512b2c5bd29ca6285ced8bd8e302e347e3c5d90466c860a76","action":"reject","msg":"this is my custom message"}
{"id":"68421a122cef086512b2c5bd29ca6285ced8bd8e302e347e3c5d90466c860a76","action":"reject","msg":"this is my custom message"}
...

Comment thread src/filters/ratelimit.rs Outdated
pub struct RateLimit {
pub posts_per_minute: i32,
pub whitelist: Option<Vec<String>>,
pub message: String,
Copy link
Copy Markdown
Contributor

@jb55 jb55 Nov 16, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we probably want Option<String> here

@jb55 jb55 closed this in 77c2a89 Nov 18, 2024
@jb55
Copy link
Copy Markdown
Contributor

jb55 commented Nov 18, 2024

thanks! squashed into 77c2a89,

made a small optimization in 778c5a0, separated your makefile change into 3b73e9a, and documented this new string in db9ef05

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants