HifiPlanet-Website/hifi/assets/UpdateSettings-DgFhzAXU.js
Maaxxs 54928d1411 Add package badges/visibility and a download area, speed up the site
Customer feedback round (4 items):

- Packages: one-click "Sichtbar/Ausgeblendet" toggle per package (saved
  immediately). Hidden packages disappear from the model page; the tier
  look of the remaining cards is ranked across all packages so it stays
  stable.
- Packages: badge per card (Empfohlen, Am beliebtesten, Tipp, Coming soon
  or custom text) plus an optional video link shown as "Zum Video". Legacy
  is_featured maps to "Empfohlen".
- New download area (/downloads + Admin -> Downloads): upload with
  progress, inline audio player, allow-listed file types, optional access
  password, new permission downloads.manage. Files live in
  api/uploads/downloads/ (gitignored, created at runtime).
- Performance:
  - SetupGate no longer refetches and remounts the whole app on every
    navigation.
  - Page loader waits only for pending API calls and above-the-fold images
    (fixes an 8 s hang on /leistungen caused by lazy images inside the
    hidden container).
  - Admin pages lazy-loaded; icon library moved out of the main bundle
    (initial JS 2.2 MB -> 0.48 MB).
  - Background video loads only near the viewport and was re-encoded to
    720p (32 MB -> 8.5 MB).
  - Visitors without a session cookie get no PHP session, so their parallel
    API requests no longer queue on the session lock.
  - index.html is served with Cache-Control: no-cache so browsers don't
    keep a stale build after deploys.
- Fonts (Barlow, Barlow Condensed, Michroma) are self-hosted instead of
  loaded from Google Fonts; the default privacy policy mentions this, lists
  all local storage uses and uses the new TDDDG name.
- A code update that adds a table no longer sends the site into the setup
  wizard while an admin exists.

Run "Datenbankstruktur aktualisieren" after deploying (new package
columns, downloads table, app_settings.downloads_password).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-26 23:15:48 +02:00

