From a4b5b06f04c9345e7fdabd6b7afba11fe8c72724 Mon Sep 17 00:00:00 2001 From: enzo Date: Sat, 21 Mar 2026 17:28:55 +0100 Subject: [PATCH] fix: CSS reset, settings API, modules champs, proxmox token MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - CSS: ajout reset (box-sizing, margin, font-family, body background) - Settings: save par PUT /api/settings/{key} (pas bulk), un appel par clé - Settings: proxmox_token champ unique (format user@realm!id=secret) - Modules: is_enabled/is_core (champs backend réels, pas enabled/core) - Proxmox: supprime bouton reboot (route inexistante) Co-Authored-By: Claude Sonnet 4.6 --- frontend/css/neu.css | 26 ++++++++++++++++++++++++++ frontend/js/app.js | 31 +++++++++++++++++++------------ frontend/modules.html | 12 ++++++------ frontend/proxmox.html | 4 ---- frontend/settings.html | 15 +++++++-------- 5 files changed, 58 insertions(+), 30 deletions(-) diff --git a/frontend/css/neu.css b/frontend/css/neu.css index 93673b7..c367e86 100644 --- a/frontend/css/neu.css +++ b/frontend/css/neu.css @@ -4,6 +4,32 @@ Utilisé par tous les composants et les modules. ============================================================================= */ +/* ── Reset / Base ───────────────────────────────────────────────────────────── */ +*, *::before, *::after { + box-sizing: border-box; +} + +html, body { + margin: 0; + padding: 0; + font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Inter', sans-serif; + font-size: 14px; + line-height: 1.5; + -webkit-font-smoothing: antialiased; +} + +body { + min-height: 100vh; + background-color: var(--neu-bg); + color: var(--neu-text); +} + +h1, h2, h3, h4, h5, h6 { margin: 0; } +p { margin: 0; } +a { color: inherit; } +button { font-family: inherit; font-size: inherit; } +input, select, textarea { font-family: inherit; font-size: inherit; } + /* ── Variables CSS (surchargées par dark.css et light.css) ─────────────────── */ :root { /* Couleurs de base */ diff --git a/frontend/js/app.js b/frontend/js/app.js index 408bc3c..b65f715 100644 --- a/frontend/js/app.js +++ b/frontend/js/app.js @@ -544,10 +544,9 @@ document.addEventListener('alpine:init', () => { default_lang: 'fr', ssh_host: '', ssh_username: '', - ssh_password: '', + ssh_password: '', // chiffré, laisser vide = pas de changement proxmox_url: '', - proxmox_token_id: '', - proxmox_token_secret: '', + proxmox_token: '', // chiffré, format: user@realm!tokenid=secret }, async init() { @@ -572,13 +571,20 @@ document.addEventListener('alpine:init', () => { this.saved = false this.error = '' try { - const res = await apiFetch('/api/settings', { - method: 'PUT', - body: JSON.stringify(this.settings), - }) - if (!res.ok) { - const d = await res.json().catch(() => ({})) - throw new Error(d.error || 'Erreur sauvegarde') + // Backend: PUT /api/settings/{key} avec { value: "..." } — un appel par clé + const keys = Object.keys(this.settings) + for (const key of keys) { + const val = this.settings[key] + // Ignorer les champs vides pour les secrets (ne pas écraser l'existant) + if (val === '' && (key === 'ssh_password' || key === 'proxmox_token')) continue + const res = await apiFetch(`/api/settings/${key}`, { + method: 'PUT', + body: JSON.stringify({ value: val }), + }) + if (!res.ok) { + const d = await res.json().catch(() => ({})) + throw new Error(d.error || `Erreur sauvegarde de ${key}`) + } } this.saved = true setTimeout(() => { this.saved = false }, 3000) @@ -617,10 +623,11 @@ document.addEventListener('alpine:init', () => { async toggle(mod) { this.toggling[mod.id] = true try { - const action = mod.enabled ? 'disable' : 'enable' + // Backend: is_enabled (pas enabled) + const action = mod.is_enabled ? 'disable' : 'enable' const res = await apiFetch(`/api/modules/${mod.id}/${action}`, { method: 'POST' }) if (res.ok) { - mod.enabled = !mod.enabled + mod.is_enabled = !mod.is_enabled } } catch(e) { console.error(e) diff --git a/frontend/modules.html b/frontend/modules.html index adeaddc..894972e 100644 --- a/frontend/modules.html +++ b/frontend/modules.html @@ -55,7 +55,7 @@
diff --git a/frontend/settings.html b/frontend/settings.html index b58566e..d1f7054 100644 --- a/frontend/settings.html +++ b/frontend/settings.html @@ -110,14 +110,13 @@
-
- - -
-
- - +
+ + + + Exemple : enzo@pam!panel=xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx +