From e40e4573e78d3bc190efcd11af4410c53a9048e3 Mon Sep 17 00:00:00 2001 From: bingus_violet Date: Sat, 23 Mar 2024 12:37:22 -0500 Subject: [PATCH] Fix fallback images, Phas fallback image --- config.json | 3 ++- overcomplicatedStatuses.js | 10 +++------- pageUpdater.js | 9 +++------ 3 files changed, 8 insertions(+), 14 deletions(-) diff --git a/config.json b/config.json index 1412fee..fd34615 100644 --- a/config.json +++ b/config.json @@ -1,6 +1,7 @@ { "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": { "online": { diff --git a/overcomplicatedStatuses.js b/overcomplicatedStatuses.js index 1f1bc56..217a3a6 100644 --- a/overcomplicatedStatuses.js +++ b/overcomplicatedStatuses.js @@ -6,7 +6,6 @@ var config = JSON.parse(fs.readFileSync(path.join(__dirname, 'config.json'))) var activityImages = config.activityImages function get_img_url(activity, size = "large_image") { - if ("assets" in activity) { var image = activity.assets[size] @@ -15,19 +14,16 @@ function get_img_url(activity, size = "large_image") { return decodeURIComponent('https://' + image.substr(image.indexOf('https/') + 6, image.length)) } else if (image.includes("spotify")) { 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) { return decodeURIComponent(activityImages[activity.name]) - } else { - return null } } + return null } diff --git a/pageUpdater.js b/pageUpdater.js index ff811a7..77ee882 100644 --- a/pageUpdater.js +++ b/pageUpdater.js @@ -170,19 +170,16 @@ function get_img_url(activity, size = "large_image") { return decodeURIComponent('https://' + image.substr(image.indexOf('https/') + 6, image.length)) } else if (image.includes("spotify")) { 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) { return decodeURIComponent(activityImages[activity.name]) - } else { - return null } } + return null }