Skip to content

Commit 9841a81

Browse files
committed
add default values for Contributors.svelte
1 parent 158a94e commit 9841a81

File tree

6 files changed

+327
-52
lines changed

6 files changed

+327
-52
lines changed

src/lib/components/singletons/Contributors.svelte

Lines changed: 21 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,36 @@
11
<script lang="ts">
22
export let contributors;
3+
export let error;
4+
import { contributorsList } from '$lib/constants/constants';
35
</script>
46

5-
{#if contributors && contributors.length > 0}
6-
<div class="container">
7-
<h2>Contributors</h2>
8-
<p>Here are the people responsible for creating and maintaining Torrust.</p>
9-
<div class="flex">
7+
<div class="container">
8+
<h2>Contributors</h2>
9+
<p>Here are the people responsible for creating and maintaining Torrust.</p>
10+
<div class="flex">
11+
{#if !error && contributors && contributors.length > 0}
1012
{#each contributors as contributor}
1113
<div>
1214
<a href={contributor.html_url} target="_blank" title={contributor.login}>
1315
<img src={contributor.avatar_url} alt="contributor" />
1416
</a>
1517
</div>
1618
{/each}
17-
</div>
19+
{:else}
20+
{#each contributorsList as contributor}
21+
<div>
22+
<a
23+
href="https://github.com/{contributor.html_url}"
24+
target="_blank"
25+
title={contributor.html_url}
26+
>
27+
<img src={contributor.avatar_url} alt="contributor" />
28+
</a>
29+
</div>
30+
{/each}
31+
{/if}
1832
</div>
19-
{/if}
33+
</div>
2034

2135
<style lang="scss">
2236
@import '$lib/scss/breakpoints.scss';

src/lib/constants/constants.ts

Lines changed: 260 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -706,3 +706,263 @@ export const aboutTableData = [
706706
ipfs: 'Cryptographic validation of all content'
707707
}
708708
];
709+
710+
export const contributorsList = [
711+
{
712+
html_url: 'mickvandijke',
713+
avatar_url: 'https://avatars.githubusercontent.com/u/12992260?v=4'
714+
},
715+
{
716+
html_url: 'Aimless321',
717+
avatar_url: 'https://avatars.githubusercontent.com/u/6079485?v=4'
718+
},
719+
{
720+
html_url: 'da2ce7',
721+
avatar_url: 'https://avatars.githubusercontent.com/u/691439?v=4'
722+
},
723+
{
724+
html_url: 'josecelano',
725+
avatar_url: 'https://avatars.githubusercontent.com/u/58816?v=4'
726+
},
727+
{
728+
html_url: 'jamiew0w',
729+
avatar_url: 'https://avatars.githubusercontent.com/u/8589138?v=4'
730+
},
731+
{
732+
html_url: 'GGLinnk',
733+
avatar_url: 'https://avatars.githubusercontent.com/u/22531645?v=4'
734+
},
735+
{
736+
html_url: 'naim94a',
737+
avatar_url: 'https://avatars.githubusercontent.com/u/227396?v=4'
738+
},
739+
{
740+
html_url: 'Power2All',
741+
avatar_url: 'https://avatars.githubusercontent.com/u/2010549?v=4'
742+
},
743+
{
744+
html_url: 'mario-nt',
745+
avatar_url: 'https://avatars.githubusercontent.com/u/141633147?v=4'
746+
},
747+
{
748+
html_url: 'hungfnt',
749+
avatar_url: 'https://avatars.githubusercontent.com/u/167511750?v=4'
750+
},
751+
{
752+
html_url: 'pataquets',
753+
avatar_url: 'https://avatars.githubusercontent.com/u/1286254?v=4'
754+
},
755+
{
756+
html_url: 'alexohneander',
757+
avatar_url: 'https://avatars.githubusercontent.com/u/1469954?v=4'
758+
},
759+
{
760+
html_url: 'Binlogo',
761+
avatar_url: 'https://avatars.githubusercontent.com/u/7845507?v=4'
762+
},
763+
{
764+
html_url: 'si14',
765+
avatar_url: 'https://avatars.githubusercontent.com/u/316910?v=4'
766+
},
767+
{
768+
html_url: 'makefu',
769+
avatar_url: 'https://avatars.githubusercontent.com/u/115218?v=4'
770+
},
771+
{
772+
html_url: 'ShrirangB',
773+
avatar_url: 'https://avatars.githubusercontent.com/u/68811459?v=4'
774+
},
775+
{
776+
html_url: 'abstralexis',
777+
avatar_url: 'https://avatars.githubusercontent.com/u/107479436?v=4'
778+
},
779+
{
780+
html_url: 'ftsimas',
781+
avatar_url: 'https://avatars.githubusercontent.com/u/47324723?v=4'
782+
},
783+
{
784+
html_url: 'Zorlin',
785+
avatar_url: 'https://avatars.githubusercontent.com/u/1369772?v=4'
786+
},
787+
{
788+
html_url: 'cgbosse',
789+
avatar_url: 'https://avatars.githubusercontent.com/u/15330600?v=4'
790+
},
791+
{
792+
html_url: 'anujkumardarji',
793+
avatar_url: 'https://avatars.githubusercontent.com/u/45550546?v=4'
794+
},
795+
{
796+
html_url: 'Wolfremium13',
797+
avatar_url: 'https://avatars.githubusercontent.com/u/64548160?v=4'
798+
},
799+
{
800+
html_url: 'danielroe',
801+
avatar_url: 'https://avatars.githubusercontent.com/u/28706372?v=4'
802+
},
803+
{
804+
html_url: 'pcarles',
805+
avatar_url: 'https://avatars.githubusercontent.com/u/51314945?v=4'
806+
},
807+
{
808+
html_url: 'postmeback',
809+
avatar_url: 'https://avatars.githubusercontent.com/u/14862687?v=4'
810+
},
811+
{
812+
html_url: 'Douile',
813+
avatar_url: 'https://avatars.githubusercontent.com/u/25043847?v=4'
814+
},
815+
{
816+
html_url: 'hugues31',
817+
avatar_url: 'https://avatars.githubusercontent.com/u/19244704?v=4'
818+
},
819+
{
820+
html_url: 'kent-williams',
821+
avatar_url: 'https://avatars.githubusercontent.com/u/479648?v=4'
822+
},
823+
{
824+
html_url: 'suhlig',
825+
avatar_url: 'https://avatars.githubusercontent.com/u/80507?v=4'
826+
},
827+
{
828+
html_url: 'tecknicaltom',
829+
avatar_url: 'https://avatars.githubusercontent.com/u/310024?v=4'
830+
},
831+
{
832+
html_url: 'ihaiker',
833+
avatar_url: 'https://avatars.githubusercontent.com/u/6601465?v=4'
834+
},
835+
{
836+
html_url: 'rimathia',
837+
avatar_url: 'https://avatars.githubusercontent.com/u/7736877?v=4'
838+
},
839+
{
840+
html_url: 'grmbyrn',
841+
avatar_url: 'https://avatars.githubusercontent.com/u/95353365?v=4'
842+
},
843+
{
844+
html_url: 'matfantinel',
845+
avatar_url: 'https://avatars.githubusercontent.com/u/24247035?v=4'
846+
},
847+
{
848+
html_url: 'nafumal',
849+
avatar_url: 'https://avatars.githubusercontent.com/u/167825698?v=4'
850+
},
851+
{
852+
html_url: 'GGist',
853+
avatar_url: 'https://avatars.githubusercontent.com/u/5248583?v=4'
854+
},
855+
{
856+
html_url: 'hauleth',
857+
avatar_url: 'https://avatars.githubusercontent.com/u/291639?v=4'
858+
},
859+
{
860+
html_url: 'reeFridge',
861+
avatar_url: 'https://avatars.githubusercontent.com/u/12645379?v=4'
862+
},
863+
{
864+
html_url: 'astro',
865+
avatar_url: 'https://avatars.githubusercontent.com/u/12923?v=4'
866+
},
867+
{
868+
html_url: 'derekhendrickx',
869+
avatar_url: 'https://avatars.githubusercontent.com/u/1218149?v=4'
870+
},
871+
{
872+
html_url: 'morrme',
873+
avatar_url: 'https://avatars.githubusercontent.com/u/26514778?v=4'
874+
},
875+
{
876+
html_url: 'chpio',
877+
avatar_url: 'https://avatars.githubusercontent.com/u/545659?v=4'
878+
},
879+
{
880+
html_url: 'toby',
881+
avatar_url: 'https://avatars.githubusercontent.com/u/83556?v=4'
882+
},
883+
{
884+
html_url: 'madadam',
885+
avatar_url: 'https://avatars.githubusercontent.com/u/5271?v=4'
886+
},
887+
{
888+
html_url: '5225225',
889+
avatar_url: 'https://avatars.githubusercontent.com/u/8584210?v=4'
890+
},
891+
{
892+
html_url: 'adamhammes',
893+
avatar_url: 'https://avatars.githubusercontent.com/u/5597274?v=4'
894+
},
895+
{
896+
html_url: 'casey',
897+
avatar_url: 'https://avatars.githubusercontent.com/u/1945?v=4'
898+
},
899+
{
900+
html_url: 'nrempel',
901+
avatar_url: 'https://avatars.githubusercontent.com/u/540048?v=4'
902+
},
903+
{
904+
html_url: 'thequux',
905+
avatar_url: 'https://avatars.githubusercontent.com/u/5264?v=4'
906+
},
907+
{
908+
html_url: 'letFunny',
909+
avatar_url: 'https://avatars.githubusercontent.com/u/24965409?v=4'
910+
},
911+
912+
{
913+
html_url: 'svartalf',
914+
avatar_url: 'https://avatars.githubusercontent.com/u/1279564?v=4'
915+
},
916+
{
917+
html_url: 'alekitto',
918+
avatar_url: 'https://avatars.githubusercontent.com/u/1257206?v=4'
919+
},
920+
{
921+
html_url: 'prateekkumarweb',
922+
avatar_url: 'https://avatars.githubusercontent.com/u/15064671?v=4'
923+
},
924+
{
925+
html_url: 'benbrandt',
926+
avatar_url: 'https://avatars.githubusercontent.com/u/2111074?v=4'
927+
},
928+
{
929+
html_url: 'Robbepop',
930+
avatar_url: 'https://avatars.githubusercontent.com/u/8193155?v=4'
931+
},
932+
{
933+
html_url: 'rye',
934+
avatar_url: 'https://avatars.githubusercontent.com/u/1566689?v=4'
935+
},
936+
{
937+
html_url: 'Luni-4',
938+
avatar_url: 'https://avatars.githubusercontent.com/u/12353765?v=4'
939+
},
940+
{
941+
html_url: 'qryxip',
942+
avatar_url: 'https://avatars.githubusercontent.com/u/14125495?v=4'
943+
},
944+
{
945+
html_url: 'stepankuzmin',
946+
avatar_url: 'https://avatars.githubusercontent.com/u/533564?v=4'
947+
},
948+
{
949+
html_url: 'ubnt-intrepid',
950+
avatar_url: 'https://avatars.githubusercontent.com/u/7354350?v=4'
951+
},
952+
{
953+
html_url: 'sharksforarms',
954+
avatar_url: 'https://avatars.githubusercontent.com/u/10912917?v=4'
955+
},
956+
{
957+
html_url: 'magecnion',
958+
avatar_url: 'https://avatars.githubusercontent.com/u/5495235?v=4'
959+
},
960+
{
961+
html_url: 'ty5e3a45',
962+
avatar_url: 'https://avatars.githubusercontent.com/u/155493608?v=4'
963+
},
964+
{
965+
html_url: 'TGlide',
966+
avatar_url: 'https://avatars.githubusercontent.com/u/26071571?v=4'
967+
}
968+
];

src/lib/utils/cache.ts

Lines changed: 6 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import type { CacheEntry } from '$lib/utils/types';
44
export const contributorsStore = writable<Map<string, CacheEntry<unknown>>>(new Map());
55

66
const CACHE_TTL = 60 * 60 * 1000;
7+
const token = import.meta.env.VITE_GITHUB_TOKEN;
78

89
export async function fetchWithCache<T>(url: string): Promise<T> {
910
const now = Date.now();
@@ -12,28 +13,14 @@ export async function fetchWithCache<T>(url: string): Promise<T> {
1213

1314
const cached = cache.get(url);
1415
if (cached && cached.expiresAt > now) {
15-
console.log('Fetching data from store');
1616
return cached.data as T;
1717
}
1818

19-
console.log('Fetching data from API');
20-
21-
const response = await fetch(url);
22-
23-
const rateLimit = response.headers.get('X-RateLimit-Limit');
24-
const rateRemaining = response.headers.get('X-RateLimit-Remaining');
25-
const resetTime = response.headers.get('X-RateLimit-Reset');
26-
27-
if (rateLimit && rateRemaining) {
28-
console.log(
29-
`Rate limit: ${rateLimit}, Remaining: ${rateRemaining} ${new Date(Date.now()).toLocaleTimeString([], { hour: '2-digit', minute: '2-digit' })}`
30-
);
31-
}
32-
33-
if (resetTime) {
34-
const resetDate = new Date(parseInt(resetTime) * 1000);
35-
console.log(`Rate limit resets at: ${resetDate}`);
36-
}
19+
const response = await fetch(url, {
20+
headers: {
21+
Authorization: `Bearer ${token}`
22+
}
23+
});
3724

3825
if (!response.ok) {
3926
console.error(`Failed to fetch from ${url}:`, response.statusText);

0 commit comments

Comments
 (0)