feat: switch avatar imager to epicnabbo.nl with figure conversion

- Update imager to use epicnabbo.nl by default with effect=14 and img_format=apng
- Add figure string converter (old Habbo format -> epicnabbo.nl short format)
- Update avatarImageUrl to auto-convert figure strings
- Update online-users-widget to use new avatarImageUrl
- Add tests for imager and figure conversion
This commit is contained in:
openhands committed 2026-08-09 19:38:04 +02:00
1 parent 703c29bc83
commit fc7e6ca248
10 files changed
+270 -114

No files matched your search

+4 -12
View File
@@ -1,8 +1,8 @@
import { resolveImagerBase } from "@/lib/imager";
import { getNewFormatFigure } from "@/lib/figure-convert";
import { getAvatarUrl } from "@/lib/imager";
/** Build a Habbo avatar-imager URL for a figure string. */
export function avatarImageUrl(
base: string,
look: string,
opts: {
size?: "s" | "m" | "l";
@@ -11,16 +11,8 @@ export function avatarImageUrl(
headDirection?: number;
} = {},
): string {
const resolved = resolveImagerBase(base);
const params = new URLSearchParams({ figure: look, img_format: "png" });
if (opts.size) params.set("size", opts.size);
if (opts.headOnly) params.set("headonly", "1");
if (opts.direction !== undefined)
params.set("direction", String(opts.direction));
if (opts.headDirection !== undefined)
params.set("head_direction", String(opts.headDirection));
const sep = resolved.includes("?") ? "&" : "?";
return `${resolved}${sep}${params.toString()}`;
const figure = getNewFormatFigure(look);
return getAvatarUrl(figure, opts);
}
/** URL-safe slug from a title (lowercase, ascii, hyphenated). */