move badge loading again since its not awaited
Some checks failed
Code quality checks / biome (push) Failing after 9s

This commit is contained in:
creations 2025-04-27 17:44:35 -04:00
parent 52e4c86808
commit 1b21009ebb
Signed by: creations
GPG key ID: 8F553AA4320FC711

View file

@ -171,7 +171,10 @@ function buildActivityHTML(activity) {
? `<div class="activity-buttons"> ? `<div class="activity-buttons">
${activity.buttons ${activity.buttons
.map((button, index) => { .map((button, index) => {
const label = typeof button === "string" ? button : button.label; const label =
typeof button === "string"
? button
: button.label;
let url = null; let url = null;
if (typeof button === "object" && button.url) { if (typeof button === "object" && button.url) {
url = button.url; url = button.url;
@ -318,7 +321,9 @@ async function populateReadme(data) {
if (readmeSection && data.kv?.readme) { if (readmeSection && data.kv?.readme) {
const url = data.kv.readme; const url = data.kv.readme;
try { try {
const res = await fetch(`/api/readme?url=${encodeURIComponent(url)}`); const res = await fetch(
`/api/readme?url=${encodeURIComponent(url)}`,
);
if (!res.ok) throw new Error("Failed to fetch readme"); if (!res.ok) throw new Error("Failed to fetch readme");
const text = await res.text(); const text = await res.text();
@ -338,7 +343,9 @@ async function updatePresence(data) {
const cssLink = data.kv?.css; const cssLink = data.kv?.css;
if (cssLink) { if (cssLink) {
try { try {
const res = await fetch(`/api/css?url=${encodeURIComponent(cssLink)}`); const res = await fetch(
`/api/css?url=${encodeURIComponent(cssLink)}`,
);
if (!res.ok) throw new Error("Failed to fetch CSS"); if (!res.ok) throw new Error("Failed to fetch CSS");
const cssText = await res.text(); const cssText = await res.text();
@ -350,6 +357,17 @@ async function updatePresence(data) {
} }
} }
if (!badgesLoaded && data && data.kv.badges !== "false") {
loadBadges(userId, {
services: [],
seperated: true,
cache: true,
targetId: "badges",
serviceOrder: ["discord", "equicord", "reviewdb", "vencord"],
});
badgesLoaded = true;
}
const avatarWrapper = document.querySelector(".avatar-wrapper"); const avatarWrapper = document.querySelector(".avatar-wrapper");
const avatarImg = avatarWrapper?.querySelector(".avatar"); const avatarImg = avatarWrapper?.querySelector(".avatar");
const usernameEl = document.querySelector(".username"); const usernameEl = document.querySelector(".username");
@ -454,17 +472,6 @@ async function updatePresence(data) {
updatedStatusIndicator.className = `status-indicator ${status}`; updatedStatusIndicator.className = `status-indicator ${status}`;
} }
if (!badgesLoaded && data && data.kv.badges !== "false") {
loadBadges(userId, {
services: [],
seperated: true,
cache: true,
targetId: "badges",
serviceOrder: ["discord", "equicord", "reviewdb", "vencord"],
});
badgesLoaded = true;
}
const custom = data.activities?.find((a) => a.type === 4); const custom = data.activities?.find((a) => a.type === 4);
updateCustomStatus(custom); updateCustomStatus(custom);