fix: fix loading privated assets in avatar sandbox
This commit is contained in:
parent
ec9c7f8671
commit
d86f928b6f
1 changed files with 55 additions and 31 deletions
|
|
@ -292,6 +292,7 @@ async function UpdateAvatar() {
|
|||
|
||||
const AccessoryPromise = [...Avatar.items, Avatar.tool, Avatar.torso].filter((x) => x !== undefined && !x.toString().startsWith('http') && !x.toString().startsWith('data:')).map(async (x, index) => {
|
||||
if (ItemCache[x] === undefined) {
|
||||
try {
|
||||
const ItemDetails = (await (await fetch('https://api.polytoria.com/v1/store/' + x)).json())
|
||||
ItemCache[x] = {
|
||||
type: ItemDetails.type,
|
||||
|
|
@ -308,6 +309,17 @@ async function UpdateAvatar() {
|
|||
if (ItemDetails.type === 'hat') {
|
||||
ItemCache[x].accessoryType = ItemDetails.accessoryType
|
||||
}
|
||||
} catch(error) {
|
||||
ItemCache[x] = {
|
||||
type: "unknown",
|
||||
name: "#" + x,
|
||||
price: null,
|
||||
creator: null,
|
||||
thumbnail: "https://c0.ptacdn.com/static/images/broken.136e44ee.png",
|
||||
asset: undefined,
|
||||
ribbon: "unknown"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (ItemCache[x].asset === undefined) {
|
||||
|
|
@ -336,6 +348,7 @@ async function UpdateAvatar() {
|
|||
|
||||
const TexturePromise = [Avatar.shirt, Avatar.pants, Avatar.face].filter((x) => x !== undefined && !x.toString().startsWith('http') && !x.toString().startsWith('data:') && x !== undefined).map(async (x, index) => {
|
||||
if (ItemCache[x] === undefined) {
|
||||
try {
|
||||
const ItemDetails = (await (await fetch('https://api.polytoria.com/v1/store/' + x)).json())
|
||||
ItemCache[x] = {
|
||||
type: ItemDetails.type,
|
||||
|
|
@ -356,6 +369,17 @@ async function UpdateAvatar() {
|
|||
ItemCache[x].price = 0
|
||||
}
|
||||
}
|
||||
} catch(error) {
|
||||
ItemCache[x] = {
|
||||
type: "unknown",
|
||||
name: "#" + x,
|
||||
price: null,
|
||||
creator: null,
|
||||
thumbnail: "https://c0.ptacdn.com/static/images/broken.136e44ee.png",
|
||||
asset: undefined,
|
||||
ribbon: "unknown"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (ItemCache[x].asset === undefined) {
|
||||
|
|
|
|||
Reference in a new issue