Serve avatars from Habbo imager instead of broken self-hosted proxy.
Local Build and Deploy / deploy (push) Successful in 56s
Local Build and Deploy / deploy (push) Successful in 56s
Co-authored-by: Cursor <[email protected]>
This commit is contained in:
1 parent
2c68fb7e5a
commit
8cce8837bc
6 files changed
+107
-51
No files matched your search
@@ -17,6 +17,7 @@ import { Badge } from "@/components/ui/badge";
|
||||
import { Button } from "@/components/ui/button";
|
||||
import { Input } from "@/components/ui/input";
|
||||
import { cn } from "@/lib/utils";
|
||||
import { getAvatarUrl } from "@/lib/imager";
|
||||
|
||||
// ── Shared types ─────────────────────────────────────────────────────────────
|
||||
|
||||
@@ -115,11 +116,15 @@ function AvatarPreview({ type, id }: { type?: string; id?: number }) {
|
||||
return <Shirt className="w-8 h-8 text-muted-foreground/60" />;
|
||||
}
|
||||
const figure = buildPreviewFigure(type, id);
|
||||
const headOnly = HEAD_TYPES.has(type) ? "&headonly=1" : "";
|
||||
return (
|
||||
// biome-ignore lint/performance/noImgElement: dynamic avatar imaging, not a Next asset
|
||||
<img
|
||||
src={`/api/imaging/avatar?figure=${encodeURIComponent(figure)}&size=l&direction=2&head_direction=3${headOnly}`}
|
||||
src={getAvatarUrl(figure, {
|
||||
size: "l",
|
||||
direction: 2,
|
||||
headDirection: 3,
|
||||
headOnly: HEAD_TYPES.has(type),
|
||||
})}
|
||||
alt={`${type}-${id}`}
|
||||
className="max-h-full object-contain image-pixelated"
|
||||
onError={() => setFailed(true)}
|
||||
|
||||
@@ -91,13 +91,15 @@ export const SETTINGS_GROUPS: SettingsGroup[] = [
|
||||
fields: [
|
||||
{
|
||||
key: "habbo_imaging_url",
|
||||
label: "Habbo imaging upstream",
|
||||
label: "Habbo imager URL",
|
||||
type: "url",
|
||||
defaultValue: "https://www.habbo.com/habbo-imaging/avatarimage",
|
||||
description:
|
||||
"Public Habbo avatar endpoint used in the browser. Do not point this at /api/imaging/avatar.",
|
||||
},
|
||||
{
|
||||
key: "imaging_use_habbo_fallback",
|
||||
label: "Use Habbo.com as avatar fallback",
|
||||
label: "Use Habbo.com as avatar fallback (legacy proxy)",
|
||||
type: "boolean",
|
||||
defaultValue: "1",
|
||||
},
|
||||
|
||||
Reference in new issue
Block a user