@gallop.software/studio 1.5.2 → 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-74IZDKCP.mjs → StudioUI-GAV4ZPGC.mjs} +51 -19
- package/dist/StudioUI-GAV4ZPGC.mjs.map +1 -0
- package/dist/{StudioUI-2UVUYHHA.js → StudioUI-U5BEIRJP.js} +51 -19
- package/dist/StudioUI-U5BEIRJP.js.map +1 -0
- package/dist/{chunk-FOKLOMKO.mjs → chunk-TRYWHLJ2.mjs} +1 -1
- package/dist/chunk-TRYWHLJ2.mjs.map +1 -0
- package/dist/{chunk-X6F6IFY3.js → chunk-VI6QG6WT.js} +1 -1
- package/dist/chunk-VI6QG6WT.js.map +1 -0
- package/dist/handlers/index.js +49 -39
- package/dist/handlers/index.js.map +1 -1
- package/dist/handlers/index.mjs +16 -6
- package/dist/handlers/index.mjs.map +1 -1
- package/dist/index.d.mts +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +3 -3
- package/dist/index.mjs +2 -2
- package/package.json +1 -1
- package/dist/StudioUI-2UVUYHHA.js.map +0 -1
- package/dist/StudioUI-74IZDKCP.mjs.map +0 -1
- package/dist/chunk-FOKLOMKO.mjs.map +0 -1
- package/dist/chunk-X6F6IFY3.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,32 +330,38 @@ 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
|
|
346
|
+
function countFileTypes(folderPrefix, fileEntries, cdnUrls, r2PublicUrl) {
|
|
347
347
|
let cloudCount = 0;
|
|
348
|
+
let remoteCount = 0;
|
|
348
349
|
let localCount = 0;
|
|
349
350
|
for (const [key, entry] of fileEntries) {
|
|
350
351
|
if (key.startsWith(folderPrefix)) {
|
|
351
352
|
if (entry.c !== void 0) {
|
|
352
|
-
|
|
353
|
+
const cdnUrl = cdnUrls[entry.c];
|
|
354
|
+
if (cdnUrl === r2PublicUrl) {
|
|
355
|
+
cloudCount++;
|
|
356
|
+
} else {
|
|
357
|
+
remoteCount++;
|
|
358
|
+
}
|
|
353
359
|
} else {
|
|
354
360
|
localCount++;
|
|
355
361
|
}
|
|
356
362
|
}
|
|
357
363
|
}
|
|
358
|
-
return { cloudCount, localCount };
|
|
364
|
+
return { cloudCount, remoteCount, localCount };
|
|
359
365
|
}
|
|
360
366
|
async function handleList(request) {
|
|
361
367
|
const searchParams = request.nextUrl.searchParams;
|
|
@@ -376,7 +382,7 @@ async function handleList(request) {
|
|
|
376
382
|
const imagesPrefix = imagesSubPath ? `/${imagesSubPath}/` : "/";
|
|
377
383
|
const allThumbnails = [];
|
|
378
384
|
for (const [key, entry] of fileEntries) {
|
|
379
|
-
if (
|
|
385
|
+
if (_chunkVI6QG6WTjs.isProcessed.call(void 0, entry)) {
|
|
380
386
|
const thumbnails = getExistingThumbnails(key, entry);
|
|
381
387
|
for (const thumb of thumbnails) {
|
|
382
388
|
allThumbnails.push({ ...thumb, originalKey: key });
|
|
@@ -477,10 +483,11 @@ async function handleList(request) {
|
|
|
477
483
|
const folderPath = relativePath ? `public/${relativePath}/${entry.name}` : `public/${entry.name}`;
|
|
478
484
|
let fileCount = 0;
|
|
479
485
|
let cloudCount = 0;
|
|
486
|
+
let remoteCount = 0;
|
|
480
487
|
let localCount = 0;
|
|
481
488
|
if (isImagesFolder) {
|
|
482
489
|
for (const [key, metaEntry] of fileEntries) {
|
|
483
|
-
if (
|
|
490
|
+
if (_chunkVI6QG6WTjs.isProcessed.call(void 0, metaEntry)) {
|
|
484
491
|
fileCount += getExistingThumbnails(key, metaEntry).length;
|
|
485
492
|
}
|
|
486
493
|
}
|
|
@@ -489,8 +496,9 @@ async function handleList(request) {
|
|
|
489
496
|
for (const k of metaKeys) {
|
|
490
497
|
if (k.startsWith(folderPrefix)) fileCount++;
|
|
491
498
|
}
|
|
492
|
-
const counts =
|
|
499
|
+
const counts = countFileTypes(folderPrefix, fileEntries, cdnUrls, r2PublicUrl);
|
|
493
500
|
cloudCount = counts.cloudCount;
|
|
501
|
+
remoteCount = counts.remoteCount;
|
|
494
502
|
localCount = counts.localCount;
|
|
495
503
|
}
|
|
496
504
|
items.push({
|
|
@@ -499,6 +507,7 @@ async function handleList(request) {
|
|
|
499
507
|
type: "folder",
|
|
500
508
|
fileCount,
|
|
501
509
|
cloudCount,
|
|
510
|
+
remoteCount,
|
|
502
511
|
localCount,
|
|
503
512
|
isProtected: isImagesFolder
|
|
504
513
|
});
|
|
@@ -510,7 +519,7 @@ async function handleList(request) {
|
|
|
510
519
|
if (!relativePath && !seenFolders.has("images")) {
|
|
511
520
|
let thumbnailCount = 0;
|
|
512
521
|
for (const [key, entry] of fileEntries) {
|
|
513
|
-
if (
|
|
522
|
+
if (_chunkVI6QG6WTjs.isProcessed.call(void 0, entry)) {
|
|
514
523
|
thumbnailCount += getExistingThumbnails(key, entry).length;
|
|
515
524
|
}
|
|
516
525
|
}
|
|
@@ -542,13 +551,14 @@ async function handleList(request) {
|
|
|
542
551
|
for (const k of metaKeys) {
|
|
543
552
|
if (k.startsWith(folderPrefix)) fileCount++;
|
|
544
553
|
}
|
|
545
|
-
const counts =
|
|
554
|
+
const counts = countFileTypes(folderPrefix, fileEntries, cdnUrls, r2PublicUrl);
|
|
546
555
|
items.push({
|
|
547
556
|
name: folderName,
|
|
548
557
|
path: relativePath ? `public/${relativePath}/${folderName}` : `public/${folderName}`,
|
|
549
558
|
type: "folder",
|
|
550
559
|
fileCount,
|
|
551
560
|
cloudCount: counts.cloudCount,
|
|
561
|
+
remoteCount: counts.remoteCount,
|
|
552
562
|
localCount: counts.localCount,
|
|
553
563
|
isProtected: isInsideImagesFolder
|
|
554
564
|
});
|
|
@@ -562,9 +572,9 @@ async function handleList(request) {
|
|
|
562
572
|
let thumbnail;
|
|
563
573
|
let hasThumbnail = false;
|
|
564
574
|
let fileSize;
|
|
565
|
-
const entryIsProcessed =
|
|
575
|
+
const entryIsProcessed = _chunkVI6QG6WTjs.isProcessed.call(void 0, entry);
|
|
566
576
|
if (isImage && entryIsProcessed) {
|
|
567
|
-
const thumbPath =
|
|
577
|
+
const thumbPath = _chunkVI6QG6WTjs.getThumbnailPath.call(void 0, key, "sm");
|
|
568
578
|
if (isPushedToCloud && entry.c !== void 0) {
|
|
569
579
|
const cdnUrl = cdnUrls[entry.c];
|
|
570
580
|
if (cdnUrl) {
|
|
@@ -643,9 +653,9 @@ async function handleSearch(request) {
|
|
|
643
653
|
const isRemote = isPushedToCloud && (!r2PublicUrl || fileCdnUrl !== r2PublicUrl);
|
|
644
654
|
let thumbnail;
|
|
645
655
|
let hasThumbnail = false;
|
|
646
|
-
const entryIsProcessed =
|
|
656
|
+
const entryIsProcessed = _chunkVI6QG6WTjs.isProcessed.call(void 0, entry);
|
|
647
657
|
if (isImage && entryIsProcessed) {
|
|
648
|
-
const thumbPath =
|
|
658
|
+
const thumbPath = _chunkVI6QG6WTjs.getThumbnailPath.call(void 0, key, "sm");
|
|
649
659
|
if (isPushedToCloud && entry.c !== void 0) {
|
|
650
660
|
const cdnUrl = cdnUrls[entry.c];
|
|
651
661
|
if (cdnUrl) {
|
|
@@ -900,7 +910,7 @@ async function handleDelete(request) {
|
|
|
900
910
|
if (key.startsWith(prefix) || key === imageKey) {
|
|
901
911
|
const keyEntry = meta[key];
|
|
902
912
|
if (keyEntry && keyEntry.c === void 0) {
|
|
903
|
-
for (const thumbPath of
|
|
913
|
+
for (const thumbPath of _chunkVI6QG6WTjs.getAllThumbnailPaths.call(void 0, key)) {
|
|
904
914
|
const absoluteThumbPath = _path2.default.join(process.cwd(), "public", thumbPath);
|
|
905
915
|
try {
|
|
906
916
|
await _fs.promises.unlink(absoluteThumbPath);
|
|
@@ -916,7 +926,7 @@ async function handleDelete(request) {
|
|
|
916
926
|
const isInImagesFolder = itemPath.startsWith("public/images/");
|
|
917
927
|
if (!isInImagesFolder && entry) {
|
|
918
928
|
if (!isPushedToCloud) {
|
|
919
|
-
for (const thumbPath of
|
|
929
|
+
for (const thumbPath of _chunkVI6QG6WTjs.getAllThumbnailPaths.call(void 0, imageKey)) {
|
|
920
930
|
const absoluteThumbPath = _path2.default.join(process.cwd(), "public", thumbPath);
|
|
921
931
|
try {
|
|
922
932
|
await _fs.promises.unlink(absoluteThumbPath);
|
|
@@ -1028,8 +1038,8 @@ async function handleRename(request) {
|
|
|
1028
1038
|
const newKey = "/" + newRelativePath;
|
|
1029
1039
|
if (meta[oldKey]) {
|
|
1030
1040
|
const entry = meta[oldKey];
|
|
1031
|
-
const oldThumbPaths =
|
|
1032
|
-
const newThumbPaths =
|
|
1041
|
+
const oldThumbPaths = _chunkVI6QG6WTjs.getAllThumbnailPaths.call(void 0, oldKey);
|
|
1042
|
+
const newThumbPaths = _chunkVI6QG6WTjs.getAllThumbnailPaths.call(void 0, newKey);
|
|
1033
1043
|
for (let i = 0; i < oldThumbPaths.length; i++) {
|
|
1034
1044
|
const oldThumbPath = _path2.default.join(process.cwd(), "public", oldThumbPaths[i]);
|
|
1035
1045
|
const newThumbPath = _path2.default.join(process.cwd(), "public", newThumbPaths[i]);
|
|
@@ -1113,7 +1123,7 @@ async function handleMoveStream(request) {
|
|
|
1113
1123
|
const fileCdnUrl = isInCloud && entry.c !== void 0 ? cdnUrls[entry.c] : void 0;
|
|
1114
1124
|
const isRemote = isInCloud && (!r2PublicUrl || fileCdnUrl !== r2PublicUrl);
|
|
1115
1125
|
const isPushedToR2 = isInCloud && r2PublicUrl && fileCdnUrl === r2PublicUrl;
|
|
1116
|
-
const hasProcessedThumbnails =
|
|
1126
|
+
const hasProcessedThumbnails = _chunkVI6QG6WTjs.isProcessed.call(void 0, entry);
|
|
1117
1127
|
try {
|
|
1118
1128
|
if (isRemote && isImage) {
|
|
1119
1129
|
const remoteUrl = `${fileCdnUrl}${oldKey}`;
|
|
@@ -1176,8 +1186,8 @@ async function handleMoveStream(request) {
|
|
|
1176
1186
|
await _fs.promises.rename(absolutePath, newAbsolutePath);
|
|
1177
1187
|
const stats = await _fs.promises.stat(newAbsolutePath);
|
|
1178
1188
|
if (stats.isFile() && isImage && entry) {
|
|
1179
|
-
const oldThumbPaths =
|
|
1180
|
-
const newThumbPaths =
|
|
1189
|
+
const oldThumbPaths = _chunkVI6QG6WTjs.getAllThumbnailPaths.call(void 0, oldKey);
|
|
1190
|
+
const newThumbPaths = _chunkVI6QG6WTjs.getAllThumbnailPaths.call(void 0, newKey);
|
|
1181
1191
|
for (let j = 0; j < oldThumbPaths.length; j++) {
|
|
1182
1192
|
const oldThumbPath = _path2.default.join(process.cwd(), "public", oldThumbPaths[j]);
|
|
1183
1193
|
const newThumbPath = _path2.default.join(process.cwd(), "public", newThumbPaths[j]);
|
|
@@ -1303,8 +1313,8 @@ async function handleSync(request) {
|
|
|
1303
1313
|
})
|
|
1304
1314
|
);
|
|
1305
1315
|
urlsToPurge.push(`${publicUrl}${imageKey}`);
|
|
1306
|
-
if (!isRemote &&
|
|
1307
|
-
for (const thumbPath of
|
|
1316
|
+
if (!isRemote && _chunkVI6QG6WTjs.isProcessed.call(void 0, entry)) {
|
|
1317
|
+
for (const thumbPath of _chunkVI6QG6WTjs.getAllThumbnailPaths.call(void 0, imageKey)) {
|
|
1308
1318
|
const localPath = _path2.default.join(process.cwd(), "public", thumbPath);
|
|
1309
1319
|
try {
|
|
1310
1320
|
const fileBuffer = await _fs.promises.readFile(localPath);
|
|
@@ -1324,7 +1334,7 @@ async function handleSync(request) {
|
|
|
1324
1334
|
entry.c = cdnIndex;
|
|
1325
1335
|
if (!isRemote) {
|
|
1326
1336
|
const originalLocalPath = _path2.default.join(process.cwd(), "public", imageKey);
|
|
1327
|
-
for (const thumbPath of
|
|
1337
|
+
for (const thumbPath of _chunkVI6QG6WTjs.getAllThumbnailPaths.call(void 0, imageKey)) {
|
|
1328
1338
|
const localPath = _path2.default.join(process.cwd(), "public", thumbPath);
|
|
1329
1339
|
try {
|
|
1330
1340
|
await _fs.promises.unlink(localPath);
|
|
@@ -1402,7 +1412,7 @@ async function handleReprocess(request) {
|
|
|
1402
1412
|
if (isInOurR2) {
|
|
1403
1413
|
updatedEntry.c = existingCdnIndex;
|
|
1404
1414
|
await uploadToCdn(imageKey);
|
|
1405
|
-
for (const thumbPath of
|
|
1415
|
+
for (const thumbPath of _chunkVI6QG6WTjs.getAllThumbnailPaths.call(void 0, imageKey)) {
|
|
1406
1416
|
urlsToPurge.push(`${publicUrl}${thumbPath}`);
|
|
1407
1417
|
}
|
|
1408
1418
|
await deleteLocalThumbnails(imageKey);
|
|
@@ -1491,7 +1501,7 @@ async function handleUnprocessStream(request) {
|
|
|
1491
1501
|
await deleteLocalThumbnails(imageKey);
|
|
1492
1502
|
if (isInOurR2) {
|
|
1493
1503
|
await deleteThumbnailsFromCdn(imageKey);
|
|
1494
|
-
for (const thumbPath of
|
|
1504
|
+
for (const thumbPath of _chunkVI6QG6WTjs.getAllThumbnailPaths.call(void 0, imageKey)) {
|
|
1495
1505
|
urlsToPurge.push(`${publicUrl}${thumbPath}`);
|
|
1496
1506
|
}
|
|
1497
1507
|
}
|
|
@@ -1631,7 +1641,7 @@ async function handleReprocessStream(request) {
|
|
|
1631
1641
|
if (isInOurR2) {
|
|
1632
1642
|
updatedEntry.c = existingCdnIndex;
|
|
1633
1643
|
await uploadToCdn(imageKey);
|
|
1634
|
-
for (const thumbPath of
|
|
1644
|
+
for (const thumbPath of _chunkVI6QG6WTjs.getAllThumbnailPaths.call(void 0, imageKey)) {
|
|
1635
1645
|
urlsToPurge.push(`${publicUrl}${thumbPath}`);
|
|
1636
1646
|
}
|
|
1637
1647
|
await deleteLocalThumbnails(imageKey);
|
|
@@ -1702,7 +1712,7 @@ async function handleProcessAllStream() {
|
|
|
1702
1712
|
for (const [key, entry] of getFileEntries(meta)) {
|
|
1703
1713
|
const fileName = _path2.default.basename(key);
|
|
1704
1714
|
if (!isImageFile(fileName)) continue;
|
|
1705
|
-
if (!
|
|
1715
|
+
if (!_chunkVI6QG6WTjs.isProcessed.call(void 0, entry)) {
|
|
1706
1716
|
imagesToProcess.push({ key, entry });
|
|
1707
1717
|
} else {
|
|
1708
1718
|
alreadyProcessed++;
|
|
@@ -1769,7 +1779,7 @@ async function handleProcessAllStream() {
|
|
|
1769
1779
|
}
|
|
1770
1780
|
if (isInOurR2) {
|
|
1771
1781
|
await uploadToCdn(key);
|
|
1772
|
-
for (const thumbPath of
|
|
1782
|
+
for (const thumbPath of _chunkVI6QG6WTjs.getAllThumbnailPaths.call(void 0, key)) {
|
|
1773
1783
|
urlsToPurge.push(`${publicUrl}${thumbPath}`);
|
|
1774
1784
|
}
|
|
1775
1785
|
await deleteLocalThumbnails(key);
|
|
@@ -1788,7 +1798,7 @@ async function handleProcessAllStream() {
|
|
|
1788
1798
|
const trackedPaths = /* @__PURE__ */ new Set();
|
|
1789
1799
|
for (const [imageKey, entry] of getFileEntries(meta)) {
|
|
1790
1800
|
if (entry.c === void 0) {
|
|
1791
|
-
for (const thumbPath of
|
|
1801
|
+
for (const thumbPath of _chunkVI6QG6WTjs.getAllThumbnailPaths.call(void 0, imageKey)) {
|
|
1792
1802
|
trackedPaths.add(thumbPath);
|
|
1793
1803
|
}
|
|
1794
1804
|
}
|
|
@@ -1989,8 +1999,8 @@ async function handleScanStream() {
|
|
|
1989
1999
|
const expectedThumbnails = /* @__PURE__ */ new Set();
|
|
1990
2000
|
const fileEntries = getFileEntries(meta);
|
|
1991
2001
|
for (const [imageKey, entry] of fileEntries) {
|
|
1992
|
-
if (entry.c === void 0 &&
|
|
1993
|
-
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)) {
|
|
1994
2004
|
expectedThumbnails.add(thumbPath);
|
|
1995
2005
|
}
|
|
1996
2006
|
}
|