From 5e60cc91e84633e1d2f2cfd02c4af3c5b9121d83 Mon Sep 17 00:00:00 2001 From: Clove Twilight Date: Fri, 26 Jun 2026 02:56:13 +0100 Subject: [PATCH] AAAAAAAAAAAAAAA --- js/discord.js | 48 +++++++++++++++++++++++++++++++++--------------- 1 file changed, 33 insertions(+), 15 deletions(-) diff --git a/js/discord.js b/js/discord.js index 0ed8a92..7276946 100644 --- a/js/discord.js +++ b/js/discord.js @@ -305,22 +305,38 @@ return html; } - // Richer badges via dstn.to — Nitro, boosts, quests, orbs… everything - // Discord actually shows, which public_flags (0 for most) can't give. - let dstnBadges = null; + // Rich Discord badges (Nitro, boosts, quests, orbs… everything Discord + // actually shows, which public_flags alone can't give) — resolved + // server-side by the Doughmination Restful API, same source as the rest + // of the profile data. + let doughBadges = null; + // Third-party client-mod badges (Vencord/Equicord/Aliucord/etc, via the + // worker's data.clientBadges — separate from Discord's own badges above). + let clientBadges = null; let lastFlags = 0; - function renderDstnBadges() { - return dstnBadges.map(function (b) { - const img = '' + esc(b.description || b.id) + ''; return b.link ? '' + img + "" : img; }).join(""); } + // These come from an unofficial third-party aggregator (not Discord + // itself), so they're rendered in their own pass with their own class + // (.pc-badge--client) rather than mixed indistinguishably into the + // regular badge markup. + function renderClientBadges() { + if (!clientBadges || !clientBadges.length) return ""; + return clientBadges.map(function (b) { + return '' + esc(b.tooltip || '; + }).join(""); + } function paintBadges() { if (!badgesEl) return; - badgesEl.innerHTML = (dstnBadges && dstnBadges.length) ? renderDstnBadges() : renderBadges(lastFlags); + badgesEl.innerHTML = (doughBadges && doughBadges.length ? renderDoughBadges() : renderBadges(lastFlags)) + renderClientBadges(); } function rgbTriplet(n) { n = Number(n) >>> 0; @@ -749,8 +765,8 @@ const SELF_POLL_MS = opts.pollMs || 20000; // presence refresh cadence let selfTimer = null; - // self-host shape -> the Lanyard-shaped object render() already understands - function mapSelfHostToLanyard(j) { + // self-host shape -> the presence-shaped object render() already understands + function mapSelfHostToPresence(j) { const u = (j.data && j.data.user) || {}; const p = (j.data && j.data.presence) || {}; const plat = p.platform || {}; @@ -785,14 +801,16 @@ function renderFromSelfHost(j) { const u = (j.data && j.data.user) || {}; - render(mapSelfHostToLanyard(j)); - // badges arrive pre-resolved (same consumer as dstn badges) + render(mapSelfHostToPresence(j)); + // badges arrive pre-resolved straight from the Doughmination Restful API if (Array.isArray(j.data.badges) && j.data.badges.length) { - dstnBadges = j.data.badges; - paintBadges(); + doughBadges = j.data.badges; } - // Nitro profile gradient — straight from the self-hosted API now that it - // returns theme_colors (previously only the dstn.to fallback applied this) + // Third-party client-mod badges (Vencord/Equicord/Aliucord/etc); kept + // separate from doughBadges since it's a different, unofficial source. + clientBadges = Array.isArray(j.data.clientBadges) ? j.data.clientBadges : null; + paintBadges(); + // Nitro profile gradient — straight from the self-hosted API if (Array.isArray(u.theme_colors)) applyProfileGradient(u.theme_colors); // profile extras: banner rebuilt from the raw hash (dodges the animated // .gif 415), plus bio / connections / pronouns straight from the API