fix: ajout DefaultBodyLimit 50MB pour accepter les photos volumineuses (>2MB)

This commit is contained in:
2026-06-25 15:52:15 -04:00
parent 62e63e441a
commit 42eff296e4
4 changed files with 11 additions and 9 deletions
+3 -3
View File
@@ -3,7 +3,7 @@
<head> <head>
<meta charset="UTF-8"> <meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Changelog — imagod-web v0.2.0+build.26-4917dad-dirty</title> <title>Changelog — imagod-web v0.2.0+build.27-62e63e4-dirty</title>
<link rel="icon" href="data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'><text y='.9em' font-size='90'>🖼️</text></svg>"> <link rel="icon" href="data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'><text y='.9em' font-size='90'>🖼️</text></svg>">
<style> <style>
* { margin:0; padding:0; box-sizing:border-box; } * { margin:0; padding:0; box-sizing:border-box; }
@@ -37,7 +37,7 @@ footer { text-align:center; color:#484f58; font-size:0.8rem; padding:2rem; }
</head> </head>
<body> <body>
<header> <header>
<h1>📋 imagod-web <span class="version-badge">v0.2.0+build.26-4917dad-dirty</span></h1> <h1>📋 imagod-web <span class="version-badge">v0.2.0+build.27-62e63e4-dirty</span></h1>
<nav> <nav>
<a href="/">🖼️ Galerie</a> <a href="/">🖼️ Galerie</a>
<a href="/changelog" class="active">📋 Changelog</a> <a href="/changelog" class="active">📋 Changelog</a>
@@ -107,6 +107,6 @@ footer { text-align:center; color:#484f58; font-size:0.8rem; padding:2rem; }
<h2>Légende des tags</h2> <h2>Légende des tags</h2>
</main> </main>
<footer>imagod-web v0.2.0+build.26-4917dad-dirty — <a href="https://git.dracodev.net/Projets/imagod-web">Gitea</a></footer> <footer>imagod-web v0.2.0+build.27-62e63e4-dirty — <a href="https://git.dracodev.net/Projets/imagod-web">Gitea</a></footer>
</body> </body>
</html> </html>
+3 -3
View File
@@ -3,7 +3,7 @@
<head> <head>
<meta charset="UTF-8"> <meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Aide & Roadmap — imagod-web v0.2.0+build.26-4917dad-dirty</title> <title>Aide & Roadmap — imagod-web v0.2.0+build.27-62e63e4-dirty</title>
<link rel="icon" href="data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'><text y='.9em' font-size='90'>🖼️</text></svg>"> <link rel="icon" href="data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'><text y='.9em' font-size='90'>🖼️</text></svg>">
<style> <style>
* { margin:0; padding:0; box-sizing:border-box; } * { margin:0; padding:0; box-sizing:border-box; }
@@ -37,7 +37,7 @@ footer { text-align:center; color:#484f58; font-size:0.8rem; padding:2rem; }
</head> </head>
<body> <body>
<header> <header>
<h1>❓ imagod-web <span class="version-badge">v0.2.0+build.26-4917dad-dirty</span></h1> <h1>❓ imagod-web <span class="version-badge">v0.2.0+build.27-62e63e4-dirty</span></h1>
<nav> <nav>
<a href="/">🖼️ Galerie</a> <a href="/">🖼️ Galerie</a>
<a href="/changelog">📋 Changelog</a> <a href="/changelog">📋 Changelog</a>
@@ -169,6 +169,6 @@ footer { text-align:center; color:#484f58; font-size:0.8rem; padding:2rem; }
<p>5. <strong>Corriger le backend Imago</strong> (thumbnails, upload, stockage)</p> <p>5. <strong>Corriger le backend Imago</strong> (thumbnails, upload, stockage)</p>
</main> </main>
<footer>imagod-web v0.2.0+build.26-4917dad-dirty — <a href="https://git.dracodev.net/Projets/imagod-web">Gitea</a></footer> <footer>imagod-web v0.2.0+build.27-62e63e4-dirty — <a href="https://git.dracodev.net/Projets/imagod-web">Gitea</a></footer>
</body> </body>
</html> </html>
+1 -1
View File
@@ -465,7 +465,7 @@
<button class="btn" id="clear-btn" style="display:none">✕</button> <button class="btn" id="clear-btn" style="display:none">✕</button>
</div> </div>
<button class="btn accent" id="header-upload-btn" onclick="document.getElementById('drop-zone').scrollIntoView({behavior:'smooth'}); document.getElementById('file-input').click()">📤 Upload</button> <button class="btn accent" id="header-upload-btn" onclick="document.getElementById('drop-zone').scrollIntoView({behavior:'smooth'}); document.getElementById('file-input').click()">📤 Upload</button>
<span class="version-badge" id="version-badge">v0.2.0+build.26-4917dad-dirty</span> <span class="version-badge" id="version-badge">v0.2.0+build.27-62e63e4-dirty</span>
</div> </div>
<!-- ─── Navigation ─── --> <!-- ─── Navigation ─── -->
+4 -2
View File
@@ -6,6 +6,7 @@ pub mod routes;
pub mod ws; pub mod ws;
use axum::Router; use axum::Router;
use axum::extract::DefaultBodyLimit;
use rust_embed::RustEmbed; use rust_embed::RustEmbed;
use std::net::SocketAddr; use std::net::SocketAddr;
use std::sync::Arc; use std::sync::Arc;
@@ -55,12 +56,13 @@ pub async fn serve_with_config(host: &str, port: u16, config: &Config) -> anyhow
in_flight: Mutex::new(HashSet::new()), in_flight: Mutex::new(HashSet::new()),
}; };
// Router principal — avec CORS permissif pour les requêtes cross-origin et preflight // Router principal — avec CORS permissif et limite body 50MB
let app = Router::new() let app = Router::new()
.merge(routes::api_routes(state)) .merge(routes::api_routes(state))
.route("/ws", axum::routing::get(ws::ws_handler).with_state(ws_hub)) .route("/ws", axum::routing::get(ws::ws_handler).with_state(ws_hub))
.fallback(serve_static) .fallback(serve_static)
.layer(CorsLayer::permissive()); .layer(CorsLayer::permissive())
.layer(DefaultBodyLimit::max(50 * 1024 * 1024)); // 50 MB pour les grosses photos
let addr: SocketAddr = format!("{}:{}", host, port).parse()?; let addr: SocketAddr = format!("{}:{}", host, port).parse()?;
tracing::info!("Dashboard web démarré sur http://{}", addr); tracing::info!("Dashboard web démarré sur http://{}", addr);