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:
1 parent
2f708bcf11
commit
3213126a12
2 files changed
+7
-4
No files matched your search
+4
-1
@@ -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,
|
||||
|
||||
Reference in new issue
Block a user