Skip to content

Commit 223298e

Browse files
committed
v0.2.0; License; BlankieStart event
1 parent 6753174 commit 223298e

File tree

9 files changed

+46
-9
lines changed

9 files changed

+46
-9
lines changed

.github/webhook_join.png

8.11 KB
Loading

.github/webhook_start.png

7.53 KB
Loading

.github/webhook_stop.png

7.37 KB
Loading

Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "blankie"
3-
version = "0.1.0"
3+
version = "0.2.0"
44
edition = "2024"
55

66
[dependencies]

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2025 mxve
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,24 @@
1212
- schedule server commands
1313
- blankie is _not_ a proxy, the target server must be reachable by the user and have `accepts-transfers` enabled
1414
- whitelist support (monitors server whitelist, unauthorized players are rejected before transfer/server startup)
15+
- webhooks for events
16+
1517
---
1618

19+
### table of contents
20+
21+
- [cli args](#cli-args)
22+
- [example config file](#example-configtoml)
23+
- [webhooks](#webhooks)
24+
- [events](#events)
25+
- [examples](#examples)
26+
1727
### cli args
1828

1929
- `--config <path>`
2030

2131
### example config.toml
32+
2233
```toml
2334
[server]
2435
java_path = "java" # java executable
@@ -49,7 +60,9 @@ bearer_token = "your-bearer-token" # bearer token (optional)
4960
user_agent = "blankie/0.1.0" # user agent (optional)
5061
```
5162

52-
### (webhook) events
63+
### webhooks
64+
65+
#### events
5366

5467
- `Connect`: player connected to blankie
5568
- `{ip}`
@@ -75,13 +88,17 @@ user_agent = "blankie/0.1.0" # user agent (optional)
7588
- `{uuid}`
7689
- `{host}`
7790
- `{port}`
91+
- `BlankieStart`: blankie started
7892

79-
### example webhooks
93+
#### examples
8094

8195
- discord
8296
- user join (transfer)
8397
- `body = "{ \"content\": null, \"embeds\": [{\"description\": \"{user} joined the server!\", \"color\": 5369975, \"author\": {\"name\": \"{user}\", \"icon_url\": \"https://mc-heads.net/avatar/{uuid}\"}}], \"attachments\": []}"`
98+
![](.github/webhook_join.png)
8499
- server start
85100
- `body = "{ \"content\": null, \"embeds\": [{\"description\": \"Server started for {user}\", \"color\": 13652464, \"author\": {\"name\": \"blankie\", \"icon_url\": \"https://raw.githubusercontent.com/mxve/blankie/main/.github/blankie.png\"}}], \"attachments\": []}"`
101+
![](.github/webhook_start.png)
86102
- server stop
87-
- `body = "{ \"content\": null, \"embeds\": [{\"description\": \"Server stopped\", \"color\": 15749463, \"author\": {\"name\": \"blankie\", \"icon_url\": \"https://raw.githubusercontent.com/mxve/blankie/main/.github/blankie.png\"}}], \"attachments\": []}"`
103+
- `body = "{ \"content\": null, \"embeds\": [{\"description\": \"Server stopped\", \"color\": 15749463, \"author\": {\"name\": \"blankie\", \"icon_url\": \"https://raw.githubusercontent.com/mxve/blankie/main/.github/blankie.png\"}}], \"attachments\": []}"`
104+
![](.github/webhook_stop.png)

src/events.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ pub enum Event {
3838
},
3939
ServerEmpty,
4040
ServerUp,
41+
BlankieStart,
4142
}
4243

4344
impl Event {
@@ -78,6 +79,7 @@ impl Event {
7879
Event::Action { msg } => ("blankie", msg.clone()),
7980
Event::ServerEmpty => ("blankie", "Server is now empty".into()),
8081
Event::ServerUp => ("blankie", "Target server reached online status".into()),
82+
Event::BlankieStart => ("blankie", "Blankie has started".into()),
8183
}
8284
}
8385

src/main.rs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,10 +51,6 @@ async fn main() -> std::io::Result<()> {
5151
whitelist: RwLock::new(HashSet::new()),
5252
});
5353

54-
state.events.emit(Event::Action {
55-
msg: "blankie started".into(),
56-
});
57-
5854
let s = state.clone();
5955
tokio::spawn(async move {
6056
server::monitor_loop(s).await;
@@ -67,6 +63,7 @@ async fn main() -> std::io::Result<()> {
6763

6864
let l = TcpListener::bind(&cfg.blankie.bind_addr).await?;
6965
println!("blankie started on {}", cfg.blankie.bind_addr);
66+
state.events.emit(Event::BlankieStart);
7067

7168
loop {
7269
let (stream, addr) = l.accept().await?;

0 commit comments

Comments
 (0)