Fix Rust formatting
Server integrations / Paper and protocol tests (push) Failing after 20s
Server integrations / fabric / 1.20.1 (push) Failing after 11s
Server integrations / fabric / 1.21.1 (push) Failing after 14s
Server integrations / fabric / 26.1.2 (push) Failing after 17s
Server integrations / fabric / 26.2 (push) Failing after 12s
Server integrations / fabric / 26.3 (push) Failing after 6s
Server integrations / forge / 1.20.1 (push) Failing after 6s
Server integrations / forge / 1.21.1 (push) Failing after 8s
Server integrations / forge / 26.1.2 (push) Failing after 8s
Server integrations / forge / 26.2 (push) Failing after 8s
Server integrations / forge / 26.3 (push) Failing after 7s
CI / Web UIs (type-check + build) (panel/web) (push) Canceled after 0s
CI / Launcher (Windows build check) (push) Canceled after 2m53s
CI / Real installs (Mojang, Fabric, Quilt, Forge, NeoForge) (push) Canceled after 0s
CI / Docker image builds (push) Canceled after 0s
CI / Rust (fmt, clippy, tests) (push) Canceled after 1m22s
CI / Web UIs (type-check + build) (launcher) (push) Canceled after 1m27s
Server integrations / Paper and protocol tests (push) Failing after 20s
Server integrations / fabric / 1.20.1 (push) Failing after 11s
Server integrations / fabric / 1.21.1 (push) Failing after 14s
Server integrations / fabric / 26.1.2 (push) Failing after 17s
Server integrations / fabric / 26.2 (push) Failing after 12s
Server integrations / fabric / 26.3 (push) Failing after 6s
Server integrations / forge / 1.20.1 (push) Failing after 6s
Server integrations / forge / 1.21.1 (push) Failing after 8s
Server integrations / forge / 26.1.2 (push) Failing after 8s
Server integrations / forge / 26.2 (push) Failing after 8s
Server integrations / forge / 26.3 (push) Failing after 7s
CI / Web UIs (type-check + build) (panel/web) (push) Canceled after 0s
CI / Launcher (Windows build check) (push) Canceled after 2m53s
CI / Real installs (Mojang, Fabric, Quilt, Forge, NeoForge) (push) Canceled after 0s
CI / Docker image builds (push) Canceled after 0s
CI / Rust (fmt, clippy, tests) (push) Canceled after 1m22s
CI / Web UIs (type-check + build) (launcher) (push) Canceled after 1m27s
This commit is contained in:
1 parent
ce49447b6e
commit
60edc99780
58 files changed
+3533
-1375
No files matched your search
@@ -155,8 +155,7 @@ pub fn set_instance_fov(state: State<'_, AppState>, instance_id: String, fov: f6
|
||||
if !(-1.0..=1.0).contains(&fov) || !fov.is_finite() {
|
||||
return Err("FOV must be between 30 and 110 degrees".into());
|
||||
}
|
||||
state.settings.write().unwrap().instance_game_options.entry(instance_id).or_default()
|
||||
.insert("fov".into(), format!("{fov:.3}"));
|
||||
state.settings.write().unwrap().instance_game_options.entry(instance_id).or_default().insert("fov".into(), format!("{fov:.3}"));
|
||||
state.save_settings().map_err(aerr)
|
||||
}
|
||||
|
||||
@@ -763,14 +762,18 @@ async fn guild_response_error(resp: reqwest::Response, fallback: &str) -> String
|
||||
pub async fn request_guild_join(state: State<'_, AppState>, guild_id: String, message: String) -> Res<()> {
|
||||
let req = account_api(&state, reqwest::Method::POST, &format!("/guilds/{guild_id}/requests")).await?;
|
||||
let resp = req.json(&serde_json::json!({"message": message})).send().await.map_err(err)?;
|
||||
if !resp.status().is_success() { return Err(guild_response_error(resp, "could not request to join guild").await); }
|
||||
if !resp.status().is_success() {
|
||||
return Err(guild_response_error(resp, "could not request to join guild").await);
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
pub async fn get_guild_join_requests(state: State<'_, AppState>, guild_id: String) -> Res<serde_json::Value> {
|
||||
let resp = account_api(&state, reqwest::Method::GET, &format!("/guilds/{guild_id}/requests")).await?.send().await.map_err(err)?;
|
||||
if !resp.status().is_success() { return Err(guild_response_error(resp, "could not load guild requests").await); }
|
||||
if !resp.status().is_success() {
|
||||
return Err(guild_response_error(resp, "could not load guild requests").await);
|
||||
}
|
||||
resp.json().await.map_err(err)
|
||||
}
|
||||
|
||||
@@ -778,44 +781,73 @@ pub async fn get_guild_join_requests(state: State<'_, AppState>, guild_id: Strin
|
||||
pub async fn respond_guild_join_request(state: State<'_, AppState>, guild_id: String, uuid: String, accept: bool) -> Res<()> {
|
||||
let req = account_api(&state, reqwest::Method::POST, &format!("/guilds/{guild_id}/requests/{uuid}/respond")).await?;
|
||||
let resp = req.json(&serde_json::json!({"accept": accept})).send().await.map_err(err)?;
|
||||
if !resp.status().is_success() { return Err(guild_response_error(resp, "could not review guild request").await); }
|
||||
if !resp.status().is_success() {
|
||||
return Err(guild_response_error(resp, "could not review guild request").await);
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
pub async fn get_guild_roles(state: State<'_, AppState>, guild_id: String) -> Res<serde_json::Value> {
|
||||
let resp = account_api(&state, reqwest::Method::GET, &format!("/guilds/{guild_id}/roles")).await?.send().await.map_err(err)?;
|
||||
if !resp.status().is_success() { return Err(guild_response_error(resp, "could not load guild roles").await); }
|
||||
if !resp.status().is_success() {
|
||||
return Err(guild_response_error(resp, "could not load guild roles").await);
|
||||
}
|
||||
resp.json().await.map_err(err)
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
pub async fn create_guild_role(state: State<'_, AppState>, guild_id: String, role: serde_json::Value) -> Res<()> {
|
||||
let resp = account_api(&state, reqwest::Method::POST, &format!("/guilds/{guild_id}/roles")).await?.json(&role).send().await.map_err(err)?;
|
||||
if !resp.status().is_success() { return Err(guild_response_error(resp, "could not create guild role").await); }
|
||||
let resp =
|
||||
account_api(&state, reqwest::Method::POST, &format!("/guilds/{guild_id}/roles")).await?.json(&role).send().await.map_err(err)?;
|
||||
if !resp.status().is_success() {
|
||||
return Err(guild_response_error(resp, "could not create guild role").await);
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
pub async fn assign_guild_role(state: State<'_, AppState>, guild_id: String, uuid: String, role: String) -> Res<()> {
|
||||
let resp = account_api(&state, reqwest::Method::PUT, &format!("/guilds/{guild_id}/members/{uuid}/role")).await?.json(&serde_json::json!({"role":role})).send().await.map_err(err)?;
|
||||
if !resp.status().is_success() { return Err(guild_response_error(resp, "could not assign guild role").await); }
|
||||
let resp = account_api(&state, reqwest::Method::PUT, &format!("/guilds/{guild_id}/members/{uuid}/role"))
|
||||
.await?
|
||||
.json(&serde_json::json!({"role":role}))
|
||||
.send()
|
||||
.await
|
||||
.map_err(err)?;
|
||||
if !resp.status().is_success() {
|
||||
return Err(guild_response_error(resp, "could not assign guild role").await);
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
pub async fn delete_guild_role(state: State<'_, AppState>, guild_id: String, role_id: i64) -> Res<()> {
|
||||
let resp = account_api(&state, reqwest::Method::DELETE, &format!("/guilds/{guild_id}/roles/{role_id}")).await?.send().await.map_err(err)?;
|
||||
if !resp.status().is_success() { return Err(guild_response_error(resp, "could not delete guild role").await); }
|
||||
let resp =
|
||||
account_api(&state, reqwest::Method::DELETE, &format!("/guilds/{guild_id}/roles/{role_id}")).await?.send().await.map_err(err)?;
|
||||
if !resp.status().is_success() {
|
||||
return Err(guild_response_error(resp, "could not delete guild role").await);
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
pub async fn update_guild(state: State<'_, AppState>, guild_id: String, description: String, motd: String, icon_url: String, banner_url: String) -> Res<()> {
|
||||
let resp = account_api(&state, reqwest::Method::PUT, &format!("/guilds/{guild_id}")).await?
|
||||
pub async fn update_guild(
|
||||
state: State<'_, AppState>,
|
||||
guild_id: String,
|
||||
description: String,
|
||||
motd: String,
|
||||
icon_url: String,
|
||||
banner_url: String,
|
||||
) -> Res<()> {
|
||||
let resp = account_api(&state, reqwest::Method::PUT, &format!("/guilds/{guild_id}"))
|
||||
.await?
|
||||
.json(&serde_json::json!({"description":description,"motd":motd,"icon_url":icon_url,"banner_url":banner_url}))
|
||||
.send().await.map_err(err)?;
|
||||
if !resp.status().is_success() { return Err(guild_response_error(resp, "could not update guild").await); }
|
||||
.send()
|
||||
.await
|
||||
.map_err(err)?;
|
||||
if !resp.status().is_success() {
|
||||
return Err(guild_response_error(resp, "could not update guild").await);
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
||||
@@ -949,7 +981,13 @@ pub async fn get_guild_wallet(state: State<'_, AppState>, guild_id: String, serv
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
pub async fn transfer_guild_wallet(state: State<'_, AppState>, guild_id: String, server_id: i64, amount: f64, withdraw: bool) -> Res<serde_json::Value> {
|
||||
pub async fn transfer_guild_wallet(
|
||||
state: State<'_, AppState>,
|
||||
guild_id: String,
|
||||
server_id: i64,
|
||||
amount: f64,
|
||||
withdraw: bool,
|
||||
) -> Res<serde_json::Value> {
|
||||
let action = if withdraw { "withdraw" } else { "deposit" };
|
||||
let req = account_api(&state, reqwest::Method::POST, &format!("/guilds/{guild_id}/wallet/{action}")).await?;
|
||||
let resp = req.json(&serde_json::json!({"server_id":server_id,"amount":amount})).send().await.map_err(err)?;
|
||||
@@ -1203,7 +1241,6 @@ pub async fn like_user_post(state: State<'_, AppState>, post_id: i64) -> Res<boo
|
||||
Ok(body["liked"].as_bool().unwrap_or(false))
|
||||
}
|
||||
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
// Map actions and guild invitations
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
Reference in new issue
Block a user