Skip to content

Commit

Permalink
🎉Release v0.3.0!🎉
Browse files Browse the repository at this point in the history
  • Loading branch information
shiroyashik committed Aug 20, 2024
1 parent dabe176 commit 494de2b
Show file tree
Hide file tree
Showing 9 changed files with 60 additions and 19 deletions.
15 changes: 12 additions & 3 deletions .github/release-body.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
## Bug fix
## Release ☆ ~('▽^人)

Fixed error (failed to verify) when authenticating via Mojang
> [!CAUTION]
> **Update your Config.toml according to the example in the repository!**
**Full Changelog**: https://github.com/shiroyashik/sculptor/compare/v0.2.2...v0.2.3
What's added:
- Ability to change authentication providers;
- Display information about Sculptor in MOTD;
- Checking updates for Sculptor (displayed in CLI at startup) and for Figura (reported in mod UI);
- Saving log files in a separate directory;
- User bans and Minecraft blacklist parser;
- Implemented a special API for backend manipulation by third-party software.

**Full Changelog**: https://github.com/shiroyashik/sculptor/compare/v0.2.3...v0.3.0
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
name = "sculptor"
authors = ["Shiroyashik <shiroyashik@shsr.ru>"]
version = "0.3.0-dev"
version = "0.3.0"
edition = "2021"
publish = false

Expand Down
8 changes: 4 additions & 4 deletions Config.example.toml
Original file line number Diff line number Diff line change
Expand Up @@ -70,10 +70,10 @@ special = [0,0,0,1,0,0] # 6
pride = [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0] # 25

## With advancedUsers you can set additional parameters
# [advancedUsers.your uuid here]
# [advancedUsers.your-uuid-here]
# username = "Your_username_here"
# banned = true
# special = [0,1,0,0,0,0] # and set badges what you want! :D
# pride = [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]
# special = [0,1,0,0,0,0] # Set badges what you want! :D
# pride = [0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0] # Check out note.txt for reference

## you can create an unlimited number of "advancedUsers" for any users.
## you can create an unlimited number of "advancedUsers" for any players.
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM rust:1.78.0-alpine3.20 as builder
FROM rust:1.80.1-alpine3.20 as builder

WORKDIR /build

Expand Down
3 changes: 3 additions & 0 deletions docker-compose.example.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ services:
- ./Config.toml:/app/Config.toml:ro
- ./avatars:/app/avatars
- ./logs:/app/logs
# You can specify the path to the server folder
# for Sculptor to use the ban list from it
# - ./minecraft-server:/app/mc
environment:
- RUST_LOG=info
## Recommended for use with reverse proxy.
Expand Down
14 changes: 7 additions & 7 deletions note.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Коды ошибок WebSocket из Figura
WebSocket close codes from Figura
1000 Normal Closure
1001 Going Away
1002 Protocol Error
Expand All @@ -20,12 +20,12 @@
4002 Too Many Connections

Special badges
1 Разработчик
2 Член персонала официального сервера
3 Победитель контеста
4 Спасибо за поддержку
5 Переводчик
6 Художник текстур мода
1 Разработчик | Figura Developer!
2 Член персонала официального сервера | Official Figura Discord Staff!
3 Победитель контеста | Figura contest winner! GG!
4 Спасибо за поддержку | Thank you for supporting the Figura mod!
5 Переводчик | Figura mod Translator!
6 Художник текстур мода | Figura mod Texture Artist!

Pride badges
1 Агендерный
Expand Down
2 changes: 2 additions & 0 deletions src/api/v1/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ pub fn router() -> Router<AppState> {
.route("/raw", post(http2ws::raw))
.route("/sub/raw", post(http2ws::sub_raw))
.route("/user/create", post(users::create_user))
.route("/user/:uuid/ban", post(users::ban))
.route("/user/:uuid/unban", post(users::unban))
.route("/avatar/:uuid", put(avatars::upload_avatar).layer(DefaultBodyLimit::disable()))
.route("/avatar/:uuid", delete(avatars::delete_avatar))
}
31 changes: 29 additions & 2 deletions src/api/v1/users.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
use axum::{
extract::State,
extract::{Path, State},
Json
};
use tracing::debug;
use tracing::{debug, info};
use uuid::Uuid;

use crate::{auth::{Token, Userinfo}, ApiResult, AppState};

Expand All @@ -17,4 +18,30 @@ pub(super) async fn create_user(

state.user_manager.insert_user(json.uuid, json);
Ok("ok")
}

pub(super) async fn ban(
Token(token): Token,
State(state): State<AppState>,
Path(uuid): Path<Uuid>
) -> ApiResult<&'static str> {
state.config.read().await.clone().verify_token(&token)?;

info!("Trying ban user: {uuid}");

state.user_manager.ban(&Userinfo { uuid: uuid, banned: true, ..Default::default() });
Ok("ok")
}

pub(super) async fn unban(
Token(token): Token,
State(state): State<AppState>,
Path(uuid): Path<Uuid>
) -> ApiResult<&'static str> {
state.config.read().await.clone().verify_token(&token)?;

info!("Trying unban user: {uuid}");

state.user_manager.unban(&uuid);
Ok("ok")
}

0 comments on commit 494de2b

Please sign in to comment.