Commit 4d0b59c
committed
feat(storage): add CloudFront CDN file strategy
- Add `FileSources.cloudfront` enum and `cloudfrontConfigSchema` to data-provider
- Implement `packages/api/src/cdn/cloudfront.ts` for initialization and config access
- Implement `packages/api/src/storage/cloudfront/crud.ts` for URL generation,
signed URLs, S3-delegated uploads/deletes, and optional cache invalidation
- Refactor `S3ImageService` into a unified `ImageService` class with injected
`saveBuffer` fn, eliminating many lines of per-strategy duplication
- Refactor `initializeFileStorage` to deduplicate and handle `fileStrategies` config
- Propagate `cloudfront` config through `AppConfig` and `AppService`
- Add CloudFront strategy to `strategies.js` and `librechat.example.yaml`
- Added unit tests across cdn/cloudfront, storage/cloudfront/crud, and ImageService1 parent ca6ce8f commit 4d0b59c
24 files changed
Lines changed: 2292 additions & 1060 deletions
File tree
- api/server/services/Files
- packages
- api
- src
- app
- __tests__
- cdn
- __tests__
- storage
- __tests__
- cloudfront
- __tests__
- s3
- __tests__
- data-provider/src
- types
- data-schemas/src
- app
- types
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
| 5 | + | |
5 | 6 | | |
6 | 7 | | |
7 | | - | |
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
| 11 | + | |
11 | 12 | | |
| 13 | + | |
12 | 14 | | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
13 | 19 | | |
14 | 20 | | |
15 | 21 | | |
| |||
37 | 43 | | |
38 | 44 | | |
39 | 45 | | |
40 | | - | |
| 46 | + | |
41 | 47 | | |
42 | 48 | | |
43 | 49 | | |
44 | | - | |
| 50 | + | |
45 | 51 | | |
46 | | - | |
| 52 | + | |
| 53 | + | |
47 | 54 | | |
48 | 55 | | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
49 | 61 | | |
50 | 62 | | |
51 | 63 | | |
| |||
109 | 121 | | |
110 | 122 | | |
111 | 123 | | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
112 | 140 | | |
113 | 141 | | |
114 | 142 | | |
| |||
291 | 319 | | |
292 | 320 | | |
293 | 321 | | |
| 322 | + | |
| 323 | + | |
294 | 324 | | |
295 | 325 | | |
296 | 326 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
21 | | - | |
| 21 | + | |
22 | 22 | | |
23 | 23 | | |
24 | 24 | | |
25 | 25 | | |
26 | 26 | | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
27 | 41 | | |
28 | 42 | | |
29 | 43 | | |
| |||
0 commit comments