Fix fallback images, Phas fallback image

This commit is contained in:
bingus_violet 2024-03-23 12:37:22 -05:00
parent 8c2c22ef27
commit e40e4573e7
3 changed files with 8 additions and 14 deletions

View file

@ -1,6 +1,7 @@
{ {
"activityImages": { "activityImages": {
"ULTRAKILL": "https://cdn.violets-purgatory.dev/fallbackImages/ULTRAKILL.webp" "ULTRAKILL": "https://fs.violets-purgatory.dev/SiteActivityImages/ULTRAKILL.jpg",
"Phasmophobia": "https://fs.violets-purgatory.dev/SiteActivityImages/Phasmophobia.png"
}, },
"discStatuses": { "discStatuses": {
"online": { "online": {

View file

@ -6,7 +6,6 @@ var config = JSON.parse(fs.readFileSync(path.join(__dirname, 'config.json')))
var activityImages = config.activityImages var activityImages = config.activityImages
function get_img_url(activity, size = "large_image") { function get_img_url(activity, size = "large_image") {
if ("assets" in activity) { if ("assets" in activity) {
var image = activity.assets[size] var image = activity.assets[size]
@ -15,20 +14,17 @@ function get_img_url(activity, size = "large_image") {
return decodeURIComponent('https://' + image.substr(image.indexOf('https/') + 6, image.length)) return decodeURIComponent('https://' + image.substr(image.indexOf('https/') + 6, image.length))
} else if (image.includes("spotify")) { } else if (image.includes("spotify")) {
return decodeURIComponent('https://i.scdn.co/image/' + image.substr(image.indexOf('spotify:') + 8, image.length)) return decodeURIComponent('https://i.scdn.co/image/' + image.substr(image.indexOf('spotify:') + 8, image.length))
} else {
return decodeURIComponent(`https://cdn.discordapp.com/app-assets/${activity.application_id}/${image}.png`)
} }
} }
} }
if (!image) { if (!image && size == "large_image") {
if (activity.name in activityImages) { if (activity.name in activityImages) {
return decodeURIComponent(activityImages[activity.name]) return decodeURIComponent(activityImages[activity.name])
} else { }
}
return null return null
} }
}
}
function timeFormatter(seconds) { function timeFormatter(seconds) {

View file

@ -170,20 +170,17 @@ function get_img_url(activity, size = "large_image") {
return decodeURIComponent('https://' + image.substr(image.indexOf('https/') + 6, image.length)) return decodeURIComponent('https://' + image.substr(image.indexOf('https/') + 6, image.length))
} else if (image.includes("spotify")) { } else if (image.includes("spotify")) {
return decodeURIComponent('https://i.scdn.co/image/' + image.substr(image.indexOf('spotify:') + 8, image.length)) return decodeURIComponent('https://i.scdn.co/image/' + image.substr(image.indexOf('spotify:') + 8, image.length))
} else {
return decodeURIComponent(`https://cdn.discordapp.com/app-assets/${activity.application_id}/${image}.png`)
} }
} }
} }
if (!image) { if (!image && size == "large_image") {
if (activity.name in activityImages) { if (activity.name in activityImages) {
return decodeURIComponent(activityImages[activity.name]) return decodeURIComponent(activityImages[activity.name])
} else { }
}
return null return null
} }
}
}
function socketeer() { function socketeer() {