From 2a82b78f0a4a0aa23c16ac5debbb7ad026f606c0 Mon Sep 17 00:00:00 2001 From: mat Date: Tue, 22 Feb 2022 22:03:39 +0000 Subject: create index page --- .gitignore | 5 ++- src/app.css | 9 ++++-- src/donators.txt | 10 ++++++ src/lib/SearchUser.svelte | 2 ++ src/routes/index.svelte | 77 +++++++++++++++++++++++++++++++++++++++++++---- svelte.config.js | 51 ++++++++++++++++++++++++++++--- 6 files changed, 139 insertions(+), 15 deletions(-) create mode 100644 src/donators.txt diff --git a/.gitignore b/.gitignore index 09319ad..e901a5f 100644 --- a/.gitignore +++ b/.gitignore @@ -9,4 +9,7 @@ node_modules .vercel .output .yarn -/.vercel_build_output \ No newline at end of file +/.vercel_build_output + +# this file is autogenerated from the svelte.config.js +/src/_donators.json diff --git a/src/app.css b/src/app.css index a77dddd..154cdc0 100644 --- a/src/app.css +++ b/src/app.css @@ -127,7 +127,8 @@ main { /* base styles for inputs */ input[type='text'], -input[type='submit'] { +input[type='submit'], +button { -webkit-appearance: none; background-color: transparent; color: var(--theme-darker-text); @@ -152,13 +153,15 @@ input[type='text']:focus { } /* base styles for buttons */ -input[type='submit'] { +input[type='submit'], +button { margin-left: 0.2em; cursor: pointer; } /* Hovering over a button */ -input[type='submit']:hover { +input[type='submit']:hover, +button:hover { /* make the text lighter */ color: var(--theme-main-text); } diff --git a/src/donators.txt b/src/donators.txt new file mode 100644 index 0000000..37fe2ba --- /dev/null +++ b/src/donators.txt @@ -0,0 +1,10 @@ +951801c9765944bbbd1adf22cc90294e oxnan +c558970dca7343a79083825bacfa65c7 FingaMan +1915444928b64d8b8973df8044f8cdb7 LeaPhant +585b739ac76d40a8a95604ea052930c7 Canadas +7e534bf90cc24b4689e9ab380aab9877 CalebDavisPvP +64e5da31f6ae40caa6e77cebd7694df8 ImEvoke +26398ec782e5440cbcbb94c58b8b60a2 coydog +a7b317669c3945a380cd96d1f516b858 nullDorito +25e670e88a104f96bbe6f5545170682f RunicYoungDragon +4c6beeff830e4bc1b9bc876e9ee8f357 ItzMonday \ No newline at end of file diff --git a/src/lib/SearchUser.svelte b/src/lib/SearchUser.svelte index 3c841ce..886afe1 100644 --- a/src/lib/SearchUser.svelte +++ b/src/lib/SearchUser.svelte @@ -22,6 +22,8 @@ autocapitalize="off" spellcheck="false" aria-label="Enter username" + required bind:value /> + diff --git a/src/routes/index.svelte b/src/routes/index.svelte index b90528a..46d8940 100644 --- a/src/routes/index.svelte +++ b/src/routes/index.svelte @@ -1,15 +1,80 @@ - SkyBlock Stats -
+
+
+

SkyBlock Stats

+ + + +
-
-

SkyBlock Stats

-
+
+ +
+

Other SkyBlock tools

+ +
+ +
+

Donators

+

+ Thank you to these people for + donating. +

+
    + {#each donators as donator} +
  • + {/each} +
+
+
+

Info

+

Website made by mat.

+

Join the Forum Sweats Discord server.

+

+ Resource packs: PacksHQ (default), + Furfsky, + Furfsky Reborn, + Ectoplasm, + RNBW, + Hypixel+, + Worlds and Beyond. +

+

+ Minecraft skin APIs: mc-heads.net for 3d renders and + crafatar.com for 2d heads. +

+

Emojis: Twemoji

+

Font: Atkinson Hyperlegible

+
+
+ + diff --git a/svelte.config.js b/svelte.config.js index 1d64bf4..c6ab18b 100644 --- a/svelte.config.js +++ b/svelte.config.js @@ -1,7 +1,48 @@ // import adapter from '@sveltejs/adapter-cloudflare' import adapter from '@sveltejs/adapter-auto' import preprocess from 'svelte-preprocess' -// import { createHtmlPlugin } from 'vite-plugin-html' +import fs from 'fs' +import https from 'https' + +function fetch(url) { + return new Promise((resolve, reject) => { + let data = '' + + const req = https.request(new URL(url), res => { + res.on('data', d => { + data += d + }) + + res.on('end', () => { + resolve(data) + }) + }) + + req.on('error', error => { + reject(error) + }) + + req.end() + }) +} + +(async () => { + const API_URL = 'https://skyblock-api.matdoes.dev/' + + // create a donators.json from the donators.txt + const donatorUuidsText = await fs.promises.readFile('src/donators.txt', { + encoding: 'utf8' + }) + const donatorUuids = donatorUuidsText.split('\n').map(u => u.split(' ')[0]).filter(u => u) + const donators = await Promise.all( + donatorUuids.map(u => fetch(`${API_URL}player/${u}`) + .then(r => JSON.parse(r).player) + ) + ) + await fs.promises.writeFile('src/_donators.json', JSON.stringify(donators), { + encoding: 'utf8' + }) +})() /** @type {import('@sveltejs/kit').Config} */ const config = { @@ -18,7 +59,7 @@ const config = { // host: '127.0.0.1' // } // }), - + // Override http methods in the Todo forms methodOverride: { @@ -27,9 +68,9 @@ const config = { // https://vitejs.dev/config/ vite: { - // plugins: [createHtmlPlugin({ - // minify: true - // })], + // plugins: [createHtmlPlugin({ + // minify: true + // })], build: { rollupOptions: { // external: ['discord-api-types/payloads/v9', 'discord-api-types', 'discord-api-types/v9'], -- cgit