From 81293bb53f0755d8947b35402d7768e8f211ad89 Mon Sep 17 00:00:00 2001 From: Tanuj Kanti Date: Sat, 21 Dec 2024 11:35:09 +0530 Subject: [PATCH 1/8] fix: image sourced from github --- tools/add-author.js | 2 +- tools/fetch-sponsors.js | 4 ++-- tools/fetch-team-data.js | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/tools/add-author.js b/tools/add-author.js index b489a2b6f..017fce643 100644 --- a/tools/add-author.js +++ b/tools/add-author.js @@ -46,7 +46,7 @@ async function fetchUserProfile() { name: profile.name, title: "Guest Author", website: profile.blog, - avatar_url: profile.avatar_url, + avatar_url: profile.avatar_url.replace("private-", ""), bio: profile.bio, twitter_username: profile.twitter_username, github_username: profile.login, diff --git a/tools/fetch-sponsors.js b/tools/fetch-sponsors.js index 24ef56719..45c68c139 100644 --- a/tools/fetch-sponsors.js +++ b/tools/fetch-sponsors.js @@ -352,7 +352,7 @@ async function fetchGitHubSponsors() { // return an array in the same format as Open Collective .map(({ sponsor, tier }) => ({ name: sponsor.name || sponsor.login, - image: sponsor.avatarUrl, + image: sponsor.avatarUrl.replace("private-", ""), url: fixUrl(sponsor.websiteUrl || sponsor.url), monthlyDonation: tier.monthlyPriceInDollars, source: "github", @@ -365,7 +365,7 @@ async function fetchGitHubSponsors() { .map(({ sponsor, timestamp, tier, id }) => ({ id, name: sponsor.name || sponsor.login, - image: sponsor.avatarUrl, + image: sponsor.avatarUrl.replace("private-", ""), url: fixUrl(sponsor.websiteUrl || sponsor.url), amount: tier.monthlyPriceInDollars, date: timestamp, diff --git a/tools/fetch-team-data.js b/tools/fetch-team-data.js index 01bf4cac8..12d98bf5a 100644 --- a/tools/fetch-team-data.js +++ b/tools/fetch-team-data.js @@ -96,7 +96,7 @@ async function fetchUserProfile(username) { : profile.blog ? `https://${profile.blog}` : profile.blog, - avatar_url: profile.avatar_url, + avatar_url: profile.avatar_url.replace("private-", ""), bio: profile.bio, twitter_username: profile.twitter_username, github_username: profile.login, From d33888c84e7d05575c4b6ebd1e5cbe83ba3adf78 Mon Sep 17 00:00:00 2001 From: Tanuj Kanti Date: Sat, 21 Dec 2024 12:11:08 +0530 Subject: [PATCH 2/8] generate old avatar URLs --- tools/add-author.js | 2 +- tools/fetch-sponsors.js | 4 ++-- tools/fetch-team-data.js | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/tools/add-author.js b/tools/add-author.js index 017fce643..d015f9c9d 100644 --- a/tools/add-author.js +++ b/tools/add-author.js @@ -46,7 +46,7 @@ async function fetchUserProfile() { name: profile.name, title: "Guest Author", website: profile.blog, - avatar_url: profile.avatar_url.replace("private-", ""), + avatar_url: `${profile.avatar_url.replace("private-", "").split("?")[0]}?v=4`, bio: profile.bio, twitter_username: profile.twitter_username, github_username: profile.login, diff --git a/tools/fetch-sponsors.js b/tools/fetch-sponsors.js index 45c68c139..6148c9c31 100644 --- a/tools/fetch-sponsors.js +++ b/tools/fetch-sponsors.js @@ -352,7 +352,7 @@ async function fetchGitHubSponsors() { // return an array in the same format as Open Collective .map(({ sponsor, tier }) => ({ name: sponsor.name || sponsor.login, - image: sponsor.avatarUrl.replace("private-", ""), + image: `${sponsor.avatarUrl.replace("private-", "").split("?")[0]}?v=4`, url: fixUrl(sponsor.websiteUrl || sponsor.url), monthlyDonation: tier.monthlyPriceInDollars, source: "github", @@ -365,7 +365,7 @@ async function fetchGitHubSponsors() { .map(({ sponsor, timestamp, tier, id }) => ({ id, name: sponsor.name || sponsor.login, - image: sponsor.avatarUrl.replace("private-", ""), + image: `${sponsor.avatarUrl.replace("private-", "").split("?")[0]}?v=4`, url: fixUrl(sponsor.websiteUrl || sponsor.url), amount: tier.monthlyPriceInDollars, date: timestamp, diff --git a/tools/fetch-team-data.js b/tools/fetch-team-data.js index 12d98bf5a..a134f1629 100644 --- a/tools/fetch-team-data.js +++ b/tools/fetch-team-data.js @@ -96,7 +96,7 @@ async function fetchUserProfile(username) { : profile.blog ? `https://${profile.blog}` : profile.blog, - avatar_url: profile.avatar_url.replace("private-", ""), + avatar_url: `${profile.avatar_url.replace("private-", "").split("?")[0]}?v=4`, bio: profile.bio, twitter_username: profile.twitter_username, github_username: profile.login, From 83da28241abf860b235b57a7e4fde2ca5b07435a Mon Sep 17 00:00:00 2001 From: Tanuj Kanti Date: Mon, 30 Dec 2024 15:31:08 +0530 Subject: [PATCH 3/8] add utils.js and fallback images --- src/_includes/components/card.macro.html | 3 ++- src/_includes/components/donation.macro.html | 3 ++- src/_includes/components/profile.macro.html | 7 ++++--- src/content/pages/index.html | 7 +++++-- src/content/pages/sponsors.html | 19 ++++++++++++------- tools/add-author.js | 3 ++- tools/fetch-sponsors.js | 5 +++-- tools/fetch-team-data.js | 3 ++- tools/utils.js | 9 +++++++++ 9 files changed, 41 insertions(+), 18 deletions(-) create mode 100644 tools/utils.js diff --git a/src/_includes/components/card.macro.html b/src/_includes/components/card.macro.html index aa0c418f2..751c416c0 100644 --- a/src/_includes/components/card.macro.html +++ b/src/_includes/components/card.macro.html @@ -43,7 +43,8 @@

{{ params.teaser }}