1 line
5.2 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import{r as l,j as e,a as u}from"./index-CA8nTsDv.js";const D={download:"Herunterladen",extract:"Entpacken",backup:"Sichern",apply:"Installieren"};function w(a){return a?a.slice(0,7):"–"}function L(a){return a?new Date(a).toLocaleString("de-DE"):"–"}function H(){const[a,v]=l.useState(null),[n,_]=l.useState(null),[E,g]=l.useState(!0),[h,j]=l.useState(""),[c,f]=l.useState(!1),[d,i]=l.useState({download:null,extract:null,backup:null,apply:null}),[p,k]=l.useState(""),[x,N]=l.useState(null),m=()=>{g(!0),j(""),Promise.all([u.get("/settings/update-status"),u.get("/settings/update-check")]).then(([t,s])=>{v(t),_(s)}).catch(t=>j(t.message)).finally(()=>g(!1))};l.useEffect(m,[]);const P=async()=>{f(!0),k(""),N(null),i({download:"busy",extract:null,backup:null,apply:null});try{const s=(await u.post("/settings/update-download",{})).run_id;i(r=>({...r,download:"done",extract:"busy"})),await u.post("/settings/update-extract",{run_id:s}),i(r=>({...r,extract:"done",backup:"busy"})),await u.post("/settings/update-backup",{}),i(r=>({...r,backup:"done",apply:"busy"}));const o=await u.post("/settings/update-apply",{run_id:s});i(r=>({...r,apply:"done"})),N(o.log||[]),m()}catch(t){i(s=>{const o=Object.keys(s).find(r=>s[r]==="busy");return o?{...s,[o]:"error"}:s}),k(t.message)}finally{f(!1)}};if(E)return e.jsx("p",{className:"text-sm text-neutral-400",children:"Lädt…"});const b=(a==null?void 0:a.capabilities)||{},y=b.zip?b.http_client?b.writable?null:"Das Website-Verzeichnis ist für PHP nicht beschreibbar - bitte Dateiberechtigungen prüfen.":"Diese Funktion benötigt ausgehende HTTPS-Verbindungen (curl oder allow_url_fopen), die auf diesem Server aktuell nicht verfügbar sind.":'Diese Funktion benötigt die PHP-Erweiterung "zip", die auf diesem Server aktuell nicht aktiviert ist. Bitte beim Hoster aktivieren lassen.',S=n==null?void 0:n.update_available;return e.jsx("div",{className:"max-w-2xl space-y-6",children:e.jsxs("section",{className:"rounded-xl border border-neutral-200 bg-white p-6 dark:border-neutral-800 dark:bg-neutral-900",children:[e.jsx("h2",{className:"mb-1 font-semibold text-neutral-900 dark:text-white",children:"Updates aus Git"}),e.jsx("p",{className:"mb-4 text-sm text-neutral-500 dark:text-neutral-400",children:'Zieht den aktuellen Stand direkt vom Code-Repository und installiert ihn hier - ohne manuellen FTP-Upload. Passiert nur, wenn du unten aktiv auf "Update installieren" klickst, nie automatisch im Hintergrund.'}),h&&e.jsx("p",{className:"mb-3 text-sm text-red-600",children:h}),y?e.jsx("p",{className:"rounded-md bg-amber-50 p-3 text-sm text-amber-800 dark:bg-amber-900/20 dark:text-amber-300",children:y}):e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"mb-4 grid grid-cols-2 gap-3 text-sm",children:[e.jsxs("div",{className:"rounded-md bg-neutral-50 p-3 dark:bg-neutral-800/50",children:[e.jsx("p",{className:"text-xs uppercase tracking-wide text-neutral-400",children:"Installiert"}),e.jsx("p",{className:"font-mono text-neutral-800 dark:text-neutral-100",children:w(a==null?void 0:a.deployed_sha)}),e.jsx("p",{className:"text-xs text-neutral-400",children:L(a==null?void 0:a.deployed_at)})]}),e.jsxs("div",{className:"rounded-md bg-neutral-50 p-3 dark:bg-neutral-800/50",children:[e.jsx("p",{className:"text-xs uppercase tracking-wide text-neutral-400",children:"Neuester Stand"}),e.jsx("p",{className:"font-mono text-neutral-800 dark:text-neutral-100",children:w(n==null?void 0:n.latest_sha)}),(n==null?void 0:n.latest_message)&&e.jsx("p",{className:"truncate text-xs text-neutral-400",title:n.latest_message,children:n.latest_message})]})]}),S?e.jsx("p",{className:"mb-3 text-sm font-medium text-brand-600 dark:text-brand-400",children:"Update verfügbar."}):e.jsx("p",{className:"mb-3 text-sm text-neutral-500 dark:text-neutral-400",children:"Bereits auf dem neuesten Stand."}),e.jsxs("div",{className:"mb-3 flex gap-2",children:[e.jsx("button",{type:"button",onClick:m,disabled:c,className:"rounded-md border border-neutral-300 px-4 py-2 text-sm font-medium hover:bg-neutral-50 disabled:opacity-50 dark:border-neutral-700 dark:hover:bg-neutral-800",children:"Nach Updates suchen"}),e.jsx("button",{type:"button",onClick:P,disabled:c||!S,className:"rounded-md bg-brand-500 px-4 py-2 text-sm font-semibold text-white hover:bg-brand-600 disabled:opacity-50",children:c?"Installiere…":"Update installieren"})]}),(c||p)&&e.jsx("ul",{className:"mb-3 space-y-1 text-sm",children:Object.entries(D).map(([t,s])=>e.jsxs("li",{className:"flex items-center gap-2",children:[e.jsx("span",{className:d[t]==="done"?"text-green-600 dark:text-green-400":d[t]==="error"?"text-red-600":d[t]==="busy"?"text-brand-600 dark:text-brand-400":"text-neutral-300 dark:text-neutral-600",children:d[t]==="done"?"✓":d[t]==="error"?"✕":d[t]==="busy"?"…":"○"}),s]},t))}),p&&e.jsx("p",{className:"text-sm text-red-600",children:p}),x&&e.jsxs("div",{className:"mt-3 rounded-md bg-green-50 p-3 text-sm text-green-800 dark:bg-green-900/20 dark:text-green-300",children:[e.jsx("p",{className:"mb-1 font-semibold",children:"Update installiert."}),x.length>0&&e.jsxs("details",{children:[e.jsx("summary",{className:"cursor-pointer text-xs",children:"Details anzeigen"}),e.jsx("ul",{className:"mt-2 list-disc pl-5 text-xs",children:x.map((t,s)=>e.jsx("li",{children:t},s))})]})]})]})]})})}export{H as default};