Add production observability: Sentry, pino, and sharp badge encoding.
Local Build and Deploy / deploy (push) Successful in 1m9s
Local Build and Deploy / deploy (push) Successful in 1m9s
Sentry is opt-in via DSN env vars; logger uses structured pino JSON in prod; badge uploads are normalized to GIF with sharp. Co-authored-by: Cursor <[email protected]>
This commit is contained in:
1 parent
6c81af69ea
commit
09f1bc2bd6
16 files changed
+2206
-121
No files matched your search
@@ -0,0 +1,22 @@
|
||||
import "server-only";
|
||||
|
||||
import sharp from "sharp";
|
||||
|
||||
/** Habbo-style badge icons are small; keep within this box without upscaling. */
|
||||
const MAX_BADGE_EDGE = 64;
|
||||
|
||||
/**
|
||||
* Normalize an uploaded badge image to GIF bytes for the emulator album folder.
|
||||
* Accepts PNG or GIF input; re-encodes and optionally downsizes oversized assets.
|
||||
*/
|
||||
export async function toBadgeGif(input: Buffer): Promise<Buffer> {
|
||||
return sharp(input)
|
||||
.resize({
|
||||
width: MAX_BADGE_EDGE,
|
||||
height: MAX_BADGE_EDGE,
|
||||
fit: "inside",
|
||||
withoutEnlargement: true,
|
||||
})
|
||||
.gif()
|
||||
.toBuffer();
|
||||
}
|
||||
Reference in new issue
Block a user