@gallop.software/studio 2.3.67 → 2.3.69

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.
@@ -11,7 +11,7 @@
11
11
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
12
12
  }
13
13
  </style>
14
- <script type="module" crossorigin src="/assets/index-CVpv3I0V.js"></script>
14
+ <script type="module" crossorigin src="/assets/index-BvENFNqZ.js"></script>
15
15
  </head>
16
16
  <body>
17
17
  <div id="root"></div>
@@ -141,7 +141,6 @@ function getContentType(filePath) {
141
141
  import { promises as fs2 } from "fs";
142
142
  import path3 from "path";
143
143
  import sharp from "sharp";
144
- import { encode } from "blurhash";
145
144
  var FULL_MAX_WIDTH = 2560;
146
145
  var DEFAULT_SIZES = {
147
146
  small: { width: 300, suffix: "-sm", key: "sm" },
@@ -201,8 +200,6 @@ async function processImage(buffer, imageKey) {
201
200
  }
202
201
  entry[key] = { w: maxWidth, h: newHeight };
203
202
  }
204
- const { data, info } = await sharp(buffer).resize(32, 32, { fit: "inside" }).ensureAlpha().raw().toBuffer({ resolveWithObject: true });
205
- entry.b = encode(new Uint8ClampedArray(data), info.width, info.height, 4, 4);
206
203
  return entry;
207
204
  }
208
205
 
@@ -845,9 +842,12 @@ async function handleList(request) {
845
842
  async function handleSearch(request) {
846
843
  const searchParams = new URL(request.url).searchParams;
847
844
  const query = searchParams.get("q")?.toLowerCase() || "";
845
+ const requestedPath = searchParams.get("path") || "public";
848
846
  if (query.length < 2) {
849
847
  return jsonResponse({ items: [] });
850
848
  }
849
+ const pathPrefix = requestedPath === "public" ? "/" : "/" + requestedPath.replace(/^public\/?/, "");
850
+ const normalizedPrefix = pathPrefix.endsWith("/") ? pathPrefix : pathPrefix + "/";
851
851
  try {
852
852
  const meta = await loadMeta();
853
853
  const fileEntries = getFileEntries(meta);
@@ -855,6 +855,7 @@ async function handleSearch(request) {
855
855
  const r2PublicUrl = process.env.CLOUDFLARE_R2_PUBLIC_URL?.replace(/\/$/, "") || "";
856
856
  const items = [];
857
857
  for (const [key, entry] of fileEntries) {
858
+ if (!key.startsWith(normalizedPrefix)) continue;
858
859
  if (!key.toLowerCase().includes(query)) continue;
859
860
  const fileName = path4.basename(key);
860
861
  const relativePath = key.slice(1);
@@ -3310,7 +3311,6 @@ async function handleMoveStream(request) {
3310
3311
  import { promises as fs8 } from "fs";
3311
3312
  import path8 from "path";
3312
3313
  import sharp3 from "sharp";
3313
- import { encode as encode2 } from "blurhash";
3314
3314
  async function handleScanStream() {
3315
3315
  const encoder = new TextEncoder();
3316
3316
  const stream = new ReadableStream({
@@ -3417,16 +3417,13 @@ async function handleScanStream() {
3417
3417
  if (isImage) {
3418
3418
  const ext = path8.extname(relativePath).toLowerCase();
3419
3419
  if (ext === ".svg") {
3420
- meta[imageKey] = { o: { w: 0, h: 0 }, b: "" };
3420
+ meta[imageKey] = { o: { w: 0, h: 0 } };
3421
3421
  } else {
3422
3422
  try {
3423
3423
  const buffer = await fs8.readFile(fullPath);
3424
3424
  const metadata = await sharp3(buffer).metadata();
3425
- const { data, info } = await sharp3(buffer).resize(32, 32, { fit: "inside" }).ensureAlpha().raw().toBuffer({ resolveWithObject: true });
3426
- const blurhash = encode2(new Uint8ClampedArray(data), info.width, info.height, 4, 4);
3427
3425
  meta[imageKey] = {
3428
- o: { w: metadata.width || 0, h: metadata.height || 0 },
3429
- b: blurhash
3426
+ o: { w: metadata.width || 0, h: metadata.height || 0 }
3430
3427
  };
3431
3428
  } catch {
3432
3429
  meta[imageKey] = { o: { w: 0, h: 0 } };
@@ -3628,7 +3625,6 @@ async function handleDeleteOrphans(request) {
3628
3625
 
3629
3626
  // src/handlers/import.ts
3630
3627
  import sharp4 from "sharp";
3631
- import { encode as encode3 } from "blurhash";
3632
3628
  function parseImageUrl(url) {
3633
3629
  const parsed = new URL(url);
3634
3630
  const base = `${parsed.protocol}//${parsed.host}`;
@@ -3642,11 +3638,8 @@ async function processRemoteImage(url) {
3642
3638
  }
3643
3639
  const buffer = Buffer.from(await response.arrayBuffer());
3644
3640
  const metadata = await sharp4(buffer).metadata();
3645
- const { data, info } = await sharp4(buffer).resize(32, 32, { fit: "inside" }).ensureAlpha().raw().toBuffer({ resolveWithObject: true });
3646
- const blurhash = encode3(new Uint8ClampedArray(data), info.width, info.height, 4, 4);
3647
3641
  return {
3648
- o: { w: metadata.width || 0, h: metadata.height || 0 },
3649
- b: blurhash
3642
+ o: { w: metadata.width || 0, h: metadata.height || 0 }
3650
3643
  };
3651
3644
  }
3652
3645
  async function handleImportUrls(request) {