@gallop.software/studio 2.3.68 → 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.
- package/dist/server/index.js +3 -14
- package/dist/server/index.js.map +1 -1
- package/package.json +1 -2
package/dist/server/index.js
CHANGED
|
@@ -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
|
|
|
@@ -3314,7 +3311,6 @@ async function handleMoveStream(request) {
|
|
|
3314
3311
|
import { promises as fs8 } from "fs";
|
|
3315
3312
|
import path8 from "path";
|
|
3316
3313
|
import sharp3 from "sharp";
|
|
3317
|
-
import { encode as encode2 } from "blurhash";
|
|
3318
3314
|
async function handleScanStream() {
|
|
3319
3315
|
const encoder = new TextEncoder();
|
|
3320
3316
|
const stream = new ReadableStream({
|
|
@@ -3421,16 +3417,13 @@ async function handleScanStream() {
|
|
|
3421
3417
|
if (isImage) {
|
|
3422
3418
|
const ext = path8.extname(relativePath).toLowerCase();
|
|
3423
3419
|
if (ext === ".svg") {
|
|
3424
|
-
meta[imageKey] = { o: { w: 0, h: 0 }
|
|
3420
|
+
meta[imageKey] = { o: { w: 0, h: 0 } };
|
|
3425
3421
|
} else {
|
|
3426
3422
|
try {
|
|
3427
3423
|
const buffer = await fs8.readFile(fullPath);
|
|
3428
3424
|
const metadata = await sharp3(buffer).metadata();
|
|
3429
|
-
const { data, info } = await sharp3(buffer).resize(32, 32, { fit: "inside" }).ensureAlpha().raw().toBuffer({ resolveWithObject: true });
|
|
3430
|
-
const blurhash = encode2(new Uint8ClampedArray(data), info.width, info.height, 4, 4);
|
|
3431
3425
|
meta[imageKey] = {
|
|
3432
|
-
o: { w: metadata.width || 0, h: metadata.height || 0 }
|
|
3433
|
-
b: blurhash
|
|
3426
|
+
o: { w: metadata.width || 0, h: metadata.height || 0 }
|
|
3434
3427
|
};
|
|
3435
3428
|
} catch {
|
|
3436
3429
|
meta[imageKey] = { o: { w: 0, h: 0 } };
|
|
@@ -3632,7 +3625,6 @@ async function handleDeleteOrphans(request) {
|
|
|
3632
3625
|
|
|
3633
3626
|
// src/handlers/import.ts
|
|
3634
3627
|
import sharp4 from "sharp";
|
|
3635
|
-
import { encode as encode3 } from "blurhash";
|
|
3636
3628
|
function parseImageUrl(url) {
|
|
3637
3629
|
const parsed = new URL(url);
|
|
3638
3630
|
const base = `${parsed.protocol}//${parsed.host}`;
|
|
@@ -3646,11 +3638,8 @@ async function processRemoteImage(url) {
|
|
|
3646
3638
|
}
|
|
3647
3639
|
const buffer = Buffer.from(await response.arrayBuffer());
|
|
3648
3640
|
const metadata = await sharp4(buffer).metadata();
|
|
3649
|
-
const { data, info } = await sharp4(buffer).resize(32, 32, { fit: "inside" }).ensureAlpha().raw().toBuffer({ resolveWithObject: true });
|
|
3650
|
-
const blurhash = encode3(new Uint8ClampedArray(data), info.width, info.height, 4, 4);
|
|
3651
3641
|
return {
|
|
3652
|
-
o: { w: metadata.width || 0, h: metadata.height || 0 }
|
|
3653
|
-
b: blurhash
|
|
3642
|
+
o: { w: metadata.width || 0, h: metadata.height || 0 }
|
|
3654
3643
|
};
|
|
3655
3644
|
}
|
|
3656
3645
|
async function handleImportUrls(request) {
|