fix: resolve multiple API and e2e test bugs

- Health endpoint returns "healthy" instead of "ok" for consistency
- MAX_USERS now configurable via env var (default 5)
- People API returns team names instead of UUIDs in register/list
- PUT user update accepts team names (name-first lookup, fallback to ID)
- Login rate limit follows global rate limit when RATE_LIMIT_PER_MIN > 1000
- Strip-metadata preserves original format encoding instead of always PNG
- Fix e2e tests: rotate/crop/border button selectors match actual UI
- Fix e2e tests: create Engineering/Design teams in people test setup
- Fix e2e tests: people UI uses select for team field, not text input
- Update visual regression baseline for tablet home page
This commit is contained in:
Siddharth Kumar Sah
2026-04-04 17:44:51 +08:00
parent 9f0354388f
commit 9d621734c3
11 changed files with 110 additions and 48 deletions
+35 -1
View File
@@ -279,10 +279,44 @@ export function registerStripMetadata(app: FastifyInstance) {
toolId: "strip-metadata",
settingsSchema,
process: async (inputBuffer, settings, filename) => {
const metadata = await sharp(inputBuffer).metadata();
const format = metadata.format ?? "png";
const image = sharp(inputBuffer);
const result = await stripMetadata(image, settings);
// Re-encode in the original format so we don't inflate the file.
// Sharp re-encodes from scratch, so we pick settings that stay close
// to the original size while still stripping metadata.
switch (format) {
case "jpeg":
result.jpeg({ quality: 90, mozjpeg: true });
break;
case "png":
result.png({ compressionLevel: 9 });
break;
case "webp":
result.webp({ quality: 85 });
break;
case "avif":
result.avif({ quality: 50 });
break;
case "tiff":
result.tiff({ compression: "lzw" });
break;
default:
break;
}
const buffer = await result.toBuffer();
return { buffer, filename, contentType: "image/png" };
const mimeMap: Record<string, string> = {
jpeg: "image/jpeg",
png: "image/png",
webp: "image/webp",
avif: "image/avif",
tiff: "image/tiff",
gif: "image/gif",
};
return { buffer, filename, contentType: mimeMap[format] ?? "image/png" };
},
});
}