fix blog without image
CI / frontend (push) Failing after 1s
CI / backend (push) Failing after 1s

This commit is contained in:
2026-05-21 04:09:02 +02:00
parent 4fae8b5e47
commit 37f88f5ad1
5 changed files with 37 additions and 4 deletions
+21 -2
View File
@@ -20,7 +20,7 @@ use tower_http::{
use tracing::{error, info, warn};
use crate::handlers::contact::RATE_LIMIT_WINDOW_MS;
use crate::models::{ImageDim, PostInfo};
use crate::models::{ImageDim, PostInfo, SiteMode};
pub struct CachedPost {
pub info: PostInfo,
@@ -31,6 +31,7 @@ pub struct AppState {
pub admin_token: String,
pub data_dir: PathBuf,
pub cookie_secure: bool,
pub site_mode: SiteMode,
pub post_lock: Mutex<()>,
pub posts_cache: RwLock<Vec<CachedPost>>,
pub image_dims_cache: RwLock<HashMap<String, ImageDim>>,
@@ -55,8 +56,25 @@ async fn main() {
let cookie_secure = env::var("COOKIE_SECURE")
.map(|v| v != "false" && v != "0")
.unwrap_or(true);
let site_mode = env::var("SITE_MODE")
.map(|v| {
if v.to_lowercase() == "blog" {
SiteMode::Blog
} else {
SiteMode::Atelier
}
})
.unwrap_or(SiteMode::Atelier);
info!("Initializing backend with data dir: {:?}", data_dir);
info!(
"Initializing backend with data dir: {:?}, mode: {:?}",
data_dir,
if site_mode == SiteMode::Blog {
"blog"
} else {
"atelier"
}
);
let posts_dir = data_dir.join("posts");
let uploads_dir = data_dir.join("uploads");
@@ -71,6 +89,7 @@ async fn main() {
admin_token,
data_dir,
cookie_secure,
site_mode,
post_lock: Mutex::new(()),
posts_cache: RwLock::new(Vec::new()),
image_dims_cache: RwLock::new(HashMap::new()),