chore(Decor): Change URL formula for cost savings (#2247)

This commit is contained in:
Jack 2024-03-11 10:52:11 -04:00 committed by GitHub
parent 992533245b
commit 497f0de9a1
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -131,9 +131,10 @@ export default definePlugin({
getDecorAvatarDecorationURL({ avatarDecoration, canAnimate }: { avatarDecoration: AvatarDecoration | null; canAnimate?: boolean; }) { getDecorAvatarDecorationURL({ avatarDecoration, canAnimate }: { avatarDecoration: AvatarDecoration | null; canAnimate?: boolean; }) {
// Only Decor avatar decorations have this SKU ID // Only Decor avatar decorations have this SKU ID
if (avatarDecoration?.skuId === SKU_ID) { if (avatarDecoration?.skuId === SKU_ID) {
const url = new URL(`${CDN_URL}/${avatarDecoration.asset}.png`); const parts = avatarDecoration.asset.split("_");
url.searchParams.set("animate", (!!canAnimate && isAnimatedAvatarDecoration(avatarDecoration.asset)).toString()); // Remove a_ prefix if it's animated and animation is disabled
return url.toString(); if (isAnimatedAvatarDecoration(avatarDecoration.asset) && !canAnimate) parts.shift();
return `${CDN_URL}/${parts.join("_")}.png`;
} else if (avatarDecoration?.skuId === RAW_SKU_ID) { } else if (avatarDecoration?.skuId === RAW_SKU_ID) {
return avatarDecoration.asset; return avatarDecoration.asset;
} }