@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.
@@ -2,7 +2,7 @@ import {
2
2
  getAllThumbnailPaths,
3
3
  getThumbnailPath,
4
4
  isProcessed
5
- } from "../chunk-VQJAJVAQ.mjs";
5
+ } from "../chunk-FOKLOMKO.mjs";
6
6
 
7
7
  // src/handlers/index.ts
8
8
  import { NextResponse as NextResponse6 } from "next/server";
@@ -343,6 +343,20 @@ function getExistingThumbnails(originalPath, entry) {
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";
@@ -462,6 +476,8 @@ 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
483
  if (isProcessed(metaEntry)) {
@@ -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
  }
@@ -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
  }