From 99679cc45b2a5fbce2aebd63fc50523fbabdfb0b Mon Sep 17 00:00:00 2001 From: Neshura Date: Thu, 4 Jan 2024 01:35:34 +0100 Subject: [PATCH] Close Socket.io connection after fetching data on server --- src/lib/components/ServerCard.svelte | 185 +++++++++++++++++++++++++++ src/routes/data/servers/+server.ts | 0 src/routes/servers/+page.server.ts | 0 src/routes/services/+page.server.ts | 1 + 4 files changed, 186 insertions(+) create mode 100644 src/lib/components/ServerCard.svelte create mode 100644 src/routes/data/servers/+server.ts create mode 100644 src/routes/servers/+page.server.ts diff --git a/src/lib/components/ServerCard.svelte b/src/lib/components/ServerCard.svelte new file mode 100644 index 0000000..cc05270 --- /dev/null +++ b/src/lib/components/ServerCard.svelte @@ -0,0 +1,185 @@ + + + + +
+
+
(hover.title = true)} + on:mouseleave={() => (hover.title = false)} + > + {#if service.icon} + {#if img_source != ''} + {service.name} Logo + {:else} + + {/if} + {:else}{/if} + {service.name} + {#if hover.title} +
+ +
+ {/if} +
+ +

+ {status == 0 + ? 'Offline' + : status == 1 + ? 'Online' + : status == 2 + ? 'Pending' + : status == 3 + ? 'Maint.' + : 'Loading'} +

+
+

{service.desc}

+

{service.warn}

+ +
diff --git a/src/routes/data/servers/+server.ts b/src/routes/data/servers/+server.ts new file mode 100644 index 0000000..e69de29 diff --git a/src/routes/servers/+page.server.ts b/src/routes/servers/+page.server.ts new file mode 100644 index 0000000..e69de29 diff --git a/src/routes/services/+page.server.ts b/src/routes/services/+page.server.ts index cb944e6..f9ba6b5 100644 --- a/src/routes/services/+page.server.ts +++ b/src/routes/services/+page.server.ts @@ -50,6 +50,7 @@ async function login(socket: Socket): Promise { { username: process.env.KUMA_USERNAME, password: process.env.KUMA_PASSWORD, token: '' }, (res: { token: string }) => { token = res.token; + socket.close(); } );