fix: make getAvatarUrl auto-convert figure strings

- Update getAvatarUrl in imager.ts to use getNewFormatFigure for automatic conversion
- Update me/page.tsx to use avatarImageUrl (which also converts)
- This ensures all avatar URLs use the short epicnabbo.nl format
This commit is contained in:
openhands committed 2026-08-09 19:57:22 +02:00
1 parent 2f708bcf11
commit 3213126a12
2 files changed
+7 -4

No files matched your search

+3 -3
View File
@@ -19,8 +19,8 @@ import {
WebsiteLoginLogs,
WebsiteSetting,
} from "@/lib/db";
import { avatarImageUrl } from "@/lib/format";
import { resolveHotelName } from "@/lib/hotel-name";
import { getAvatarUrl } from "@/lib/imager";
import { siteSettings } from "@/lib/services/site-settings";
import CopyReferralButton from "./CopyReferralButton";
@@ -268,7 +268,7 @@ export default async function MePage({
: "Never";
const referralLink = `/register?ref=${encodeURIComponent(user.username)}`;
const avatarFull = getAvatarUrl(user.look, {
const avatarFull = avatarImageUrl(user.look, {
size: "l",
direction: 2,
});
@@ -498,7 +498,7 @@ export default async function MePage({
}}
>
<Image
src={getAvatarUrl(friend.look, {
src={avatarImageUrl(friend.look, {
size: "s",
headOnly: true,
})}
+4 -1
View File
@@ -8,6 +8,7 @@
export type { AvatarOptions } from "@/types/admin";
import { env } from "@/env";
import { getNewFormatFigure } from "@/lib/figure-convert";
import type { AvatarOptions } from "@/types/admin";
const DEFAULT_IMAGER_URL = "https://epicnabbo.nl/imaging/avatarimage";
@@ -27,11 +28,13 @@ export function resolveImagerBase(): string {
/**
* Build an avatar image URL using the configured imager.
* Uses effect=14 and img_format=apng by default for epicnabbo.nl compatibility.
* Automatically converts old Habbo figure format to new epicnabbo.nl format.
*/
export function getAvatarUrl(
figure: string,
options: AvatarOptions = {},
): string {
const convertedFigure = getNewFormatFigure(figure);
const {
size = "m",
direction = 2,
@@ -44,7 +47,7 @@ export function getAvatarUrl(
} = options;
const params = new URLSearchParams({
figure,
figure: convertedFigure,
direction: String(direction),
head_direction: String(headDirection),
size,