diff --git a/src/app.html b/src/app.html index f9b4589..5d8cb17 100644 --- a/src/app.html +++ b/src/app.html @@ -4,8 +4,6 @@ - - %sveltekit.head% @@ -63,7 +64,7 @@ Big thanks to all these people for helping out! @@ -75,7 +76,7 @@ Seems like no one has contributed yet... diff --git a/src/lib/sections/about/Resources.svelte b/src/lib/sections/about/Resources.svelte index c1d5d60..68c27cb 100644 --- a/src/lib/sections/about/Resources.svelte +++ b/src/lib/sections/about/Resources.svelte @@ -1,5 +1,6 @@ @@ -14,7 +15,7 @@
diff --git a/src/routes/about/+page.svelte b/src/routes/about/+page.svelte index 1233e58..b5d2dd2 100644 --- a/src/routes/about/+page.svelte +++ b/src/routes/about/+page.svelte @@ -6,6 +6,7 @@ import avatarNullptr from "$lib/assets/avatars/nullptr.jpg"; import avatarRealmy from "$lib/assets/avatars/realmy.jpg"; import avatarJovannMC from "$lib/assets/avatars/jovannmc.jpg"; + import { GITHUB_API_URL } from "$lib/consts"; interface Donator { name: string; @@ -53,17 +54,15 @@ console.log("Loaded GitHub contributors from cache"); return; } - + // Fetch GitHub contributors try { - const response = await fetch( - "https://api.github.com/repos/not-nullptr/VERT/contributors", - ); + const response = await fetch(`${GITHUB_API_URL}/contributors`); if (!response.ok) { throw new Error(`HTTP error, status: ${response.status}`); } const allContribs = await response.json(); - + // Filter out main contributors const mainContribNames = mainContribs.map((contrib) => contrib.github.split("/").pop(), @@ -72,7 +71,7 @@ (contrib: { login: string }) => !mainContribNames.includes(contrib.login), ); - + // Fetch and cache avatar images as Base64 const fetchAvatar = async (url: string) => { const res = await fetch(url); @@ -84,15 +83,21 @@ reader.readAsDataURL(blob); }); }; - + ghContribs = await Promise.all( - filteredContribs.map(async (contrib: { login: string; avatar_url: string; html_url: string }) => ({ - name: contrib.login, - avatar: await fetchAvatar(contrib.avatar_url), - github: contrib.html_url, - })), + filteredContribs.map( + async (contrib: { + login: string; + avatar_url: string; + html_url: string; + }) => ({ + name: contrib.login, + avatar: await fetchAvatar(contrib.avatar_url), + github: contrib.html_url, + }), + ), ); - + // Cache the data in sessionStorage sessionStorage.setItem("ghContribs", JSON.stringify(ghContribs)); } catch (e) {