Add launcher preferences and modular landing studio [skip ci]

This commit is contained in:
SCOPEDD committed 2026-09-30 06:48:03 -04:00
1 parent 454620f21e
commit 6deff62a3a
25 files changed
+822 -682

No files matched your search

+35
View File
@@ -66,6 +66,30 @@ pub struct LandingBlock {
pub options: serde_json::Value,
}
#[derive(Debug, Clone, Serialize, Deserialize, PartialEq)]
#[serde(default)]
pub struct LandingTheme {
pub background: String,
pub surface: String,
pub accent: String,
pub text: String,
pub muted: String,
pub max_width: u16,
pub radius: u8,
pub font: String,
pub footer_text: String,
}
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(),
}
}
}
impl Default for LandingBlock {
fn default() -> Self {
Self {
@@ -98,6 +122,7 @@ pub struct LandingConfig {
pub blocks: Vec<LandingBlock>,
pub faqs: Vec<FaqItem>,
pub custom_css: String,
pub theme: LandingTheme,
}
impl Default for LandingConfig {
@@ -145,6 +170,7 @@ impl Default for LandingConfig {
},
],
custom_css: "".into(),
theme: LandingTheme::default(),
}
}
}
@@ -178,6 +204,15 @@ pub async fn admin_get_landing(_: AdminUser, State(state): State<AppState>) -> A
}
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"));
}
let mut ids = std::collections::HashSet::new();
for block in &cfg.blocks {
if block.id.is_empty() || !ids.insert(&block.id) {
return Err(AppError::bad_request("landing section IDs must be unique"));
}
}
store::kv_set(&state, "landing_page", &cfg).await?;
Ok(Json(cfg))
}