@gallop.software/studio 1.5.1 → 1.5.2
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/{StudioUI-GULMXZQF.js → StudioUI-2UVUYHHA.js} +86 -10
- package/dist/StudioUI-2UVUYHHA.js.map +1 -0
- package/dist/{StudioUI-BHFZVR57.mjs → StudioUI-74IZDKCP.mjs} +86 -10
- package/dist/StudioUI-74IZDKCP.mjs.map +1 -0
- package/dist/{chunk-VQJAJVAQ.mjs → chunk-FOKLOMKO.mjs} +1 -1
- package/dist/chunk-FOKLOMKO.mjs.map +1 -0
- package/dist/{chunk-WOHZ4LYG.js → chunk-X6F6IFY3.js} +1 -1
- package/dist/chunk-X6F6IFY3.js.map +1 -0
- package/dist/handlers/index.js +58 -34
- package/dist/handlers/index.js.map +1 -1
- package/dist/handlers/index.mjs +25 -1
- package/dist/handlers/index.mjs.map +1 -1
- package/dist/index.d.mts +2 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +3 -3
- package/dist/index.mjs +2 -2
- package/package.json +1 -1
- package/dist/StudioUI-BHFZVR57.mjs.map +0 -1
- package/dist/StudioUI-GULMXZQF.js.map +0 -1
- package/dist/chunk-VQJAJVAQ.mjs.map +0 -1
- package/dist/chunk-WOHZ4LYG.js.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/types.ts"],"sourcesContent":["/**\n * Dimensions object {w, h}\n */\nexport interface Dimensions {\n w: number\n h: number\n}\n\n/**\n * Meta entry - works for images and non-images\n * o: original dimensions, b: blurhash, c: CDN index\n * sm/md/lg/f: thumbnail dimensions (presence implies processed)\n */\nexport interface MetaEntry {\n o?: Dimensions // original dimensions {w, h}\n b?: string // blurhash\n sm?: Dimensions // small thumbnail (300px width)\n md?: Dimensions // medium thumbnail (700px width)\n lg?: Dimensions // large thumbnail (1400px width)\n f?: Dimensions // full size (capped at 2560px width)\n c?: number // CDN index - index into _cdns array\n}\n\n/**\n * Full meta schema including special keys\n * _cdns: Array of CDN base URLs\n * Other keys: file paths from public folder\n */\nexport interface FullMeta {\n _cdns?: string[] // Array of CDN base URLs\n [key: string]: MetaEntry | string[] | undefined\n}\n\n/**\n * Meta schema - keyed by path from public folder\n * Example: { \"/portfolio/photo.jpg\": { o: {w:2400,h:1600}, b: \"...\", sm: {w:300,h:200}, ... } }\n */\nexport type LeanMeta = Record<string, MetaEntry>\n\n// Alias for compatibility\nexport type LeanImageEntry = MetaEntry\n\n/**\n * File/folder item for browser\n */\nexport interface FileItem {\n name: string\n path: string\n type: 'file' | 'folder'\n size?: number\n dimensions?: { width: number; height: number }\n isProcessed?: boolean\n cdnPushed?: boolean\n cdnBaseUrl?: string // CDN base URL when pushed to cloud\n isRemote?: boolean // true if CDN URL doesn't match R2 (external import)\n isProtected?: boolean // true for images folder and its contents (cannot select/modify)\n // Folder-specific properties\n fileCount?: number\n totalSize?: number\n cloudCount?: number // Number of cloud files in folder\n localCount?: number // Number of local files in folder\n // For showing thumbnails - path to -sm version if exists\n thumbnail?: string\n // Whether a processed thumbnail exists\n hasThumbnail?: boolean\n}\n\n/**\n * Studio configuration\n */\nexport interface StudioConfig {\n r2AccountId?: string\n r2AccessKeyId?: string\n r2SecretAccessKey?: string\n r2BucketName?: string\n r2PublicUrl?: string\n thumbnailSizes?: {\n small: number\n medium: number\n large: number\n }\n}\n\n/**\n * Get thumbnail path from original image path\n */\nexport function getThumbnailPath(originalPath: string, size: 'sm' | 'md' | 'lg' | 'full'): string {\n if (size === 'full') {\n const ext = originalPath.match(/\\.\\w+$/)?.[0] || '.jpg'\n const base = originalPath.replace(/\\.\\w+$/, '')\n const outputExt = ext.toLowerCase() === '.png' ? '.png' : '.jpg'\n return `/images${base}${outputExt}`\n }\n const ext = originalPath.match(/\\.\\w+$/)?.[0] || '.jpg'\n const base = originalPath.replace(/\\.\\w+$/, '')\n const outputExt = ext.toLowerCase() === '.png' ? '.png' : '.jpg'\n return `/images${base}-${size}${outputExt}`\n}\n\n/**\n * Get all thumbnail paths for an image\n */\nexport function getAllThumbnailPaths(originalPath: string): string[] {\n return [\n getThumbnailPath(originalPath, 'full'),\n getThumbnailPath(originalPath, 'lg'),\n getThumbnailPath(originalPath, 'md'),\n getThumbnailPath(originalPath, 'sm'),\n ]\n}\n\n/**\n * Check if an image entry is processed (has any thumbnail dimensions)\n */\nexport function isProcessed(entry: MetaEntry | undefined): boolean {\n if (!entry) return false\n return !!(entry.f || entry.lg || entry.md || entry.sm)\n}\n"],"mappings":";AAsFO,SAAS,iBAAiB,cAAsB,MAA2C;AAChG,MAAI,SAAS,QAAQ;AACnB,UAAMA,OAAM,aAAa,MAAM,QAAQ,IAAI,CAAC,KAAK;AACjD,UAAMC,QAAO,aAAa,QAAQ,UAAU,EAAE;AAC9C,UAAMC,aAAYF,KAAI,YAAY,MAAM,SAAS,SAAS;AAC1D,WAAO,UAAUC,KAAI,GAAGC,UAAS;AAAA,EACnC;AACA,QAAM,MAAM,aAAa,MAAM,QAAQ,IAAI,CAAC,KAAK;AACjD,QAAM,OAAO,aAAa,QAAQ,UAAU,EAAE;AAC9C,QAAM,YAAY,IAAI,YAAY,MAAM,SAAS,SAAS;AAC1D,SAAO,UAAU,IAAI,IAAI,IAAI,GAAG,SAAS;AAC3C;AAKO,SAAS,qBAAqB,cAAgC;AACnE,SAAO;AAAA,IACL,iBAAiB,cAAc,MAAM;AAAA,IACrC,iBAAiB,cAAc,IAAI;AAAA,IACnC,iBAAiB,cAAc,IAAI;AAAA,IACnC,iBAAiB,cAAc,IAAI;AAAA,EACrC;AACF;AAKO,SAAS,YAAY,OAAuC;AACjE,MAAI,CAAC,MAAO,QAAO;AACnB,SAAO,CAAC,EAAE,MAAM,KAAK,MAAM,MAAM,MAAM,MAAM,MAAM;AACrD;","names":["ext","base","outputExt"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["/Users/chrisb/Sites/studio/dist/chunk-X6F6IFY3.js","../src/types.ts"],"names":["ext","base","outputExt"],"mappings":"AAAA;ACsFO,SAAS,gBAAA,CAAiB,YAAA,EAAsB,IAAA,EAA2C;AAChG,EAAA,GAAA,CAAI,KAAA,IAAS,MAAA,EAAQ;AACnB,IAAA,MAAMA,KAAAA,kBAAM,YAAA,mBAAa,KAAA,mBAAM,QAAQ,CAAA,4BAAA,CAAI,CAAC,IAAA,GAAK,MAAA;AACjD,IAAA,MAAMC,MAAAA,EAAO,YAAA,CAAa,OAAA,CAAQ,QAAA,EAAU,EAAE,CAAA;AAC9C,IAAA,MAAMC,WAAAA,EAAYF,IAAAA,CAAI,WAAA,CAAY,EAAA,IAAM,OAAA,EAAS,OAAA,EAAS,MAAA;AAC1D,IAAA,OAAO,CAAA,OAAA,EAAUC,KAAI,CAAA,EAAA;AACvB,EAAA;AACyB,EAAA;AACZ,EAAA;AACS,EAAA;AACG,EAAA;AAC3B;AAKgB;AACP,EAAA;AACY,IAAA;AACA,IAAA;AACA,IAAA;AACA,IAAA;AACnB,EAAA;AACF;AAK4B;AACP,EAAA;AACE,EAAA;AACvB;AD5F2B;AACA;AACA;AACA;AACA;AACA","file":"/Users/chrisb/Sites/studio/dist/chunk-X6F6IFY3.js","sourcesContent":[null,"/**\n * Dimensions object {w, h}\n */\nexport interface Dimensions {\n w: number\n h: number\n}\n\n/**\n * Meta entry - works for images and non-images\n * o: original dimensions, b: blurhash, c: CDN index\n * sm/md/lg/f: thumbnail dimensions (presence implies processed)\n */\nexport interface MetaEntry {\n o?: Dimensions // original dimensions {w, h}\n b?: string // blurhash\n sm?: Dimensions // small thumbnail (300px width)\n md?: Dimensions // medium thumbnail (700px width)\n lg?: Dimensions // large thumbnail (1400px width)\n f?: Dimensions // full size (capped at 2560px width)\n c?: number // CDN index - index into _cdns array\n}\n\n/**\n * Full meta schema including special keys\n * _cdns: Array of CDN base URLs\n * Other keys: file paths from public folder\n */\nexport interface FullMeta {\n _cdns?: string[] // Array of CDN base URLs\n [key: string]: MetaEntry | string[] | undefined\n}\n\n/**\n * Meta schema - keyed by path from public folder\n * Example: { \"/portfolio/photo.jpg\": { o: {w:2400,h:1600}, b: \"...\", sm: {w:300,h:200}, ... } }\n */\nexport type LeanMeta = Record<string, MetaEntry>\n\n// Alias for compatibility\nexport type LeanImageEntry = MetaEntry\n\n/**\n * File/folder item for browser\n */\nexport interface FileItem {\n name: string\n path: string\n type: 'file' | 'folder'\n size?: number\n dimensions?: { width: number; height: number }\n isProcessed?: boolean\n cdnPushed?: boolean\n cdnBaseUrl?: string // CDN base URL when pushed to cloud\n isRemote?: boolean // true if CDN URL doesn't match R2 (external import)\n isProtected?: boolean // true for images folder and its contents (cannot select/modify)\n // Folder-specific properties\n fileCount?: number\n totalSize?: number\n cloudCount?: number // Number of cloud files in folder\n localCount?: number // Number of local files in folder\n // For showing thumbnails - path to -sm version if exists\n thumbnail?: string\n // Whether a processed thumbnail exists\n hasThumbnail?: boolean\n}\n\n/**\n * Studio configuration\n */\nexport interface StudioConfig {\n r2AccountId?: string\n r2AccessKeyId?: string\n r2SecretAccessKey?: string\n r2BucketName?: string\n r2PublicUrl?: string\n thumbnailSizes?: {\n small: number\n medium: number\n large: number\n }\n}\n\n/**\n * Get thumbnail path from original image path\n */\nexport function getThumbnailPath(originalPath: string, size: 'sm' | 'md' | 'lg' | 'full'): string {\n if (size === 'full') {\n const ext = originalPath.match(/\\.\\w+$/)?.[0] || '.jpg'\n const base = originalPath.replace(/\\.\\w+$/, '')\n const outputExt = ext.toLowerCase() === '.png' ? '.png' : '.jpg'\n return `/images${base}${outputExt}`\n }\n const ext = originalPath.match(/\\.\\w+$/)?.[0] || '.jpg'\n const base = originalPath.replace(/\\.\\w+$/, '')\n const outputExt = ext.toLowerCase() === '.png' ? '.png' : '.jpg'\n return `/images${base}-${size}${outputExt}`\n}\n\n/**\n * Get all thumbnail paths for an image\n */\nexport function getAllThumbnailPaths(originalPath: string): string[] {\n return [\n getThumbnailPath(originalPath, 'full'),\n getThumbnailPath(originalPath, 'lg'),\n getThumbnailPath(originalPath, 'md'),\n getThumbnailPath(originalPath, 'sm'),\n ]\n}\n\n/**\n * Check if an image entry is processed (has any thumbnail dimensions)\n */\nexport function isProcessed(entry: MetaEntry | undefined): boolean {\n if (!entry) return false\n return !!(entry.f || entry.lg || entry.md || entry.sm)\n}\n"]}
|
package/dist/handlers/index.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
|
|
4
4
|
|
|
5
|
-
var
|
|
5
|
+
var _chunkX6F6IFY3js = require('../chunk-X6F6IFY3.js');
|
|
6
6
|
|
|
7
7
|
// src/handlers/index.ts
|
|
8
8
|
var _server = require('next/server');
|
|
@@ -234,7 +234,7 @@ async function uploadToCdn(imageKey) {
|
|
|
234
234
|
const bucketName = process.env.CLOUDFLARE_R2_BUCKET_NAME;
|
|
235
235
|
if (!bucketName) throw new Error("R2 bucket not configured");
|
|
236
236
|
const r2 = getR2Client();
|
|
237
|
-
for (const thumbPath of
|
|
237
|
+
for (const thumbPath of _chunkX6F6IFY3js.getAllThumbnailPaths.call(void 0, imageKey)) {
|
|
238
238
|
const localPath = _path2.default.join(process.cwd(), "public", thumbPath);
|
|
239
239
|
try {
|
|
240
240
|
const fileBuffer = await _fs.promises.readFile(localPath);
|
|
@@ -251,7 +251,7 @@ async function uploadToCdn(imageKey) {
|
|
|
251
251
|
}
|
|
252
252
|
}
|
|
253
253
|
async function deleteLocalThumbnails(imageKey) {
|
|
254
|
-
for (const thumbPath of
|
|
254
|
+
for (const thumbPath of _chunkX6F6IFY3js.getAllThumbnailPaths.call(void 0, imageKey)) {
|
|
255
255
|
const localPath = _path2.default.join(process.cwd(), "public", thumbPath);
|
|
256
256
|
try {
|
|
257
257
|
await _fs.promises.unlink(localPath);
|
|
@@ -296,7 +296,7 @@ async function deleteFromCdn(imageKey, hasThumbnails) {
|
|
|
296
296
|
} catch (e4) {
|
|
297
297
|
}
|
|
298
298
|
if (hasThumbnails) {
|
|
299
|
-
for (const thumbPath of
|
|
299
|
+
for (const thumbPath of _chunkX6F6IFY3js.getAllThumbnailPaths.call(void 0, imageKey)) {
|
|
300
300
|
try {
|
|
301
301
|
await r2.send(
|
|
302
302
|
new (0, _clients3.DeleteObjectCommand)({
|
|
@@ -313,7 +313,7 @@ async function deleteThumbnailsFromCdn(imageKey) {
|
|
|
313
313
|
const bucketName = process.env.CLOUDFLARE_R2_BUCKET_NAME;
|
|
314
314
|
if (!bucketName) throw new Error("R2 bucket not configured");
|
|
315
315
|
const r2 = getR2Client();
|
|
316
|
-
for (const thumbPath of
|
|
316
|
+
for (const thumbPath of _chunkX6F6IFY3js.getAllThumbnailPaths.call(void 0, imageKey)) {
|
|
317
317
|
try {
|
|
318
318
|
await r2.send(
|
|
319
319
|
new (0, _clients3.DeleteObjectCommand)({
|
|
@@ -330,19 +330,33 @@ async function deleteThumbnailsFromCdn(imageKey) {
|
|
|
330
330
|
function getExistingThumbnails(originalPath, entry) {
|
|
331
331
|
const thumbnails = [];
|
|
332
332
|
if (entry.f) {
|
|
333
|
-
thumbnails.push({ path:
|
|
333
|
+
thumbnails.push({ path: _chunkX6F6IFY3js.getThumbnailPath.call(void 0, originalPath, "full"), size: "f" });
|
|
334
334
|
}
|
|
335
335
|
if (entry.lg) {
|
|
336
|
-
thumbnails.push({ path:
|
|
336
|
+
thumbnails.push({ path: _chunkX6F6IFY3js.getThumbnailPath.call(void 0, originalPath, "lg"), size: "lg" });
|
|
337
337
|
}
|
|
338
338
|
if (entry.md) {
|
|
339
|
-
thumbnails.push({ path:
|
|
339
|
+
thumbnails.push({ path: _chunkX6F6IFY3js.getThumbnailPath.call(void 0, originalPath, "md"), size: "md" });
|
|
340
340
|
}
|
|
341
341
|
if (entry.sm) {
|
|
342
|
-
thumbnails.push({ path:
|
|
342
|
+
thumbnails.push({ path: _chunkX6F6IFY3js.getThumbnailPath.call(void 0, originalPath, "sm"), size: "sm" });
|
|
343
343
|
}
|
|
344
344
|
return thumbnails;
|
|
345
345
|
}
|
|
346
|
+
function countCloudAndLocal(folderPrefix, fileEntries) {
|
|
347
|
+
let cloudCount = 0;
|
|
348
|
+
let localCount = 0;
|
|
349
|
+
for (const [key, entry] of fileEntries) {
|
|
350
|
+
if (key.startsWith(folderPrefix)) {
|
|
351
|
+
if (entry.c !== void 0) {
|
|
352
|
+
cloudCount++;
|
|
353
|
+
} else {
|
|
354
|
+
localCount++;
|
|
355
|
+
}
|
|
356
|
+
}
|
|
357
|
+
}
|
|
358
|
+
return { cloudCount, localCount };
|
|
359
|
+
}
|
|
346
360
|
async function handleList(request) {
|
|
347
361
|
const searchParams = request.nextUrl.searchParams;
|
|
348
362
|
const requestedPath = searchParams.get("path") || "public";
|
|
@@ -362,7 +376,7 @@ async function handleList(request) {
|
|
|
362
376
|
const imagesPrefix = imagesSubPath ? `/${imagesSubPath}/` : "/";
|
|
363
377
|
const allThumbnails = [];
|
|
364
378
|
for (const [key, entry] of fileEntries) {
|
|
365
|
-
if (
|
|
379
|
+
if (_chunkX6F6IFY3js.isProcessed.call(void 0, entry)) {
|
|
366
380
|
const thumbnails = getExistingThumbnails(key, entry);
|
|
367
381
|
for (const thumb of thumbnails) {
|
|
368
382
|
allThumbnails.push({ ...thumb, originalKey: key });
|
|
@@ -462,9 +476,11 @@ async function handleList(request) {
|
|
|
462
476
|
const isImagesFolder = entry.name === "images" && !relativePath;
|
|
463
477
|
const folderPath = relativePath ? `public/${relativePath}/${entry.name}` : `public/${entry.name}`;
|
|
464
478
|
let fileCount = 0;
|
|
479
|
+
let cloudCount = 0;
|
|
480
|
+
let localCount = 0;
|
|
465
481
|
if (isImagesFolder) {
|
|
466
482
|
for (const [key, metaEntry] of fileEntries) {
|
|
467
|
-
if (
|
|
483
|
+
if (_chunkX6F6IFY3js.isProcessed.call(void 0, metaEntry)) {
|
|
468
484
|
fileCount += getExistingThumbnails(key, metaEntry).length;
|
|
469
485
|
}
|
|
470
486
|
}
|
|
@@ -473,12 +489,17 @@ async function handleList(request) {
|
|
|
473
489
|
for (const k of metaKeys) {
|
|
474
490
|
if (k.startsWith(folderPrefix)) fileCount++;
|
|
475
491
|
}
|
|
492
|
+
const counts = countCloudAndLocal(folderPrefix, fileEntries);
|
|
493
|
+
cloudCount = counts.cloudCount;
|
|
494
|
+
localCount = counts.localCount;
|
|
476
495
|
}
|
|
477
496
|
items.push({
|
|
478
497
|
name: entry.name,
|
|
479
498
|
path: folderPath,
|
|
480
499
|
type: "folder",
|
|
481
500
|
fileCount,
|
|
501
|
+
cloudCount,
|
|
502
|
+
localCount,
|
|
482
503
|
isProtected: isImagesFolder
|
|
483
504
|
});
|
|
484
505
|
}
|
|
@@ -489,7 +510,7 @@ async function handleList(request) {
|
|
|
489
510
|
if (!relativePath && !seenFolders.has("images")) {
|
|
490
511
|
let thumbnailCount = 0;
|
|
491
512
|
for (const [key, entry] of fileEntries) {
|
|
492
|
-
if (
|
|
513
|
+
if (_chunkX6F6IFY3js.isProcessed.call(void 0, entry)) {
|
|
493
514
|
thumbnailCount += getExistingThumbnails(key, entry).length;
|
|
494
515
|
}
|
|
495
516
|
}
|
|
@@ -521,11 +542,14 @@ async function handleList(request) {
|
|
|
521
542
|
for (const k of metaKeys) {
|
|
522
543
|
if (k.startsWith(folderPrefix)) fileCount++;
|
|
523
544
|
}
|
|
545
|
+
const counts = countCloudAndLocal(folderPrefix, fileEntries);
|
|
524
546
|
items.push({
|
|
525
547
|
name: folderName,
|
|
526
548
|
path: relativePath ? `public/${relativePath}/${folderName}` : `public/${folderName}`,
|
|
527
549
|
type: "folder",
|
|
528
550
|
fileCount,
|
|
551
|
+
cloudCount: counts.cloudCount,
|
|
552
|
+
localCount: counts.localCount,
|
|
529
553
|
isProtected: isInsideImagesFolder
|
|
530
554
|
});
|
|
531
555
|
}
|
|
@@ -538,9 +562,9 @@ async function handleList(request) {
|
|
|
538
562
|
let thumbnail;
|
|
539
563
|
let hasThumbnail = false;
|
|
540
564
|
let fileSize;
|
|
541
|
-
const entryIsProcessed =
|
|
565
|
+
const entryIsProcessed = _chunkX6F6IFY3js.isProcessed.call(void 0, entry);
|
|
542
566
|
if (isImage && entryIsProcessed) {
|
|
543
|
-
const thumbPath =
|
|
567
|
+
const thumbPath = _chunkX6F6IFY3js.getThumbnailPath.call(void 0, key, "sm");
|
|
544
568
|
if (isPushedToCloud && entry.c !== void 0) {
|
|
545
569
|
const cdnUrl = cdnUrls[entry.c];
|
|
546
570
|
if (cdnUrl) {
|
|
@@ -619,9 +643,9 @@ async function handleSearch(request) {
|
|
|
619
643
|
const isRemote = isPushedToCloud && (!r2PublicUrl || fileCdnUrl !== r2PublicUrl);
|
|
620
644
|
let thumbnail;
|
|
621
645
|
let hasThumbnail = false;
|
|
622
|
-
const entryIsProcessed =
|
|
646
|
+
const entryIsProcessed = _chunkX6F6IFY3js.isProcessed.call(void 0, entry);
|
|
623
647
|
if (isImage && entryIsProcessed) {
|
|
624
|
-
const thumbPath =
|
|
648
|
+
const thumbPath = _chunkX6F6IFY3js.getThumbnailPath.call(void 0, key, "sm");
|
|
625
649
|
if (isPushedToCloud && entry.c !== void 0) {
|
|
626
650
|
const cdnUrl = cdnUrls[entry.c];
|
|
627
651
|
if (cdnUrl) {
|
|
@@ -876,7 +900,7 @@ async function handleDelete(request) {
|
|
|
876
900
|
if (key.startsWith(prefix) || key === imageKey) {
|
|
877
901
|
const keyEntry = meta[key];
|
|
878
902
|
if (keyEntry && keyEntry.c === void 0) {
|
|
879
|
-
for (const thumbPath of
|
|
903
|
+
for (const thumbPath of _chunkX6F6IFY3js.getAllThumbnailPaths.call(void 0, key)) {
|
|
880
904
|
const absoluteThumbPath = _path2.default.join(process.cwd(), "public", thumbPath);
|
|
881
905
|
try {
|
|
882
906
|
await _fs.promises.unlink(absoluteThumbPath);
|
|
@@ -892,7 +916,7 @@ async function handleDelete(request) {
|
|
|
892
916
|
const isInImagesFolder = itemPath.startsWith("public/images/");
|
|
893
917
|
if (!isInImagesFolder && entry) {
|
|
894
918
|
if (!isPushedToCloud) {
|
|
895
|
-
for (const thumbPath of
|
|
919
|
+
for (const thumbPath of _chunkX6F6IFY3js.getAllThumbnailPaths.call(void 0, imageKey)) {
|
|
896
920
|
const absoluteThumbPath = _path2.default.join(process.cwd(), "public", thumbPath);
|
|
897
921
|
try {
|
|
898
922
|
await _fs.promises.unlink(absoluteThumbPath);
|
|
@@ -1004,8 +1028,8 @@ async function handleRename(request) {
|
|
|
1004
1028
|
const newKey = "/" + newRelativePath;
|
|
1005
1029
|
if (meta[oldKey]) {
|
|
1006
1030
|
const entry = meta[oldKey];
|
|
1007
|
-
const oldThumbPaths =
|
|
1008
|
-
const newThumbPaths =
|
|
1031
|
+
const oldThumbPaths = _chunkX6F6IFY3js.getAllThumbnailPaths.call(void 0, oldKey);
|
|
1032
|
+
const newThumbPaths = _chunkX6F6IFY3js.getAllThumbnailPaths.call(void 0, newKey);
|
|
1009
1033
|
for (let i = 0; i < oldThumbPaths.length; i++) {
|
|
1010
1034
|
const oldThumbPath = _path2.default.join(process.cwd(), "public", oldThumbPaths[i]);
|
|
1011
1035
|
const newThumbPath = _path2.default.join(process.cwd(), "public", newThumbPaths[i]);
|
|
@@ -1089,7 +1113,7 @@ async function handleMoveStream(request) {
|
|
|
1089
1113
|
const fileCdnUrl = isInCloud && entry.c !== void 0 ? cdnUrls[entry.c] : void 0;
|
|
1090
1114
|
const isRemote = isInCloud && (!r2PublicUrl || fileCdnUrl !== r2PublicUrl);
|
|
1091
1115
|
const isPushedToR2 = isInCloud && r2PublicUrl && fileCdnUrl === r2PublicUrl;
|
|
1092
|
-
const hasProcessedThumbnails =
|
|
1116
|
+
const hasProcessedThumbnails = _chunkX6F6IFY3js.isProcessed.call(void 0, entry);
|
|
1093
1117
|
try {
|
|
1094
1118
|
if (isRemote && isImage) {
|
|
1095
1119
|
const remoteUrl = `${fileCdnUrl}${oldKey}`;
|
|
@@ -1152,8 +1176,8 @@ async function handleMoveStream(request) {
|
|
|
1152
1176
|
await _fs.promises.rename(absolutePath, newAbsolutePath);
|
|
1153
1177
|
const stats = await _fs.promises.stat(newAbsolutePath);
|
|
1154
1178
|
if (stats.isFile() && isImage && entry) {
|
|
1155
|
-
const oldThumbPaths =
|
|
1156
|
-
const newThumbPaths =
|
|
1179
|
+
const oldThumbPaths = _chunkX6F6IFY3js.getAllThumbnailPaths.call(void 0, oldKey);
|
|
1180
|
+
const newThumbPaths = _chunkX6F6IFY3js.getAllThumbnailPaths.call(void 0, newKey);
|
|
1157
1181
|
for (let j = 0; j < oldThumbPaths.length; j++) {
|
|
1158
1182
|
const oldThumbPath = _path2.default.join(process.cwd(), "public", oldThumbPaths[j]);
|
|
1159
1183
|
const newThumbPath = _path2.default.join(process.cwd(), "public", newThumbPaths[j]);
|
|
@@ -1279,8 +1303,8 @@ async function handleSync(request) {
|
|
|
1279
1303
|
})
|
|
1280
1304
|
);
|
|
1281
1305
|
urlsToPurge.push(`${publicUrl}${imageKey}`);
|
|
1282
|
-
if (!isRemote &&
|
|
1283
|
-
for (const thumbPath of
|
|
1306
|
+
if (!isRemote && _chunkX6F6IFY3js.isProcessed.call(void 0, entry)) {
|
|
1307
|
+
for (const thumbPath of _chunkX6F6IFY3js.getAllThumbnailPaths.call(void 0, imageKey)) {
|
|
1284
1308
|
const localPath = _path2.default.join(process.cwd(), "public", thumbPath);
|
|
1285
1309
|
try {
|
|
1286
1310
|
const fileBuffer = await _fs.promises.readFile(localPath);
|
|
@@ -1300,7 +1324,7 @@ async function handleSync(request) {
|
|
|
1300
1324
|
entry.c = cdnIndex;
|
|
1301
1325
|
if (!isRemote) {
|
|
1302
1326
|
const originalLocalPath = _path2.default.join(process.cwd(), "public", imageKey);
|
|
1303
|
-
for (const thumbPath of
|
|
1327
|
+
for (const thumbPath of _chunkX6F6IFY3js.getAllThumbnailPaths.call(void 0, imageKey)) {
|
|
1304
1328
|
const localPath = _path2.default.join(process.cwd(), "public", thumbPath);
|
|
1305
1329
|
try {
|
|
1306
1330
|
await _fs.promises.unlink(localPath);
|
|
@@ -1378,7 +1402,7 @@ async function handleReprocess(request) {
|
|
|
1378
1402
|
if (isInOurR2) {
|
|
1379
1403
|
updatedEntry.c = existingCdnIndex;
|
|
1380
1404
|
await uploadToCdn(imageKey);
|
|
1381
|
-
for (const thumbPath of
|
|
1405
|
+
for (const thumbPath of _chunkX6F6IFY3js.getAllThumbnailPaths.call(void 0, imageKey)) {
|
|
1382
1406
|
urlsToPurge.push(`${publicUrl}${thumbPath}`);
|
|
1383
1407
|
}
|
|
1384
1408
|
await deleteLocalThumbnails(imageKey);
|
|
@@ -1467,7 +1491,7 @@ async function handleUnprocessStream(request) {
|
|
|
1467
1491
|
await deleteLocalThumbnails(imageKey);
|
|
1468
1492
|
if (isInOurR2) {
|
|
1469
1493
|
await deleteThumbnailsFromCdn(imageKey);
|
|
1470
|
-
for (const thumbPath of
|
|
1494
|
+
for (const thumbPath of _chunkX6F6IFY3js.getAllThumbnailPaths.call(void 0, imageKey)) {
|
|
1471
1495
|
urlsToPurge.push(`${publicUrl}${thumbPath}`);
|
|
1472
1496
|
}
|
|
1473
1497
|
}
|
|
@@ -1607,7 +1631,7 @@ async function handleReprocessStream(request) {
|
|
|
1607
1631
|
if (isInOurR2) {
|
|
1608
1632
|
updatedEntry.c = existingCdnIndex;
|
|
1609
1633
|
await uploadToCdn(imageKey);
|
|
1610
|
-
for (const thumbPath of
|
|
1634
|
+
for (const thumbPath of _chunkX6F6IFY3js.getAllThumbnailPaths.call(void 0, imageKey)) {
|
|
1611
1635
|
urlsToPurge.push(`${publicUrl}${thumbPath}`);
|
|
1612
1636
|
}
|
|
1613
1637
|
await deleteLocalThumbnails(imageKey);
|
|
@@ -1678,7 +1702,7 @@ async function handleProcessAllStream() {
|
|
|
1678
1702
|
for (const [key, entry] of getFileEntries(meta)) {
|
|
1679
1703
|
const fileName = _path2.default.basename(key);
|
|
1680
1704
|
if (!isImageFile(fileName)) continue;
|
|
1681
|
-
if (!
|
|
1705
|
+
if (!_chunkX6F6IFY3js.isProcessed.call(void 0, entry)) {
|
|
1682
1706
|
imagesToProcess.push({ key, entry });
|
|
1683
1707
|
} else {
|
|
1684
1708
|
alreadyProcessed++;
|
|
@@ -1745,7 +1769,7 @@ async function handleProcessAllStream() {
|
|
|
1745
1769
|
}
|
|
1746
1770
|
if (isInOurR2) {
|
|
1747
1771
|
await uploadToCdn(key);
|
|
1748
|
-
for (const thumbPath of
|
|
1772
|
+
for (const thumbPath of _chunkX6F6IFY3js.getAllThumbnailPaths.call(void 0, key)) {
|
|
1749
1773
|
urlsToPurge.push(`${publicUrl}${thumbPath}`);
|
|
1750
1774
|
}
|
|
1751
1775
|
await deleteLocalThumbnails(key);
|
|
@@ -1764,7 +1788,7 @@ async function handleProcessAllStream() {
|
|
|
1764
1788
|
const trackedPaths = /* @__PURE__ */ new Set();
|
|
1765
1789
|
for (const [imageKey, entry] of getFileEntries(meta)) {
|
|
1766
1790
|
if (entry.c === void 0) {
|
|
1767
|
-
for (const thumbPath of
|
|
1791
|
+
for (const thumbPath of _chunkX6F6IFY3js.getAllThumbnailPaths.call(void 0, imageKey)) {
|
|
1768
1792
|
trackedPaths.add(thumbPath);
|
|
1769
1793
|
}
|
|
1770
1794
|
}
|
|
@@ -1965,8 +1989,8 @@ async function handleScanStream() {
|
|
|
1965
1989
|
const expectedThumbnails = /* @__PURE__ */ new Set();
|
|
1966
1990
|
const fileEntries = getFileEntries(meta);
|
|
1967
1991
|
for (const [imageKey, entry] of fileEntries) {
|
|
1968
|
-
if (entry.c === void 0 &&
|
|
1969
|
-
for (const thumbPath of
|
|
1992
|
+
if (entry.c === void 0 && _chunkX6F6IFY3js.isProcessed.call(void 0, entry)) {
|
|
1993
|
+
for (const thumbPath of _chunkX6F6IFY3js.getAllThumbnailPaths.call(void 0, imageKey)) {
|
|
1970
1994
|
expectedThumbnails.add(thumbPath);
|
|
1971
1995
|
}
|
|
1972
1996
|
}
|