Fix style + nix?

This commit is contained in:
TomatoCake 2024-06-28 12:59:13 +02:00
parent a987671e4a
commit c135de9c86
2 changed files with 7 additions and 3 deletions

2
package-lock.json generated
View File

@ -30,7 +30,7 @@
"i18next-fs-backend": "^2.1.5", "i18next-fs-backend": "^2.1.5",
"i18next-http-middleware": "^3.3.2", "i18next-http-middleware": "^3.3.2",
"image-size": "^1.0.2", "image-size": "^1.0.2",
"jimp": "^0.22.12", "jimp": "*",
"json-bigint": "^1.0.0", "json-bigint": "^1.0.0",
"jsonwebtoken": "^9.0.1", "jsonwebtoken": "^9.0.1",
"lambert-server": "^1.2.12", "lambert-server": "^1.2.12",

View File

@ -26,7 +26,7 @@ let sharp: undefined | false | { default: typeof import("sharp") } = undefined;
let Jimp: JimpType | undefined = undefined; let Jimp: JimpType | undefined = undefined;
try { try {
Jimp = require("jimp") as JimpType; Jimp = require("jimp") as JimpType;
} catch { } catch {
// empty // empty
} }
@ -120,7 +120,11 @@ export async function ImageProxy(req: Request, res: Response) {
const arrayBuffer = await request.arrayBuffer(); const arrayBuffer = await request.arrayBuffer();
let resultBuffer = Buffer.from(arrayBuffer); let resultBuffer = Buffer.from(arrayBuffer);
if (!sentImageProxyWarning && resizeSupported.has(contentType) && /^\d+x\d+$/.test(path[1])) { if (
!sentImageProxyWarning &&
resizeSupported.has(contentType) &&
/^\d+x\d+$/.test(path[1])
) {
if (sharp !== false) { if (sharp !== false) {
try { try {
sharp = await import("sharp"); sharp = await import("sharp");