From d470d091a852e1325dde25f9827592ee681b9f81 Mon Sep 17 00:00:00 2001 From: mat Date: Sun, 5 Jun 2022 17:58:19 -0500 Subject: fsr is actually the default pack --- src/routes/index.svelte | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/routes/index.svelte b/src/routes/index.svelte index d22f854..851f70e 100644 --- a/src/routes/index.svelte +++ b/src/routes/index.svelte @@ -79,9 +79,9 @@ discord.gg/KtscNUnh4f.

- Resource packs: PacksHQ (default), + Resource packs: Furfsky Reborn (default), + PacksHQ, Furfsky, - Furfsky Reborn, Ectoplasm, RNBW, Hypixel+, -- cgit From 573ffb17bdd6980532fff65987691f1d10b54189 Mon Sep 17 00:00:00 2001 From: mat <27899617+mat-1@users.noreply.github.com> Date: Sun, 12 Jun 2022 13:25:38 -0500 Subject: i forgot to delete this file lmao it's from the sveltekit template --- src/lib/Counter.svelte | 102 ------------------------------------------------- 1 file changed, 102 deletions(-) delete mode 100644 src/lib/Counter.svelte (limited to 'src') diff --git a/src/lib/Counter.svelte b/src/lib/Counter.svelte deleted file mode 100644 index 0df76f5..0000000 --- a/src/lib/Counter.svelte +++ /dev/null @@ -1,102 +0,0 @@ - - -

- - -
-
- - {Math.floor($displayed_count)} -
-
- - -
- - -- cgit From b68a711c131d29a396440f2f76963ec5593aa3e7 Mon Sep 17 00:00:00 2001 From: mat Date: Fri, 17 Jun 2022 14:02:20 -0500 Subject: Show entire JSON if failed to parse --- src/routes/player/[player]/[profile].svelte | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/routes/player/[player]/[profile].svelte b/src/routes/player/[player]/[profile].svelte index caf348b..bc6c18d 100644 --- a/src/routes/player/[player]/[profile].svelte +++ b/src/routes/player/[player]/[profile].svelte @@ -8,7 +8,14 @@ const profile: string = params.profile const data: CleanMemberProfile = await fetch( `${API_URL}player/${player}/${profile}?customization=true` - ).then(r => r.json()) + ).then(async r => { + const text = await r.text() + try { + return JSON.parse(text) + } catch (e) { + throw new Error(`Invalid JSON: ${text}`) + } + }) if (!data.member) { return { -- cgit From 90f4b2c916cdd7f61843c7a2c7f4451d44e18367 Mon Sep 17 00:00:00 2001 From: mat Date: Fri, 17 Jun 2022 14:55:34 -0500 Subject: Fix being ratelimited sometimes --- src/lib/api.ts | 19 +++++++++++++++++-- src/lib/sections/Leaderboards.svelte | 4 ++-- src/lib/sections/Zones.svelte | 2 +- src/routes/__error.svelte | 4 ++-- src/routes/auctionprices.svelte | 10 +++++----- src/routes/election.svelte | 4 ++-- src/routes/items.svelte | 4 ++-- src/routes/leaderboards/[name].svelte | 4 ++-- src/routes/leaderboards/index.svelte | 6 +++--- src/routes/loggedin.ts | 4 ++-- src/routes/logout.ts | 4 ++-- src/routes/player/[player]/[profile].svelte | 7 ++++--- src/routes/player/[player]/index.svelte | 4 ++-- src/routes/profile/index.svelte | 6 +++--- src/routes/profile/update.ts | 6 +++--- src/routes/verify.ts | 8 ++++---- 16 files changed, 56 insertions(+), 40 deletions(-) (limited to 'src') diff --git a/src/lib/api.ts b/src/lib/api.ts index e3559e1..552607c 100644 --- a/src/lib/api.ts +++ b/src/lib/api.ts @@ -1,3 +1,18 @@ +import env from './env' + // the trailing slash is required -export const API_URL = 'https://skyblock-api.matdoes.dev/' -// export const API_URL = 'http://localhost:8080/' \ No newline at end of file +const API_URL = 'https://skyblock-api.matdoes.dev/' +// export const API_URL = 'http://localhost:8080/' + +export async function fetchApi(path: string, fetch: (info: RequestInfo, init?: RequestInit | undefined) => Promise, init?: RequestInit | undefined) { + const { SKYBLOCK_STATS_API_KEY } = env() + if (SKYBLOCK_STATS_API_KEY) { + init = init || {} + if (!init.headers) + init.headers = {} + init.headers['key'] = SKYBLOCK_STATS_API_KEY + } + + const response = await fetch(API_URL + path, init) + return response +} \ No newline at end of file diff --git a/src/lib/sections/Leaderboards.svelte b/src/lib/sections/Leaderboards.svelte index 7e32958..817f59a 100644 --- a/src/lib/sections/Leaderboards.svelte +++ b/src/lib/sections/Leaderboards.svelte @@ -1,5 +1,5 @@ -{#await fetch(`${API_URL}player/${data.member.uuid}/${data.profile.uuid}/leaderboards`).then( r => r.json() )} +{#await fetchApi(`player/${data.member.uuid}/${data.profile.uuid}/leaderboards`, fetch).then( r => r.json() )} Loading... {:then leaderboards} {#if leaderboards.length > 0} diff --git a/src/lib/sections/Zones.svelte b/src/lib/sections/Zones.svelte index ef96456..f7e993b 100644 --- a/src/lib/sections/Zones.svelte +++ b/src/lib/sections/Zones.svelte @@ -1,6 +1,6 @@