@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.
@@ -2,7 +2,7 @@ import {
2
2
  getAllThumbnailPaths,
3
3
  getThumbnailPath,
4
4
  isProcessed
5
- } from "../chunk-FOKLOMKO.mjs";
5
+ } from "../chunk-TRYWHLJ2.mjs";
6
6
 
7
7
  // src/handlers/index.ts
8
8
  import { NextResponse as NextResponse6 } from "next/server";
@@ -343,19 +343,25 @@ function getExistingThumbnails(originalPath, entry) {
343
343
  }
344
344
  return thumbnails;
345
345
  }
346
- function countCloudAndLocal(folderPrefix, fileEntries) {
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
- cloudCount++;
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;
@@ -477,6 +483,7 @@ 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) {
@@ -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 = countCloudAndLocal(folderPrefix, fileEntries);
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
  });
@@ -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 = countCloudAndLocal(folderPrefix, fileEntries);
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
  });