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/lib')
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 + 1)}
- {Math.floor($displayed_count)}
-
-
-
-
-
-
-
--
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 +-
3 files changed, 20 insertions(+), 5 deletions(-)
(limited to 'src/lib')
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 @@