chore(Decor): Change URL formula for cost savings (#2247)
This commit is contained in:
parent
992533245b
commit
497f0de9a1
1 changed files with 4 additions and 3 deletions
|
@ -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;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue