From 2fc9990b9ec93aed082cea5fdf749e7f8b7ed397 Mon Sep 17 00:00:00 2001 From: Pierre-Yves Bigourdan <10694593+PyvesB@users.noreply.github.com> Date: Sat, 30 Dec 2023 18:17:04 +0100 Subject: [PATCH 1/2] Ensure social category badges are rendered with social style and logo --- services/github/gist/github-gist-stars.service.js | 6 +++++- services/github/github-followers.service.js | 1 + services/github/github-forks.service.js | 1 + services/github/github-stars.service.js | 1 + services/github/github-total-star.service.js | 1 + services/github/github-watchers.service.js | 1 + services/gitlab/gitlab-forks.service.js | 1 + services/gitlab/gitlab-stars.service.js | 1 + services/keybase/keybase-btc.service.js | 2 ++ services/keybase/keybase-pgp.service.js | 2 ++ services/keybase/keybase-xlm.service.js | 2 ++ services/keybase/keybase-zec.service.js | 2 ++ services/lemmy/lemmy.service.js | 3 ++- services/modrinth/modrinth-followers.service.js | 3 ++- services/reddit/subreddit-subscribers.service.js | 1 + services/reddit/user-karma.service.js | 1 + services/thunderstore/thunderstore-likes.service.js | 1 + services/twitch/twitch.service.js | 1 + 18 files changed, 28 insertions(+), 3 deletions(-) diff --git a/services/github/gist/github-gist-stars.service.js b/services/github/gist/github-gist-stars.service.js index 85282b2fdfc1e..1bac843355560 100644 --- a/services/github/gist/github-gist-stars.service.js +++ b/services/github/gist/github-gist-stars.service.js @@ -52,7 +52,11 @@ export default class GistStars extends GithubAuthV4Service { } static render({ stargazerCount, url, stargazers }) { - return { message: metric(stargazerCount), link: [url, stargazers] } + return { + message: metric(stargazerCount), + style: 'social', + link: [url, stargazers], + } } async fetch({ gistId }) { diff --git a/services/github/github-followers.service.js b/services/github/github-followers.service.js index f0cb3df95f40e..88e1c81db90ac 100644 --- a/services/github/github-followers.service.js +++ b/services/github/github-followers.service.js @@ -29,6 +29,7 @@ export default class GithubFollowers extends GithubAuthV3Service { static render({ followers }) { return { message: metric(followers), + style: 'social', color: 'blue', } } diff --git a/services/github/github-forks.service.js b/services/github/github-forks.service.js index 0c60e03c67ba7..84ad0100aae3c 100644 --- a/services/github/github-forks.service.js +++ b/services/github/github-forks.service.js @@ -45,6 +45,7 @@ export default class GithubForks extends GithubAuthV4Service { static render({ user, repo, forkCount }) { return { message: metric(forkCount), + style: 'social', color: 'blue', link: [ `https://github.com/${user}/${repo}/fork`, diff --git a/services/github/github-stars.service.js b/services/github/github-stars.service.js index 77589e502e604..fa729b4167d5c 100644 --- a/services/github/github-stars.service.js +++ b/services/github/github-stars.service.js @@ -44,6 +44,7 @@ export default class GithubStars extends GithubAuthV3Service { const slug = `${encodeURIComponent(user)}/${encodeURIComponent(repo)}` return { message: metric(stars), + style: 'social', color: 'blue', link: [ `https://github.com/${slug}`, diff --git a/services/github/github-total-star.service.js b/services/github/github-total-star.service.js index fca0be35d8a6d..6a2f7e52af33f 100644 --- a/services/github/github-total-star.service.js +++ b/services/github/github-total-star.service.js @@ -178,6 +178,7 @@ export default class GithubTotalStarService extends GithubAuthV4Service { static render({ totalStars, user }) { return { message: metric(totalStars), + style: 'social', color: 'blue', link: [`https://github.com/${user}`], } diff --git a/services/github/github-watchers.service.js b/services/github/github-watchers.service.js index ceb6f1893fd1a..bb7d50997bbee 100644 --- a/services/github/github-watchers.service.js +++ b/services/github/github-watchers.service.js @@ -43,6 +43,7 @@ export default class GithubWatchers extends GithubAuthV3Service { static render({ watchers, user, repo }) { return { message: metric(watchers), + style: 'social', color: 'blue', link: [ `https://github.com/${user}/${repo}`, diff --git a/services/gitlab/gitlab-forks.service.js b/services/gitlab/gitlab-forks.service.js index d06b0bb7c00a0..c0882ea489d1f 100644 --- a/services/gitlab/gitlab-forks.service.js +++ b/services/gitlab/gitlab-forks.service.js @@ -42,6 +42,7 @@ export default class GitlabForks extends GitLabBase { static render({ baseUrl, project, forkCount }) { return { message: metric(forkCount), + style: 'social', color: 'blue', link: [ `${baseUrl}/${project}/-/forks/new`, diff --git a/services/gitlab/gitlab-stars.service.js b/services/gitlab/gitlab-stars.service.js index 280f9fdbd95e0..7125ab7babb6c 100644 --- a/services/gitlab/gitlab-stars.service.js +++ b/services/gitlab/gitlab-stars.service.js @@ -42,6 +42,7 @@ export default class GitlabStars extends GitLabBase { static render({ baseUrl, project, starCount }) { return { message: metric(starCount), + style: 'social', color: 'blue', link: [`${baseUrl}/${project}`, `${baseUrl}/${project}/-/starrers`], } diff --git a/services/keybase/keybase-btc.service.js b/services/keybase/keybase-btc.service.js index 1a2f8b0cb3584..811f00dd8c56e 100644 --- a/services/keybase/keybase-btc.service.js +++ b/services/keybase/keybase-btc.service.js @@ -48,11 +48,13 @@ export default class KeybaseBTC extends KeybaseProfile { static defaultBadgeData = { label: 'btc', color: 'informational', + namedLogo: 'keybase', } static render({ address }) { return { message: address, + style: 'social', } } diff --git a/services/keybase/keybase-pgp.service.js b/services/keybase/keybase-pgp.service.js index a7b1cb2a7e995..c70b9e73b48ca 100644 --- a/services/keybase/keybase-pgp.service.js +++ b/services/keybase/keybase-pgp.service.js @@ -44,11 +44,13 @@ export default class KeybasePGP extends KeybaseProfile { static defaultBadgeData = { label: 'pgp', color: 'informational', + namedLogo: 'keybase', } static render({ fingerprint }) { return { message: fingerprint.slice(-16).toUpperCase(), + style: 'social', } } diff --git a/services/keybase/keybase-xlm.service.js b/services/keybase/keybase-xlm.service.js index 99e56e693b85e..23a2dbb870e7c 100644 --- a/services/keybase/keybase-xlm.service.js +++ b/services/keybase/keybase-xlm.service.js @@ -46,11 +46,13 @@ export default class KeybaseXLM extends KeybaseProfile { static defaultBadgeData = { label: 'xlm', color: 'informational', + namedLogo: 'keybase', } static render({ address }) { return { message: address, + style: 'social', } } diff --git a/services/keybase/keybase-zec.service.js b/services/keybase/keybase-zec.service.js index 3afed7044db06..758774cb98a3d 100644 --- a/services/keybase/keybase-zec.service.js +++ b/services/keybase/keybase-zec.service.js @@ -48,11 +48,13 @@ export default class KeybaseZEC extends KeybaseProfile { static defaultBadgeData = { label: 'zec', color: 'informational', + namedLogo: 'keybase', } static render({ address }) { return { message: address, + style: 'social', } } diff --git a/services/lemmy/lemmy.service.js b/services/lemmy/lemmy.service.js index 0a325cc43e535..dd9d2e2f3b310 100644 --- a/services/lemmy/lemmy.service.js +++ b/services/lemmy/lemmy.service.js @@ -30,12 +30,13 @@ export default class Lemmy extends BaseJsonService { }, } - static defaultBadgeData = { label: 'community' } + static defaultBadgeData = { label: 'community', namedLogo: 'lemmy' } static render({ community, members }) { return { label: `subscribe to ${community}`, message: metric(members), + style: 'social', color: 'brightgreen', } } diff --git a/services/modrinth/modrinth-followers.service.js b/services/modrinth/modrinth-followers.service.js index 93035f9eb148d..b845768f8f3ab 100644 --- a/services/modrinth/modrinth-followers.service.js +++ b/services/modrinth/modrinth-followers.service.js @@ -23,11 +23,12 @@ export default class ModrinthFollowers extends BaseModrinthService { }, } - static defaultBadgeData = { label: 'followers' } + static defaultBadgeData = { label: 'followers', namedLogo: 'modrinth' } static render({ followers }) { return { message: metric(followers), + style: 'social', color: 'blue', } } diff --git a/services/reddit/subreddit-subscribers.service.js b/services/reddit/subreddit-subscribers.service.js index a0d00483c7fd6..6cbf0456ec39e 100644 --- a/services/reddit/subreddit-subscribers.service.js +++ b/services/reddit/subreddit-subscribers.service.js @@ -40,6 +40,7 @@ export default class RedditSubredditSubscribers extends BaseJsonService { return { label: `follow r/${subreddit}`, message: metric(subscribers), + style: 'social', color: 'red', link: [`https://www.reddit.com/r/${subreddit}`], } diff --git a/services/reddit/user-karma.service.js b/services/reddit/user-karma.service.js index ca8b489d3451b..ae0accb41cd69 100644 --- a/services/reddit/user-karma.service.js +++ b/services/reddit/user-karma.service.js @@ -52,6 +52,7 @@ export default class RedditUserKarma extends BaseJsonService { return { label, message: metric(karma), + style: 'social', color: karma > 0 ? 'brightgreen' : karma === 0 ? 'orange' : 'red', link: [`https://www.reddit.com/u/${user}`], } diff --git a/services/thunderstore/thunderstore-likes.service.js b/services/thunderstore/thunderstore-likes.service.js index 4304c308b9920..01e1aca421946 100644 --- a/services/thunderstore/thunderstore-likes.service.js +++ b/services/thunderstore/thunderstore-likes.service.js @@ -33,6 +33,7 @@ export default class ThunderstoreLikes extends BaseThunderstoreService { static render({ likes }) { return { message: metric(likes), + style: 'social', color: `#${this.thunderstoreGreen}`, } } diff --git a/services/twitch/twitch.service.js b/services/twitch/twitch.service.js index b94d49a33498c..70154b9ac01f8 100644 --- a/services/twitch/twitch.service.js +++ b/services/twitch/twitch.service.js @@ -38,6 +38,7 @@ export default class TwitchStatus extends TwitchBase { static render({ user, isLive }) { return { message: isLive ? 'live' : 'offline', + style: 'social', color: isLive ? 'red' : 'lightgrey', link: `https://www.twitch.tv/${user}`, } From 9ee9577324faa09a8e5e3ebce2cac7718c98e9a5 Mon Sep 17 00:00:00 2001 From: Pierre-Yves Bigourdan <10694593+PyvesB@users.noreply.github.com> Date: Sun, 31 Dec 2023 10:22:24 +0100 Subject: [PATCH 2/2] Fix Twitch auth test --- services/twitch/twitch.spec.js | 1 + 1 file changed, 1 insertion(+) diff --git a/services/twitch/twitch.spec.js b/services/twitch/twitch.spec.js index b1ad8e209eaef..ab418bcd48c5a 100644 --- a/services/twitch/twitch.spec.js +++ b/services/twitch/twitch.spec.js @@ -46,6 +46,7 @@ describe('TwitchStatus', function () { }), ).to.deep.equal({ message: 'offline', + style: 'social', link: 'https://www.twitch.tv/undefined', color: 'lightgrey', })