Add back the amount of stars the repository has

This commit is contained in:
million1156 2024-03-27 08:49:16 -05:00
parent 15b2e4d00a
commit 7362b23d0d
2 changed files with 5 additions and 10 deletions

View file

@ -19,21 +19,16 @@ async function fetchServerSideData() {
}, },
}) })
: Promise.resolve({ json: () => roleMembers }), : Promise.resolve({ json: () => roleMembers }),
GITLAB_API_TOKEN fetch("https://git.suyu.dev/api/v1/repos/suyu/suyu"),
? fetch("https://gitlab.com/api/v4/projects/suyu-emu%2Fsuyu/", {
headers: {
Authorization: `Bearer ${GITLAB_API_TOKEN}`,
},
})
: Promise.resolve({ json: () => ({ star_count: 0 }) }), // Default to 0 if no token is provided
]; ];
const [res, roles, gitlabRes] = await Promise.all(promises); const [res, roles, gitlabRes] = await Promise.all(promises);
const jsonPromises = [res.json(), roles.json(), gitlabRes.json()]; const jsonPromises = [res.json(), roles.json(), gitlabRes.json()];
const [resJson, rolesJson, gitlabResJson] = await Promise.all(jsonPromises); const [resJson, rolesJson, gitResJson] = await Promise.all(jsonPromises);
memberCount = resJson.approximate_member_count; memberCount = resJson.approximate_member_count;
starCount = gitlabResJson.star_count; starCount = gitResJson.stars_count;
if (DISCORD_USER_TOKEN) roleMembers = rolesJson; if (DISCORD_USER_TOKEN) roleMembers = rolesJson;
console.log("Member count:", memberCount); console.log("Member count:", memberCount);

View file

@ -116,7 +116,7 @@
> >
<h1 class="text-[48px] leading-[0.9]">By the numbers</h1> <h1 class="text-[48px] leading-[0.9]">By the numbers</h1>
<HomepageCounter count={contributors} subText="dedicated contributors" /> <HomepageCounter count={contributors} subText="dedicated contributors" />
<HomepageCounter count={starCount} subText="GitLab stars" /> <HomepageCounter count={starCount} subText="Repository stars" /> <!-- The wording "Repository stars" was voted on by the community -->
<HomepageCounter count={4000} subText="supported games" /> <HomepageCounter count={4000} subText="supported games" />
<HomepageCounter count={memberCount} subText="members on Discord" /> <HomepageCounter count={memberCount} subText="members on Discord" />
</div> </div>