# Conflicts: # hifi/assets/AccountSettings-3Az7PIEf.js # hifi/assets/AccountSettings-C7P_TaTL.js # hifi/assets/AccountSettings-CfY49TlQ.js # hifi/assets/AdminUsers-C1zi3a_m.js # hifi/assets/Brands-V9s4vz2i.js # hifi/assets/ContactRequests-BcF_HxL3.js # hifi/assets/Dashboard-m6lX2kWI.js # hifi/assets/DatabaseSettings-pQejbEjR.js # hifi/assets/Downloads-DCZm2dP9.js # hifi/assets/EmailSettings-B_RqPmc9.js # hifi/assets/EmailSettings-DixrL0D8.js # hifi/assets/EmailSettings-VadOa5J3.js # hifi/assets/ExportImportSettings-Bkwm__tE.js # hifi/assets/Faqs-CDIDxeRo.js # hifi/assets/GalleryBrands-CeGo7QXi.js # hifi/assets/GalleryPhotos-NPKQDZMi.js # hifi/assets/GalleryProjects-CfB-fA4x.js # hifi/assets/HomeSections-BzNKNMho.js # hifi/assets/ImageUploadField-B8P2oQZ9.js # hifi/assets/ImageUploadField-DyLcJG5-.js # hifi/assets/ImageUploadField-oqjVVSSG.js # hifi/assets/LegalSettings-BnY85Lz7.js # hifi/assets/LegalSettings-CRgpL0dP.js # hifi/assets/LegalSettings-DGN-Kl_a.js # hifi/assets/Login-CFL8bhtC.js # hifi/assets/Login-Dc1nFqtx.js # hifi/assets/Login-pbnF9xt-.js # hifi/assets/MaintenanceSettings-CFGyPBuq.js # hifi/assets/MaintenanceSettings-DhcTJBUJ.js # hifi/assets/MaintenanceSettings-DsGBefLo.js # hifi/assets/Models-CyjYxQOO.js # hifi/assets/Packages-6JjKaOj1.js # hifi/assets/Partners-BRwobp6H.js # hifi/assets/PermissionGroups-CW64DGq9.js # hifi/assets/PermissionGroups-DI5xJ6TD.js # hifi/assets/PermissionGroups-_i9KMBTo.js # hifi/assets/ResetSettings-Bm64tgsK.js # hifi/assets/RichTextEditor-DJwdsoJ6.js # hifi/assets/RichTextEditor-DTscIhNf.js # hifi/assets/RichTextEditor-DcSNZ4jD.js # hifi/assets/Services-BTvu0ymy.js # hifi/assets/SettingsLayout-C5JQlIqD.js # hifi/assets/SetupWizard-BHY_FJd_.js # hifi/assets/SetupWizard-Cu-s4Wuc.js # hifi/assets/SetupWizard-DcHkEIZ7.js # hifi/assets/TextStyleWidget-BZdrb1Dr.js # hifi/assets/TextStyleWidget-CkwixV2h.js # hifi/assets/TextStyleWidget-Czb7ujSZ.js # hifi/assets/UpdateSettings-Ce5oqncR.js # hifi/assets/WebsiteSettings-B7CzBT2R.js # hifi/assets/eye-CZFeBsZS.js # hifi/assets/eye-YlN_9rkm.js # hifi/assets/eye-jJN30JHV.js # hifi/assets/iconRegistry-BJRytynd.js # hifi/assets/iconRegistry-C8CVLtUq.js # hifi/assets/iconRegistry-DUWamfSa.js # hifi/assets/index-QV-Szw5n.js # hifi/assets/trash-2-CQGOvKRj.js # hifi/assets/trash-2-CwY7wd8m.js # hifi/assets/trash-2-fu7u5OTF.js # hifi/index.html
1 line
4.4 KiB
JavaScript
1 line
4.4 KiB
JavaScript
import{r,u as y,b as v,j as e,e as S,R as D,c as I}from"./index-Tg8iNBwT.js";import{f as _,a as E,b as F,i as L}from"./downloads-B9pqFegV.js";import{L as C,F as p,a as R,b as T,c as U,M,D as A}from"./music-DPTNgOWL.js";const K={audio:M,video:U,pdf:p,image:T,archive:R,document:p},n="hifi-downloads-password",z=()=>{try{return localStorage.getItem(n)||""}catch{return""}},f=t=>{try{t?localStorage.setItem(n,t):localStorage.removeItem(n)}catch{}},g=t=>I.get("/downloads",t?{headers:{"X-Download-Password":encodeURIComponent(t)}}:void 0);function W(){const[t,i]=r.useState(null),[c,x]=r.useState(!1),[o,b]=r.useState(""),[j,m]=r.useState(!1),[u,h]=r.useState(!1),[d,w]=r.useState(null),{t:s,language:k}=y();r.useEffect(()=>{const a=z();g(a).then(l=>{l.locked?(a&&f(""),x(!0)):i(l.items)}).catch(l=>w(l))},[]);const N=async a=>{a.preventDefault(),h(!0),m(!1);try{const l=await g(o);l.locked?m(!0):(f(o),x(!1),i(l.items))}catch(l){w(l.message)}finally{h(!1)}};return v({title:s("downloadsPage.metaTitle"),description:s("downloadsPage.metaDescription"),path:"/downloads"}),e.jsxs("div",{className:"mx-auto max-w-4xl px-4 py-12 sm:px-6",children:[e.jsx("h1",{className:"mb-2 text-2xl font-bold text-neutral-900 dark:text-white sm:text-3xl",children:s("downloadsPage.title")}),e.jsx("p",{className:"mb-10 max-w-2xl text-neutral-600 dark:text-neutral-300",children:s("downloadsPage.intro")}),d&&e.jsx("p",{className:"text-red-600",children:typeof d=="string"?d:S(d,s)}),!d&&!c&&t===null&&e.jsx("p",{className:"text-neutral-500 dark:text-neutral-400",children:s("downloadsPage.loading")}),(t==null?void 0:t.length)===0&&e.jsx("p",{className:"text-neutral-500 dark:text-neutral-400",children:s("downloadsPage.empty")}),c&&e.jsxs("form",{onSubmit:N,className:"max-w-md rounded-xl border border-neutral-200 bg-white p-6 dark:border-neutral-800 dark:bg-neutral-900",children:[e.jsxs("div",{className:"mb-2 flex items-center gap-2",children:[e.jsx(C,{className:"h-5 w-5 text-brand-500","aria-hidden":"true"}),e.jsx("h2",{className:"font-semibold text-neutral-900 dark:text-white",children:s("downloadsPage.lockedTitle")})]}),e.jsx("p",{className:"mb-4 text-sm text-neutral-600 dark:text-neutral-300",children:s("downloadsPage.lockedText")}),e.jsx("label",{htmlFor:"downloads-password",className:"sr-only",children:s("downloadsPage.passwordLabel")}),e.jsxs("div",{className:"flex flex-col gap-2 sm:flex-row",children:[e.jsx("input",{id:"downloads-password",type:"password",required:!0,autoComplete:"off",value:o,onChange:a=>b(a.target.value),placeholder:s("downloadsPage.passwordLabel"),className:"w-full rounded-md border border-neutral-300 bg-white px-3 py-2 text-sm text-neutral-900 dark:border-neutral-700 dark:bg-neutral-950 dark:text-white"}),e.jsx("button",{type:"submit",disabled:u,className:"shrink-0 rounded-md bg-brand-500 px-4 py-2 text-sm font-semibold text-white hover:bg-brand-600 disabled:opacity-50",children:s(u?"downloadsPage.unlocking":"downloadsPage.unlock")})]}),j&&e.jsx("p",{className:"mt-2 text-sm text-red-600",role:"alert",children:s("downloadsPage.wrongPassword")})]}),e.jsx("div",{className:"space-y-4",children:t==null?void 0:t.map((a,l)=>{const P=K[_(a.file_name)];return e.jsx(D,{index:l%4,className:"rounded-xl border border-neutral-200 bg-white p-5 dark:border-neutral-800 dark:bg-neutral-900",children:e.jsxs("div",{className:"flex flex-col gap-4 sm:flex-row sm:items-start",children:[e.jsx("div",{className:"flex h-12 w-12 shrink-0 items-center justify-center rounded-full bg-brand-500/10 text-brand-600 dark:text-brand-400",children:e.jsx(P,{className:"h-6 w-6","aria-hidden":"true"})}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("h2",{className:"font-semibold text-neutral-900 dark:text-white",children:a.title}),a.description&&e.jsx("p",{className:"mt-1 whitespace-pre-line text-sm text-neutral-600 dark:text-neutral-300",children:a.description}),e.jsxs("p",{className:"mt-1 text-xs text-neutral-400",children:[E(a.file_name).toUpperCase()," · ",F(a.file_size,k==="de"?"de-DE":"en-US")]}),L(a.file_name)&&e.jsx("audio",{controls:!0,preload:"none",src:a.file_path,className:"mt-3 w-full"})]}),e.jsxs("a",{href:a.file_path,download:a.file_name,className:"inline-flex shrink-0 items-center justify-center gap-2 rounded-md bg-brand-500 px-4 py-2 text-sm font-semibold text-white hover:bg-brand-600",children:[e.jsx(A,{className:"h-4 w-4","aria-hidden":"true"}),s("downloadsPage.download")]})]})},a.id)})})]})}export{W as default};
|