@gallop.software/studio 1.5.1 → 1.5.3
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-BHFZVR57.mjs → StudioUI-GAV4ZPGC.mjs} +118 -10
- package/dist/StudioUI-GAV4ZPGC.mjs.map +1 -0
- package/dist/{StudioUI-GULMXZQF.js → StudioUI-U5BEIRJP.js} +118 -10
- package/dist/StudioUI-U5BEIRJP.js.map +1 -0
- package/dist/{chunk-VQJAJVAQ.mjs → chunk-TRYWHLJ2.mjs} +1 -1
- package/dist/chunk-TRYWHLJ2.mjs.map +1 -0
- package/dist/{chunk-WOHZ4LYG.js → chunk-VI6QG6WT.js} +1 -1
- package/dist/chunk-VI6QG6WT.js.map +1 -0
- package/dist/handlers/index.js +68 -34
- package/dist/handlers/index.js.map +1 -1
- package/dist/handlers/index.mjs +35 -1
- package/dist/handlers/index.mjs.map +1 -1
- package/dist/index.d.mts +3 -0
- package/dist/index.d.ts +3 -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 R2 cloud files in folder\n remoteCount?: number // Number of remote (imported URL) 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":";AAuFO,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-VI6QG6WT.js","../src/types.ts"],"names":["ext","base","outputExt"],"mappings":"AAAA;ACuFO,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;AD7F2B;AACA;AACA;AACA;AACA;AACA","file":"/Users/chrisb/Sites/studio/dist/chunk-VI6QG6WT.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 R2 cloud files in folder\n remoteCount?: number // Number of remote (imported URL) 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 _chunkVI6QG6WTjs = require('../chunk-VI6QG6WT.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 _chunkVI6QG6WTjs.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 _chunkVI6QG6WTjs.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 _chunkVI6QG6WTjs.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 _chunkVI6QG6WTjs.getAllThumbnailPaths.call(void 0, imageKey)) {
|
|
317
317
|
try {
|
|
318
318
|
await r2.send(
|
|
319
319
|
new (0, _clients3.DeleteObjectCommand)({
|
|
@@ -330,19 +330,39 @@ 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: _chunkVI6QG6WTjs.getThumbnailPath.call(void 0, originalPath, "full"), size: "f" });
|
|
334
334
|
}
|
|
335
335
|
if (entry.lg) {
|
|
336
|
-
thumbnails.push({ path:
|
|
336
|
+
thumbnails.push({ path: _chunkVI6QG6WTjs.getThumbnailPath.call(void 0, originalPath, "lg"), size: "lg" });
|
|
337
337
|
}
|
|
338
338
|
if (entry.md) {
|
|
339
|
-
thumbnails.push({ path:
|
|
339
|
+
thumbnails.push({ path: _chunkVI6QG6WTjs.getThumbnailPath.call(void 0, originalPath, "md"), size: "md" });
|
|
340
340
|
}
|
|
341
341
|
if (entry.sm) {
|
|
342
|
-
thumbnails.push({ path:
|
|
342
|
+
thumbnails.push({ path: _chunkVI6QG6WTjs.getThumbnailPath.call(void 0, originalPath, "sm"), size: "sm" });
|
|
343
343
|
}
|
|
344
344
|
return thumbnails;
|
|
345
345
|
}
|
|
346
|
+
function countFileTypes(folderPrefix, fileEntries, cdnUrls, r2PublicUrl) {
|
|
347
|
+
let cloudCount = 0;
|
|
348
|
+
let remoteCount = 0;
|
|
349
|
+
let localCount = 0;
|
|
350
|
+
for (const [key, entry] of fileEntries) {
|
|
351
|
+
if (key.startsWith(folderPrefix)) {
|
|
352
|
+
if (entry.c !== void 0) {
|
|
353
|
+
const cdnUrl = cdnUrls[entry.c];
|
|
354
|
+
if (cdnUrl === r2PublicUrl) {
|
|
355
|
+
cloudCount++;
|
|
356
|
+
} else {
|
|
357
|
+
remoteCount++;
|
|
358
|
+
}
|
|
359
|
+
} else {
|
|
360
|
+
localCount++;
|
|
361
|
+
}
|
|
362
|
+
}
|
|
363
|
+
}
|
|
364
|
+
return { cloudCount, remoteCount, localCount };
|
|
365
|
+
}
|
|
346
366
|
async function handleList(request) {
|
|
347
367
|
const searchParams = request.nextUrl.searchParams;
|
|
348
368
|
const requestedPath = searchParams.get("path") || "public";
|
|
@@ -362,7 +382,7 @@ async function handleList(request) {
|
|
|
362
382
|
const imagesPrefix = imagesSubPath ? `/${imagesSubPath}/` : "/";
|
|
363
383
|
const allThumbnails = [];
|
|
364
384
|
for (const [key, entry] of fileEntries) {
|
|
365
|
-
if (
|
|
385
|
+
if (_chunkVI6QG6WTjs.isProcessed.call(void 0, entry)) {
|
|
366
386
|
const thumbnails = getExistingThumbnails(key, entry);
|
|
367
387
|
for (const thumb of thumbnails) {
|
|
368
388
|
allThumbnails.push({ ...thumb, originalKey: key });
|
|
@@ -462,9 +482,12 @@ async function handleList(request) {
|
|
|
462
482
|
const isImagesFolder = entry.name === "images" && !relativePath;
|
|
463
483
|
const folderPath = relativePath ? `public/${relativePath}/${entry.name}` : `public/${entry.name}`;
|
|
464
484
|
let fileCount = 0;
|
|
485
|
+
let cloudCount = 0;
|
|
486
|
+
let remoteCount = 0;
|
|
487
|
+
let localCount = 0;
|
|
465
488
|
if (isImagesFolder) {
|
|
466
489
|
for (const [key, metaEntry] of fileEntries) {
|
|
467
|
-
if (
|
|
490
|
+
if (_chunkVI6QG6WTjs.isProcessed.call(void 0, metaEntry)) {
|
|
468
491
|
fileCount += getExistingThumbnails(key, metaEntry).length;
|
|
469
492
|
}
|
|
470
493
|
}
|
|
@@ -473,12 +496,19 @@ async function handleList(request) {
|
|
|
473
496
|
for (const k of metaKeys) {
|
|
474
497
|
if (k.startsWith(folderPrefix)) fileCount++;
|
|
475
498
|
}
|
|
499
|
+
const counts = countFileTypes(folderPrefix, fileEntries, cdnUrls, r2PublicUrl);
|
|
500
|
+
cloudCount = counts.cloudCount;
|
|
501
|
+
remoteCount = counts.remoteCount;
|
|
502
|
+
localCount = counts.localCount;
|
|
476
503
|
}
|
|
477
504
|
items.push({
|
|
478
505
|
name: entry.name,
|
|
479
506
|
path: folderPath,
|
|
480
507
|
type: "folder",
|
|
481
508
|
fileCount,
|
|
509
|
+
cloudCount,
|
|
510
|
+
remoteCount,
|
|
511
|
+
localCount,
|
|
482
512
|
isProtected: isImagesFolder
|
|
483
513
|
});
|
|
484
514
|
}
|
|
@@ -489,7 +519,7 @@ async function handleList(request) {
|
|
|
489
519
|
if (!relativePath && !seenFolders.has("images")) {
|
|
490
520
|
let thumbnailCount = 0;
|
|
491
521
|
for (const [key, entry] of fileEntries) {
|
|
492
|
-
if (
|
|
522
|
+
if (_chunkVI6QG6WTjs.isProcessed.call(void 0, entry)) {
|
|
493
523
|
thumbnailCount += getExistingThumbnails(key, entry).length;
|
|
494
524
|
}
|
|
495
525
|
}
|
|
@@ -521,11 +551,15 @@ async function handleList(request) {
|
|
|
521
551
|
for (const k of metaKeys) {
|
|
522
552
|
if (k.startsWith(folderPrefix)) fileCount++;
|
|
523
553
|
}
|
|
554
|
+
const counts = countFileTypes(folderPrefix, fileEntries, cdnUrls, r2PublicUrl);
|
|
524
555
|
items.push({
|
|
525
556
|
name: folderName,
|
|
526
557
|
path: relativePath ? `public/${relativePath}/${folderName}` : `public/${folderName}`,
|
|
527
558
|
type: "folder",
|
|
528
559
|
fileCount,
|
|
560
|
+
cloudCount: counts.cloudCount,
|
|
561
|
+
remoteCount: counts.remoteCount,
|
|
562
|
+
localCount: counts.localCount,
|
|
529
563
|
isProtected: isInsideImagesFolder
|
|
530
564
|
});
|
|
531
565
|
}
|
|
@@ -538,9 +572,9 @@ async function handleList(request) {
|
|
|
538
572
|
let thumbnail;
|
|
539
573
|
let hasThumbnail = false;
|
|
540
574
|
let fileSize;
|
|
541
|
-
const entryIsProcessed =
|
|
575
|
+
const entryIsProcessed = _chunkVI6QG6WTjs.isProcessed.call(void 0, entry);
|
|
542
576
|
if (isImage && entryIsProcessed) {
|
|
543
|
-
const thumbPath =
|
|
577
|
+
const thumbPath = _chunkVI6QG6WTjs.getThumbnailPath.call(void 0, key, "sm");
|
|
544
578
|
if (isPushedToCloud && entry.c !== void 0) {
|
|
545
579
|
const cdnUrl = cdnUrls[entry.c];
|
|
546
580
|
if (cdnUrl) {
|
|
@@ -619,9 +653,9 @@ async function handleSearch(request) {
|
|
|
619
653
|
const isRemote = isPushedToCloud && (!r2PublicUrl || fileCdnUrl !== r2PublicUrl);
|
|
620
654
|
let thumbnail;
|
|
621
655
|
let hasThumbnail = false;
|
|
622
|
-
const entryIsProcessed =
|
|
656
|
+
const entryIsProcessed = _chunkVI6QG6WTjs.isProcessed.call(void 0, entry);
|
|
623
657
|
if (isImage && entryIsProcessed) {
|
|
624
|
-
const thumbPath =
|
|
658
|
+
const thumbPath = _chunkVI6QG6WTjs.getThumbnailPath.call(void 0, key, "sm");
|
|
625
659
|
if (isPushedToCloud && entry.c !== void 0) {
|
|
626
660
|
const cdnUrl = cdnUrls[entry.c];
|
|
627
661
|
if (cdnUrl) {
|
|
@@ -876,7 +910,7 @@ async function handleDelete(request) {
|
|
|
876
910
|
if (key.startsWith(prefix) || key === imageKey) {
|
|
877
911
|
const keyEntry = meta[key];
|
|
878
912
|
if (keyEntry && keyEntry.c === void 0) {
|
|
879
|
-
for (const thumbPath of
|
|
913
|
+
for (const thumbPath of _chunkVI6QG6WTjs.getAllThumbnailPaths.call(void 0, key)) {
|
|
880
914
|
const absoluteThumbPath = _path2.default.join(process.cwd(), "public", thumbPath);
|
|
881
915
|
try {
|
|
882
916
|
await _fs.promises.unlink(absoluteThumbPath);
|
|
@@ -892,7 +926,7 @@ async function handleDelete(request) {
|
|
|
892
926
|
const isInImagesFolder = itemPath.startsWith("public/images/");
|
|
893
927
|
if (!isInImagesFolder && entry) {
|
|
894
928
|
if (!isPushedToCloud) {
|
|
895
|
-
for (const thumbPath of
|
|
929
|
+
for (const thumbPath of _chunkVI6QG6WTjs.getAllThumbnailPaths.call(void 0, imageKey)) {
|
|
896
930
|
const absoluteThumbPath = _path2.default.join(process.cwd(), "public", thumbPath);
|
|
897
931
|
try {
|
|
898
932
|
await _fs.promises.unlink(absoluteThumbPath);
|
|
@@ -1004,8 +1038,8 @@ async function handleRename(request) {
|
|
|
1004
1038
|
const newKey = "/" + newRelativePath;
|
|
1005
1039
|
if (meta[oldKey]) {
|
|
1006
1040
|
const entry = meta[oldKey];
|
|
1007
|
-
const oldThumbPaths =
|
|
1008
|
-
const newThumbPaths =
|
|
1041
|
+
const oldThumbPaths = _chunkVI6QG6WTjs.getAllThumbnailPaths.call(void 0, oldKey);
|
|
1042
|
+
const newThumbPaths = _chunkVI6QG6WTjs.getAllThumbnailPaths.call(void 0, newKey);
|
|
1009
1043
|
for (let i = 0; i < oldThumbPaths.length; i++) {
|
|
1010
1044
|
const oldThumbPath = _path2.default.join(process.cwd(), "public", oldThumbPaths[i]);
|
|
1011
1045
|
const newThumbPath = _path2.default.join(process.cwd(), "public", newThumbPaths[i]);
|
|
@@ -1089,7 +1123,7 @@ async function handleMoveStream(request) {
|
|
|
1089
1123
|
const fileCdnUrl = isInCloud && entry.c !== void 0 ? cdnUrls[entry.c] : void 0;
|
|
1090
1124
|
const isRemote = isInCloud && (!r2PublicUrl || fileCdnUrl !== r2PublicUrl);
|
|
1091
1125
|
const isPushedToR2 = isInCloud && r2PublicUrl && fileCdnUrl === r2PublicUrl;
|
|
1092
|
-
const hasProcessedThumbnails =
|
|
1126
|
+
const hasProcessedThumbnails = _chunkVI6QG6WTjs.isProcessed.call(void 0, entry);
|
|
1093
1127
|
try {
|
|
1094
1128
|
if (isRemote && isImage) {
|
|
1095
1129
|
const remoteUrl = `${fileCdnUrl}${oldKey}`;
|
|
@@ -1152,8 +1186,8 @@ async function handleMoveStream(request) {
|
|
|
1152
1186
|
await _fs.promises.rename(absolutePath, newAbsolutePath);
|
|
1153
1187
|
const stats = await _fs.promises.stat(newAbsolutePath);
|
|
1154
1188
|
if (stats.isFile() && isImage && entry) {
|
|
1155
|
-
const oldThumbPaths =
|
|
1156
|
-
const newThumbPaths =
|
|
1189
|
+
const oldThumbPaths = _chunkVI6QG6WTjs.getAllThumbnailPaths.call(void 0, oldKey);
|
|
1190
|
+
const newThumbPaths = _chunkVI6QG6WTjs.getAllThumbnailPaths.call(void 0, newKey);
|
|
1157
1191
|
for (let j = 0; j < oldThumbPaths.length; j++) {
|
|
1158
1192
|
const oldThumbPath = _path2.default.join(process.cwd(), "public", oldThumbPaths[j]);
|
|
1159
1193
|
const newThumbPath = _path2.default.join(process.cwd(), "public", newThumbPaths[j]);
|
|
@@ -1279,8 +1313,8 @@ async function handleSync(request) {
|
|
|
1279
1313
|
})
|
|
1280
1314
|
);
|
|
1281
1315
|
urlsToPurge.push(`${publicUrl}${imageKey}`);
|
|
1282
|
-
if (!isRemote &&
|
|
1283
|
-
for (const thumbPath of
|
|
1316
|
+
if (!isRemote && _chunkVI6QG6WTjs.isProcessed.call(void 0, entry)) {
|
|
1317
|
+
for (const thumbPath of _chunkVI6QG6WTjs.getAllThumbnailPaths.call(void 0, imageKey)) {
|
|
1284
1318
|
const localPath = _path2.default.join(process.cwd(), "public", thumbPath);
|
|
1285
1319
|
try {
|
|
1286
1320
|
const fileBuffer = await _fs.promises.readFile(localPath);
|
|
@@ -1300,7 +1334,7 @@ async function handleSync(request) {
|
|
|
1300
1334
|
entry.c = cdnIndex;
|
|
1301
1335
|
if (!isRemote) {
|
|
1302
1336
|
const originalLocalPath = _path2.default.join(process.cwd(), "public", imageKey);
|
|
1303
|
-
for (const thumbPath of
|
|
1337
|
+
for (const thumbPath of _chunkVI6QG6WTjs.getAllThumbnailPaths.call(void 0, imageKey)) {
|
|
1304
1338
|
const localPath = _path2.default.join(process.cwd(), "public", thumbPath);
|
|
1305
1339
|
try {
|
|
1306
1340
|
await _fs.promises.unlink(localPath);
|
|
@@ -1378,7 +1412,7 @@ async function handleReprocess(request) {
|
|
|
1378
1412
|
if (isInOurR2) {
|
|
1379
1413
|
updatedEntry.c = existingCdnIndex;
|
|
1380
1414
|
await uploadToCdn(imageKey);
|
|
1381
|
-
for (const thumbPath of
|
|
1415
|
+
for (const thumbPath of _chunkVI6QG6WTjs.getAllThumbnailPaths.call(void 0, imageKey)) {
|
|
1382
1416
|
urlsToPurge.push(`${publicUrl}${thumbPath}`);
|
|
1383
1417
|
}
|
|
1384
1418
|
await deleteLocalThumbnails(imageKey);
|
|
@@ -1467,7 +1501,7 @@ async function handleUnprocessStream(request) {
|
|
|
1467
1501
|
await deleteLocalThumbnails(imageKey);
|
|
1468
1502
|
if (isInOurR2) {
|
|
1469
1503
|
await deleteThumbnailsFromCdn(imageKey);
|
|
1470
|
-
for (const thumbPath of
|
|
1504
|
+
for (const thumbPath of _chunkVI6QG6WTjs.getAllThumbnailPaths.call(void 0, imageKey)) {
|
|
1471
1505
|
urlsToPurge.push(`${publicUrl}${thumbPath}`);
|
|
1472
1506
|
}
|
|
1473
1507
|
}
|
|
@@ -1607,7 +1641,7 @@ async function handleReprocessStream(request) {
|
|
|
1607
1641
|
if (isInOurR2) {
|
|
1608
1642
|
updatedEntry.c = existingCdnIndex;
|
|
1609
1643
|
await uploadToCdn(imageKey);
|
|
1610
|
-
for (const thumbPath of
|
|
1644
|
+
for (const thumbPath of _chunkVI6QG6WTjs.getAllThumbnailPaths.call(void 0, imageKey)) {
|
|
1611
1645
|
urlsToPurge.push(`${publicUrl}${thumbPath}`);
|
|
1612
1646
|
}
|
|
1613
1647
|
await deleteLocalThumbnails(imageKey);
|
|
@@ -1678,7 +1712,7 @@ async function handleProcessAllStream() {
|
|
|
1678
1712
|
for (const [key, entry] of getFileEntries(meta)) {
|
|
1679
1713
|
const fileName = _path2.default.basename(key);
|
|
1680
1714
|
if (!isImageFile(fileName)) continue;
|
|
1681
|
-
if (!
|
|
1715
|
+
if (!_chunkVI6QG6WTjs.isProcessed.call(void 0, entry)) {
|
|
1682
1716
|
imagesToProcess.push({ key, entry });
|
|
1683
1717
|
} else {
|
|
1684
1718
|
alreadyProcessed++;
|
|
@@ -1745,7 +1779,7 @@ async function handleProcessAllStream() {
|
|
|
1745
1779
|
}
|
|
1746
1780
|
if (isInOurR2) {
|
|
1747
1781
|
await uploadToCdn(key);
|
|
1748
|
-
for (const thumbPath of
|
|
1782
|
+
for (const thumbPath of _chunkVI6QG6WTjs.getAllThumbnailPaths.call(void 0, key)) {
|
|
1749
1783
|
urlsToPurge.push(`${publicUrl}${thumbPath}`);
|
|
1750
1784
|
}
|
|
1751
1785
|
await deleteLocalThumbnails(key);
|
|
@@ -1764,7 +1798,7 @@ async function handleProcessAllStream() {
|
|
|
1764
1798
|
const trackedPaths = /* @__PURE__ */ new Set();
|
|
1765
1799
|
for (const [imageKey, entry] of getFileEntries(meta)) {
|
|
1766
1800
|
if (entry.c === void 0) {
|
|
1767
|
-
for (const thumbPath of
|
|
1801
|
+
for (const thumbPath of _chunkVI6QG6WTjs.getAllThumbnailPaths.call(void 0, imageKey)) {
|
|
1768
1802
|
trackedPaths.add(thumbPath);
|
|
1769
1803
|
}
|
|
1770
1804
|
}
|
|
@@ -1965,8 +1999,8 @@ async function handleScanStream() {
|
|
|
1965
1999
|
const expectedThumbnails = /* @__PURE__ */ new Set();
|
|
1966
2000
|
const fileEntries = getFileEntries(meta);
|
|
1967
2001
|
for (const [imageKey, entry] of fileEntries) {
|
|
1968
|
-
if (entry.c === void 0 &&
|
|
1969
|
-
for (const thumbPath of
|
|
2002
|
+
if (entry.c === void 0 && _chunkVI6QG6WTjs.isProcessed.call(void 0, entry)) {
|
|
2003
|
+
for (const thumbPath of _chunkVI6QG6WTjs.getAllThumbnailPaths.call(void 0, imageKey)) {
|
|
1970
2004
|
expectedThumbnails.add(thumbPath);
|
|
1971
2005
|
}
|
|
1972
2006
|
}
|