@gallop.software/studio 2.3.81 → 2.3.82
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/server/index.js +34 -10
- package/dist/server/index.js.map +1 -1
- package/package.json +1 -1
package/dist/server/index.js
CHANGED
|
@@ -454,7 +454,10 @@ function streamResponse(stream, init) {
|
|
|
454
454
|
function getExistingThumbnails(originalPath, entry) {
|
|
455
455
|
const thumbnails = [];
|
|
456
456
|
if (entry.f) {
|
|
457
|
-
thumbnails.push({
|
|
457
|
+
thumbnails.push({
|
|
458
|
+
path: getThumbnailPath(originalPath, "full"),
|
|
459
|
+
size: "f"
|
|
460
|
+
});
|
|
458
461
|
}
|
|
459
462
|
if (entry.lg) {
|
|
460
463
|
thumbnails.push({ path: getThumbnailPath(originalPath, "lg"), size: "lg" });
|
|
@@ -519,7 +522,9 @@ async function handleList(request) {
|
|
|
519
522
|
}
|
|
520
523
|
for (const thumb of allThumbnails) {
|
|
521
524
|
const thumbRelative = thumb.path.replace(/^\/images\/?/, "");
|
|
522
|
-
const originalEntry = fileEntries.find(
|
|
525
|
+
const originalEntry = fileEntries.find(
|
|
526
|
+
([k]) => k === thumb.originalKey
|
|
527
|
+
)?.[1];
|
|
523
528
|
const cdnIndex = originalEntry?.c;
|
|
524
529
|
const cdnBaseUrl = cdnIndex !== void 0 ? cdnUrls[cdnIndex] : void 0;
|
|
525
530
|
const thumbnailUrl = cdnBaseUrl ? `${cdnBaseUrl}${thumb.path}` : thumb.path;
|
|
@@ -582,7 +587,8 @@ async function handleList(request) {
|
|
|
582
587
|
}
|
|
583
588
|
}
|
|
584
589
|
} else {
|
|
585
|
-
if (!thumbRelative.startsWith(imagesSubPath + "/") && thumbRelative !== imagesSubPath)
|
|
590
|
+
if (!thumbRelative.startsWith(imagesSubPath + "/") && thumbRelative !== imagesSubPath)
|
|
591
|
+
continue;
|
|
586
592
|
const remaining = thumbRelative.slice(imagesSubPath.length + 1);
|
|
587
593
|
if (!remaining) continue;
|
|
588
594
|
const slashIndex = remaining.indexOf("/");
|
|
@@ -658,10 +664,16 @@ async function handleList(request) {
|
|
|
658
664
|
if (isImagesFolder) {
|
|
659
665
|
for (const [key, metaEntry] of fileEntries) {
|
|
660
666
|
if (isProcessed(metaEntry)) {
|
|
661
|
-
const thumbCount = getExistingThumbnails(
|
|
667
|
+
const thumbCount = getExistingThumbnails(
|
|
668
|
+
key,
|
|
669
|
+
metaEntry
|
|
670
|
+
).length;
|
|
662
671
|
fileCount += thumbCount;
|
|
663
672
|
if (metaEntry.c !== void 0) {
|
|
664
|
-
const entryCdnUrl = cdnUrls[metaEntry.c]?.replace(
|
|
673
|
+
const entryCdnUrl = cdnUrls[metaEntry.c]?.replace(
|
|
674
|
+
/\/?$/,
|
|
675
|
+
""
|
|
676
|
+
);
|
|
665
677
|
if (r2PublicUrl && entryCdnUrl === r2PublicUrl) {
|
|
666
678
|
cloudCount += thumbCount;
|
|
667
679
|
} else {
|
|
@@ -677,7 +689,12 @@ async function handleList(request) {
|
|
|
677
689
|
for (const k of metaKeys) {
|
|
678
690
|
if (k.startsWith(folderPrefix)) fileCount++;
|
|
679
691
|
}
|
|
680
|
-
const counts = countFileTypes(
|
|
692
|
+
const counts = countFileTypes(
|
|
693
|
+
folderPrefix,
|
|
694
|
+
fileEntries,
|
|
695
|
+
cdnUrls,
|
|
696
|
+
r2PublicUrl
|
|
697
|
+
);
|
|
681
698
|
cloudCount = counts.cloudCount;
|
|
682
699
|
remoteCount = counts.remoteCount;
|
|
683
700
|
localCount = counts.localCount;
|
|
@@ -751,7 +768,12 @@ async function handleList(request) {
|
|
|
751
768
|
for (const k of metaKeys) {
|
|
752
769
|
if (k.startsWith(folderPrefix)) fileCount++;
|
|
753
770
|
}
|
|
754
|
-
const counts = countFileTypes(
|
|
771
|
+
const counts = countFileTypes(
|
|
772
|
+
folderPrefix,
|
|
773
|
+
fileEntries,
|
|
774
|
+
cdnUrls,
|
|
775
|
+
r2PublicUrl
|
|
776
|
+
);
|
|
755
777
|
items.push({
|
|
756
778
|
name: folderName,
|
|
757
779
|
path: relativePath ? `public/${relativePath}/${folderName}` : `public/${folderName}`,
|
|
@@ -1054,7 +1076,10 @@ async function handleFolderImages(request) {
|
|
|
1054
1076
|
});
|
|
1055
1077
|
} catch (error) {
|
|
1056
1078
|
console.error("Failed to get folder files:", error);
|
|
1057
|
-
return jsonResponse(
|
|
1079
|
+
return jsonResponse(
|
|
1080
|
+
{ error: "Failed to get folder files" },
|
|
1081
|
+
{ status: 500 }
|
|
1082
|
+
);
|
|
1058
1083
|
}
|
|
1059
1084
|
}
|
|
1060
1085
|
|
|
@@ -4053,8 +4078,7 @@ async function handleGenerateFeaturedImage(request) {
|
|
|
4053
4078
|
const meta = await loadMeta();
|
|
4054
4079
|
const metaKey = `/${projectName}.jpg`;
|
|
4055
4080
|
setMetaEntry(meta, metaKey, {
|
|
4056
|
-
o: { w: width, h: height }
|
|
4057
|
-
f: { w: width, h: height }
|
|
4081
|
+
o: { w: width, h: height }
|
|
4058
4082
|
});
|
|
4059
4083
|
await saveMeta(meta);
|
|
4060
4084
|
sendEvent({
|