@lastbrain/app 0.1.23 → 0.1.24
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/scripts/init-app.d.ts.map +1 -1
- package/dist/scripts/init-app.js +348 -19
- package/dist/styles.css +1 -1
- package/dist/templates/DefaultDoc.d.ts.map +1 -1
- package/dist/templates/DefaultDoc.js +16 -1
- package/dist/templates/DocPage.d.ts.map +1 -1
- package/dist/templates/DocPage.js +9 -3
- package/package.json +19 -20
- package/src/scripts/init-app.ts +359 -19
- package/src/templates/DefaultDoc.tsx +127 -0
- package/src/templates/DocPage.tsx +9 -3
|
@@ -539,6 +539,133 @@ where email = 'votre@email.com';`}
|
|
|
539
539
|
</CardBody>
|
|
540
540
|
</Card>
|
|
541
541
|
|
|
542
|
+
<Card id="section-storage" className="scroll-mt-32">
|
|
543
|
+
<CardHeader>
|
|
544
|
+
<h2 className="text-2xl font-semibold flex items-center gap-2">
|
|
545
|
+
<Database size={24} />
|
|
546
|
+
Système de Proxy Storage
|
|
547
|
+
</h2>
|
|
548
|
+
</CardHeader>
|
|
549
|
+
<CardBody className="space-y-4">
|
|
550
|
+
<p className="text-slate-600 dark:text-slate-400">
|
|
551
|
+
LastBrain intègre un système de proxy pour les fichiers Supabase
|
|
552
|
+
Storage qui permet d'utiliser des URLs propres avec contrôle d'accès
|
|
553
|
+
granulaire.
|
|
554
|
+
</p>
|
|
555
|
+
|
|
556
|
+
<div>
|
|
557
|
+
<h3 className="text-lg font-semibold mb-2">
|
|
558
|
+
URLs Proxy vs URLs Supabase
|
|
559
|
+
</h3>
|
|
560
|
+
<div className="space-y-3">
|
|
561
|
+
<div className="bg-red-50 dark:bg-red-950 p-3 rounded-lg">
|
|
562
|
+
<p className="text-sm font-medium text-red-700 dark:text-red-300 mb-1">
|
|
563
|
+
❌ URL Supabase classique (longue)
|
|
564
|
+
</p>
|
|
565
|
+
<code className="text-xs text-red-600 dark:text-red-400 break-all">
|
|
566
|
+
https://xxx.supabase.co/storage/v1/object/public/avatar/user_128_123456.webp
|
|
567
|
+
</code>
|
|
568
|
+
</div>
|
|
569
|
+
<div className="bg-green-50 dark:bg-green-950 p-3 rounded-lg">
|
|
570
|
+
<p className="text-sm font-medium text-green-700 dark:text-green-300 mb-1">
|
|
571
|
+
✅ URL Proxy (propre)
|
|
572
|
+
</p>
|
|
573
|
+
<code className="text-xs text-green-600 dark:text-green-400">
|
|
574
|
+
/api/storage/avatar/user_128_123456.webp
|
|
575
|
+
</code>
|
|
576
|
+
</div>
|
|
577
|
+
</div>
|
|
578
|
+
</div>
|
|
579
|
+
|
|
580
|
+
<div>
|
|
581
|
+
<h3 className="text-lg font-semibold mb-2">
|
|
582
|
+
Configuration des Buckets
|
|
583
|
+
</h3>
|
|
584
|
+
<div className="space-y-3">
|
|
585
|
+
<div className="border-l-4 border-green-500 pl-4">
|
|
586
|
+
<h4 className="font-semibold text-green-600 dark:text-green-400">
|
|
587
|
+
📂 avatar (Public)
|
|
588
|
+
</h4>
|
|
589
|
+
<p className="text-sm text-slate-600 dark:text-slate-400">
|
|
590
|
+
Photos de profil et avatars • 10MB max • Types: JPEG, PNG,
|
|
591
|
+
WebP, GIF
|
|
592
|
+
</p>
|
|
593
|
+
<code className="text-xs bg-slate-100 dark:bg-slate-800 px-2 py-1 rounded">
|
|
594
|
+
/api/storage/avatar/user_128_123456.webp
|
|
595
|
+
</code>
|
|
596
|
+
</div>
|
|
597
|
+
|
|
598
|
+
<div className="border-l-4 border-blue-500 pl-4">
|
|
599
|
+
<h4 className="font-semibold text-blue-600 dark:text-blue-400">
|
|
600
|
+
🔒 app (Privé)
|
|
601
|
+
</h4>
|
|
602
|
+
<p className="text-sm text-slate-600 dark:text-slate-400">
|
|
603
|
+
Fichiers privés des utilisateurs • 100MB max •
|
|
604
|
+
Authentification requise
|
|
605
|
+
</p>
|
|
606
|
+
<code className="text-xs bg-slate-100 dark:bg-slate-800 px-2 py-1 rounded">
|
|
607
|
+
/api/storage/app/user-id/documents/file.pdf
|
|
608
|
+
</code>
|
|
609
|
+
</div>
|
|
610
|
+
</div>
|
|
611
|
+
</div>
|
|
612
|
+
|
|
613
|
+
<div>
|
|
614
|
+
<h3 className="text-lg font-semibold mb-2">
|
|
615
|
+
Utilisation dans le code
|
|
616
|
+
</h3>
|
|
617
|
+
<div className="bg-slate-50 dark:bg-slate-900 p-4 rounded-lg text-sm font-mono overflow-x-auto">
|
|
618
|
+
<pre>{`// Upload d'un fichier
|
|
619
|
+
import { uploadFile } from "@/api/storage";
|
|
620
|
+
|
|
621
|
+
const proxyUrl = await uploadFile(
|
|
622
|
+
"avatar",
|
|
623
|
+
"user_128_123456.webp",
|
|
624
|
+
file,
|
|
625
|
+
"image/webp"
|
|
626
|
+
);
|
|
627
|
+
// Retourne: "/api/storage/avatar/user_128_123456.webp"
|
|
628
|
+
|
|
629
|
+
// Conversion de chemin storage
|
|
630
|
+
import { storagePathToProxyUrl } from "@/lib/storage";
|
|
631
|
+
|
|
632
|
+
const proxyUrl = storagePathToProxyUrl("avatar/user_128_123456.webp");
|
|
633
|
+
// Retourne: "/api/storage/avatar/user_128_123456.webp"`}</pre>
|
|
634
|
+
</div>
|
|
635
|
+
</div>
|
|
636
|
+
|
|
637
|
+
<div>
|
|
638
|
+
<h3 className="text-lg font-semibold mb-2">Avantages du système</h3>
|
|
639
|
+
<div className="grid grid-cols-1 md:grid-cols-2 gap-3 text-sm">
|
|
640
|
+
<div className="flex items-start gap-2">
|
|
641
|
+
<span className="text-green-600">✅</span>
|
|
642
|
+
<span>URLs plus courtes et lisibles</span>
|
|
643
|
+
</div>
|
|
644
|
+
<div className="flex items-start gap-2">
|
|
645
|
+
<span className="text-green-600">✅</span>
|
|
646
|
+
<span>Contrôle d'accès granulaire</span>
|
|
647
|
+
</div>
|
|
648
|
+
<div className="flex items-start gap-2">
|
|
649
|
+
<span className="text-green-600">✅</span>
|
|
650
|
+
<span>Cache optimisé (1 an)</span>
|
|
651
|
+
</div>
|
|
652
|
+
<div className="flex items-start gap-2">
|
|
653
|
+
<span className="text-green-600">✅</span>
|
|
654
|
+
<span>Sécurité améliorée</span>
|
|
655
|
+
</div>
|
|
656
|
+
<div className="flex items-start gap-2">
|
|
657
|
+
<span className="text-green-600">✅</span>
|
|
658
|
+
<span>Détection auto des types MIME</span>
|
|
659
|
+
</div>
|
|
660
|
+
<div className="flex items-start gap-2">
|
|
661
|
+
<span className="text-green-600">✅</span>
|
|
662
|
+
<span>Extensible facilement</span>
|
|
663
|
+
</div>
|
|
664
|
+
</div>
|
|
665
|
+
</div>
|
|
666
|
+
</CardBody>
|
|
667
|
+
</Card>
|
|
668
|
+
|
|
542
669
|
<Card id="section-module-docs" className="scroll-mt-32">
|
|
543
670
|
<CardHeader>
|
|
544
671
|
<h2 className="text-2xl font-semibold flex items-center gap-2">
|
|
@@ -27,6 +27,7 @@ import {
|
|
|
27
27
|
BookOpen,
|
|
28
28
|
Link,
|
|
29
29
|
Blocks,
|
|
30
|
+
HardDrive,
|
|
30
31
|
} from "lucide-react";
|
|
31
32
|
import { DefaultDocumentation } from "./DefaultDoc.js";
|
|
32
33
|
|
|
@@ -66,14 +67,13 @@ export function DocPage({ modules = [], defaultContent }: DocPageProps) {
|
|
|
66
67
|
"section-architecture",
|
|
67
68
|
"section-create-module",
|
|
68
69
|
"section-database",
|
|
70
|
+
"section-storage",
|
|
69
71
|
"section-ui",
|
|
70
72
|
"section-module-docs",
|
|
71
73
|
"section-links",
|
|
72
74
|
...(modules.length > 0 ? ["section-modules"] : []),
|
|
73
75
|
...modules.map((m) => `module-${m.id}`),
|
|
74
|
-
];
|
|
75
|
-
|
|
76
|
-
// Trouver la section actuellement visible
|
|
76
|
+
]; // Trouver la section actuellement visible
|
|
77
77
|
let currentSection = "default";
|
|
78
78
|
|
|
79
79
|
// Si on est tout en haut de la page
|
|
@@ -165,6 +165,12 @@ export function DocPage({ modules = [], defaultContent }: DocPageProps) {
|
|
|
165
165
|
description: "",
|
|
166
166
|
icon: Database,
|
|
167
167
|
},
|
|
168
|
+
{
|
|
169
|
+
id: "section-storage",
|
|
170
|
+
name: "Proxy Storage",
|
|
171
|
+
description: "Gestion des fichiers",
|
|
172
|
+
icon: HardDrive,
|
|
173
|
+
},
|
|
168
174
|
{
|
|
169
175
|
id: "section-ui",
|
|
170
176
|
name: "Interface utilisateur",
|