PageSourceSearch

https://capitaineaventure.fr/assets/StorageManager-BWwMZQq3.js

js capitaineaventure.fr collected 2026-09-24 14:21:50 UTC 5,326 bytes, 1 lines download raw bytes

1import{j as e}from"./vendor-query-CnVJgDtS.js";import{u as z,r as c}from"./vendor-react-B9UTwVUJ.js";import{L as x}from"./Layout-BZTG21Wl.js";import{B as P,s as d}from"./index-Cx49XYBu.js";import{C as f,a as j,b as g,c as G,d as b}from"./card-CU6MTvUa.js";import{I as N}from"./input-DzgpH4lB.js";import{L as v}from"./label-DTYm5pEp.js";import{toast as r}from"./index-CqtmjIGR.js";import{A as q,a as $,b as B}from"./alert-CL4_XHxO.js";import{L as S}from"./loader-circle-DmYKIYAo.js";import{S as D}from"./shield-CZ_izf6j.js";import{U as y}from"./upload-BACPLDYG.js";import{F as M}from"./folder-open-CMSp3LfY.js";import"./use-toast-tfTEdvO_.js";import"./sheet-DhRWtD2W.js";import"./vendor-ui-KzfIh-gD.js";import"./dialog-BzZESAe8.js";import"./createLucideIcon-DcuJWPyU.js";import"./separator-BhN3qP2C.js";import"./engagementMilestones-Ox9hKC8e.js";import"./crown-Ulhw-YL6.js";import"./settings-k-fEU8RX.js";import"./vendor-supabase-C6GHtIgE.js";const de=()=>{const n=z(),[w,A]=c.useState(!0),[C,U]=c.useState(!1),[o,m]=c.useState(!1),[t,u]=c.useState(null),[h,I]=c.useState("Stories/");c.useEffect(()=>{(async()=>{try{const{data:i}=await d.auth.getSession(),a=i.session?.user;if(!a){r.error("Accès refusé - Connexion requise"),n("/auth");return}const{data:l}=await d.rpc("is_admin",{user_email:a.email});if(!l){r.error("Accès refusé - Droits administrateur requis"),n("/");return}U(!0)}catch{r.error("Erreur de vérification des droits"),n("/")}finally{A(!1)}})()},[n]);const F=s=>{s.target.files&&s.target.files.length>0&&(u(s.target.files),r.info(`${s.target.files.length} fichier(s) sélectionné(s)`))},L=async()=>{if(!t||t.length===0){r.error("Veuillez sélectionner des fichiers");return}m(!0);let s=0,i=0;try{for(let l=0;l<t.length;l++){const p=t[l],k=`${h}${p.name}`,{error:E}=await d.storage.from("stories-images").upload(k,p,{cacheControl:"3600",upsert:!0});E?i++:s++}s>0&&r.success(`${s} fichier(s) uploadé(s) avec succès !`),i>0&&r.error(`${i} fichier(s) en erreur`),u(null);const a=document.getElementById("file-input");a&&(a.value="")}catch{r.error("Erreur lors de l'upload des fichiers")}finally{m(!1)}};return w?e.jsx(x,{children:e.jsx("div",{className:"flex items-center justify-center min-h-[50vh]",children:e.jsxs("div",{className:"text-center",children:[e.jsx(S,{className:"h-8 w-8 animate-spin mx-auto mb-4 text-primary"}),e.jsx("p",{className:"text-muted-foreground",children:"Vérification des droits d'accès..."})]})})}):C?e.jsx(x,{children:e.jsxs("div",{className:"page-container max-w-4xl mx-auto py-8",children:[e.jsxs("div",{className:"mb-8",children:[e.jsxs("div",{className:"flex items-center gap-2 mb-2",children:[e.jsx(D,{className:"h-6 w-6 text-primary"}),e.jsx("h1",{className:"text-3xl font-bold",children:"Gestion des Images"})]}),e.jsx("p",{className:"text-muted-foreground",children:"Upload des images vers Supabase Storage (Accès administrateur)"})]}),e.jsxs("div",{className:"space-y-6",children:[e.jsxs(f,{children:[e.jsxs(j,{children:[e.jsxs(g,{className:"flex items-center gap-2",children:[e.jsx(y,{className:"h-5 w-5"}),"Upload d'images"]}),e.jsx(G,{children:"Uploadez vos images dans le bucket Supabase Storage"})]}),e.jsxs(b,{className:"space-y-4",children:[e.jsxs("div",{className:"space-y-2",children:[e.jsx(v,{htmlFor:"upload-path",children:"Chemin de destination (dans le bucket)"}),e.jsx(N,{id:"upload-path",value:h,onChange:s=>I(s.target.value),placeholder:"Stories/"}),e.jsx("p",{className:"text-xs text-muted-foreground",children:"Exemple : Stories/histoire-1/ ou Stories/IMG_principale.webp"})]}),e.jsxs("div",{className:"space-y-2",children:[e.jsx(v,{htmlFor:"file-input",children:"Sélectionner des fichiers"}),e.jsx(N,{id:"file-input",type:"file",multiple:!0,accept:"image/*",onChange:F,disabled:o}),t&&e.jsxs("p",{className:"text-sm text-muted-foreground",children:[t.length," fichier(s) sélectionné(s)"]})]}),e.jsx(P,{onClick:L,disabled:!t||o,className:"w-full",children:o?e.jsxs(e.Fragment,{children:[e.jsx(S,{className:"mr-2 h-4 w-4 animate-spin"}),"Upload en cours..."]}):e.jsxs(e.Fragment,{children:[e.jsx(y,{className:"mr-2 h-4 w-4"}),"Uploader les fichiers"]})}),e.jsxs(q,{children:[e.jsx(M,{className:"h-4 w-4"}),e.jsx($,{children:"Structure recommandée"}),e.jsxs(B,{children:["Organisez vos images comme : ",e.jsx("br",{}),e.jsx("code",{className:"text-xs",children:"Stories/story-id/IMG_principale.webp"}),e.jsx("br",{}),e.jsx("code",{className:"text-xs",children:"Stories/story-id/sequence-id.webp"})]})]})]})]}),e.jsxs(f,{children:[e.jsx(j,{children:e.jsx(g,{children:"📦 Informations du bucket"})}),e.jsxs(b,{className:"space-y-2 text-sm",children:[e.jsxs("div",{children:[e.jsx("strong",{children:"Nom du bucket :"})," ",e.jsx("code",{children:"stories-images"})]}),e.jsxs("div",{children:[e.jsx("strong",{children:"Accès :"})," Public (lecture) - Admin uniquement (écriture)"]}),e.jsxs("div",{children:[e.jsx("strong",{children:"Limite de taille :"})," 10 MB par fichier"]}
1),e.jsxs("div",{children:[e.jsx("strong",{children:"Types acceptés :"})," JPEG, PNG, WebP, GIF"]}),e.jsxs("div",{children:[e.jsx("strong",{children:"URL de base :"}),e.jsx("br",{}),e.jsx("code",{className:"text-xs break-all",children:"https://iwgcbgtzfpzeqvgjjlyw.supabase.co/storage/v1/object/public/stories-images/"})]})]})]})]})]})}):null};export{de as default};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.