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
@@ -46,11 +46,7 @@ pub struct FaqItem {
|
||||
|
||||
impl Default for FaqItem {
|
||||
fn default() -> Self {
|
||||
Self {
|
||||
id: "".into(),
|
||||
question: "".into(),
|
||||
answer: "".into(),
|
||||
}
|
||||
Self { id: "".into(), question: "".into(), answer: "".into() }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -83,23 +79,22 @@ pub struct LandingTheme {
|
||||
impl Default for LandingTheme {
|
||||
fn default() -> Self {
|
||||
Self {
|
||||
background: "#090a0f".into(), surface: "#151620".into(), accent: "#6d6af5".into(),
|
||||
text: "#f1f2f6".into(), muted: "#8b8f9a".into(), max_width: 1140, radius: 14,
|
||||
font: "Inter".into(), footer_text: "Your worlds, one click away.".into(),
|
||||
background: "#090a0f".into(),
|
||||
surface: "#151620".into(),
|
||||
accent: "#6d6af5".into(),
|
||||
text: "#f1f2f6".into(),
|
||||
muted: "#8b8f9a".into(),
|
||||
max_width: 1140,
|
||||
radius: 14,
|
||||
font: "Inter".into(),
|
||||
footer_text: "Your worlds, one click away.".into(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl Default for LandingBlock {
|
||||
fn default() -> Self {
|
||||
Self {
|
||||
id: "".into(),
|
||||
block_type: "hero".into(),
|
||||
enabled: true,
|
||||
title: None,
|
||||
subtitle: None,
|
||||
options: serde_json::json!({}),
|
||||
}
|
||||
Self { id: "".into(), block_type: "hero".into(), enabled: true, title: None, subtitle: None, options: serde_json::json!({}) }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -192,7 +187,9 @@ pub async fn public_landing(State(state): State<AppState>) -> AppResult<Json<Lan
|
||||
}
|
||||
// If server ip is empty, try to populate from first server
|
||||
if cfg.server_ip.is_empty() {
|
||||
if let Ok(Some(first_server)) = sqlx::query_scalar::<_, String>("SELECT address FROM game_servers ORDER BY id ASC LIMIT 1").fetch_optional(&state.db).await {
|
||||
if let Ok(Some(first_server)) =
|
||||
sqlx::query_scalar::<_, String>("SELECT address FROM game_servers ORDER BY id ASC LIMIT 1").fetch_optional(&state.db).await
|
||||
{
|
||||
cfg.server_ip = first_server;
|
||||
}
|
||||
}
|
||||
@@ -203,7 +200,11 @@ pub async fn admin_get_landing(_: AdminUser, State(state): State<AppState>) -> A
|
||||
Ok(Json(get_config(&state).await?))
|
||||
}
|
||||
|
||||
pub async fn admin_put_landing(_: AdminUser, State(state): State<AppState>, Json(cfg): Json<LandingConfig>) -> AppResult<Json<LandingConfig>> {
|
||||
pub async fn admin_put_landing(
|
||||
_: AdminUser,
|
||||
State(state): State<AppState>,
|
||||
Json(cfg): Json<LandingConfig>,
|
||||
) -> AppResult<Json<LandingConfig>> {
|
||||
if cfg.blocks.len() > 100 || cfg.custom_css.len() > 100_000 {
|
||||
return Err(AppError::bad_request("landing page exceeds the editor limits"));
|
||||
}
|
||||
@@ -217,11 +218,7 @@ pub async fn admin_put_landing(_: AdminUser, State(state): State<AppState>, Json
|
||||
Ok(Json(cfg))
|
||||
}
|
||||
|
||||
pub async fn upload_launcher(
|
||||
_: AdminUser,
|
||||
State(state): State<AppState>,
|
||||
mut form: Multipart,
|
||||
) -> AppResult<Json<LandingConfig>> {
|
||||
pub async fn upload_launcher(_: AdminUser, State(state): State<AppState>, mut form: Multipart) -> AppResult<Json<LandingConfig>> {
|
||||
let mut platform = String::from("windows");
|
||||
let mut label = String::from("Windows Installer");
|
||||
let mut filename = String::new();
|
||||
@@ -249,10 +246,8 @@ pub async fn upload_launcher(
|
||||
}
|
||||
|
||||
// Sanitize filename to prevent directory traversal
|
||||
let safe_name = PathBuf::from(&filename)
|
||||
.file_name()
|
||||
.map(|s| s.to_string_lossy().to_string())
|
||||
.unwrap_or_else(|| format!("launcher-{platform}"));
|
||||
let safe_name =
|
||||
PathBuf::from(&filename).file_name().map(|s| s.to_string_lossy().to_string()).unwrap_or_else(|| format!("launcher-{platform}"));
|
||||
|
||||
let dir = state.cfg.downloads_dir();
|
||||
tokio::fs::create_dir_all(&dir).await?;
|
||||
@@ -265,14 +260,7 @@ pub async fn upload_launcher(
|
||||
let mut cfg = get_config(&state).await?;
|
||||
let ts = chrono::Utc::now().to_rfc3339_opts(chrono::SecondsFormat::Secs, true);
|
||||
|
||||
let download_entry = HostedDownload {
|
||||
platform: platform.clone(),
|
||||
label,
|
||||
filename: safe_name,
|
||||
file_url,
|
||||
size,
|
||||
uploaded_at: ts,
|
||||
};
|
||||
let download_entry = HostedDownload { platform: platform.clone(), label, filename: safe_name, file_url, size, uploaded_at: ts };
|
||||
|
||||
if let Some(idx) = cfg.hosted_downloads.iter().position(|d| d.platform == platform) {
|
||||
cfg.hosted_downloads[idx] = download_entry;
|
||||
@@ -284,10 +272,7 @@ pub async fn upload_launcher(
|
||||
Ok(Json(cfg))
|
||||
}
|
||||
|
||||
pub async fn download_launcher(
|
||||
State(state): State<AppState>,
|
||||
Path(platform): Path<String>,
|
||||
) -> AppResult<Response> {
|
||||
pub async fn download_launcher(State(state): State<AppState>, Path(platform): Path<String>) -> AppResult<Response> {
|
||||
let cfg = get_config(&state).await?;
|
||||
let entry = cfg.hosted_downloads.iter().find(|d| d.platform == platform || d.platform == "all");
|
||||
|
||||
@@ -307,13 +292,7 @@ pub async fn download_launcher(
|
||||
} else {
|
||||
"application/octet-stream"
|
||||
};
|
||||
return Ok((
|
||||
[
|
||||
(header::CONTENT_TYPE, mime),
|
||||
(header::CONTENT_DISPOSITION, cd.as_str()),
|
||||
],
|
||||
Body::from(bytes),
|
||||
).into_response());
|
||||
return Ok(([(header::CONTENT_TYPE, mime), (header::CONTENT_DISPOSITION, cd.as_str())], Body::from(bytes)).into_response());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user