feat: route /api/ping + message d'erreur affiche l'URL cible

- Ajout route GET /api/ping pour diagnostic connectivité rapide
- Le message 'serveur injoignable' affiche maintenant l'URL exacte tentée
- Aide à identifier les problèmes de proxy/iframe (mauvaise origine)
This commit is contained in:
2026-06-25 15:28:30 -04:00
parent 41fcb238b1
commit 4917dad351
4 changed files with 15 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.24-0309359-dirty</title> <title>Changelog — imagod-web v0.2.0+build.25-41fcb23-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.24-0309359-dirty</span></h1> <h1>📋 imagod-web <span class="version-badge">v0.2.0+build.25-41fcb23-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.24-0309359-dirty — <a href="https://git.dracodev.net/Projets/imagod-web">Gitea</a></footer> <footer>imagod-web v0.2.0+build.25-41fcb23-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.24-0309359-dirty</title> <title>Aide & Roadmap — imagod-web v0.2.0+build.25-41fcb23-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.24-0309359-dirty</span></h1> <h1>❓ imagod-web <span class="version-badge">v0.2.0+build.25-41fcb23-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.24-0309359-dirty — <a href="https://git.dracodev.net/Projets/imagod-web">Gitea</a></footer> <footer>imagod-web v0.2.0+build.25-41fcb23-dirty — <a href="https://git.dracodev.net/Projets/imagod-web">Gitea</a></footer>
</body> </body>
</html> </html>
+3 -3
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.24-0309359-dirty</span> <span class="version-badge" id="version-badge">v0.2.0+build.25-41fcb23-dirty</span>
</div> </div>
<!-- ─── Navigation ─── --> <!-- ─── Navigation ─── -->
@@ -960,10 +960,10 @@ async function uploadFiles(files) {
} }
} catch(e) { } catch(e) {
errorCount++; errorCount++;
// Distinguer les types d'erreurs réseau
const msg = e.message || 'Erreur inconnue'; const msg = e.message || 'Erreur inconnue';
if (msg.includes('Failed to fetch') || msg.includes('NetworkError')) { if (msg.includes('Failed to fetch') || msg.includes('NetworkError')) {
showToast(`${file.name} : serveur injoignable — vérifiez la connexion`, 'error'); const apiUrl = window.location.origin + '/api/upload';
showToast(`${file.name} : serveur injoignable — essayez ${apiUrl}`, 'error');
} else { } else {
showToast(`${file.name} : ${msg}`, 'error'); showToast(`${file.name} : ${msg}`, 'error');
} }
+6
View File
@@ -100,6 +100,7 @@ pub fn api_routes(state: AppState) -> Router {
let state = Arc::new(state); let state = Arc::new(state);
Router::new() Router::new()
.route("/api/health", get(health_check)) .route("/api/health", get(health_check))
.route("/api/ping", get(ping))
.route("/api/auth/validate", post(validate_api_key)) .route("/api/auth/validate", post(validate_api_key))
.route("/api/upload", post(upload_image)) .route("/api/upload", post(upload_image))
.route("/api/images", get(list_images)) .route("/api/images", get(list_images))
@@ -119,6 +120,11 @@ async fn health_check() -> &'static str {
"OK" "OK"
} }
/// Test de connectivité minimal
async fn ping() -> Json<serde_json::Value> {
Json(serde_json::json!({"pong": true, "timestamp": chrono::Utc::now().to_rfc3339()}))
}
/// Retourne la version de l'application et des infos utiles /// Retourne la version de l'application et des infos utiles
async fn version() -> Json<serde_json::Value> { async fn version() -> Json<serde_json::Value> {
Json(serde_json::json!({ Json(serde_json::json!({