Compare commits

..

No commits in common. "af872d538c52d3ff203adb0b38d75d1372d8b424" and "1b21009ebbd210b5f8e8f01fb45ef737efc13a73" have entirely different histories.

View file

@ -167,11 +167,14 @@ function buildActivityHTML(activity) {
: ""; : "";
const activityButtons = const activityButtons =
(activity.buttons && activity.buttons.length > 0 activity.buttons && activity.buttons.length > 0
? `<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;
@ -185,12 +188,7 @@ function buildActivityHTML(activity) {
.filter(Boolean) .filter(Boolean)
.join("")} .join("")}
</div>` </div>`
: "") + : "";
(activity.name === "Spotify" && activity.sync_id
? `<div class="activity-buttons">
<a href="https://open.spotify.com/track/${activity.sync_id}" class="activity-button" target="_blank" rel="noopener noreferrer">Listen on Spotify</a>
</div>`
: "");
const progressBar = const progressBar =
progress !== null progress !== null
@ -323,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();
@ -343,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();