diff --git a/src/lib/components/ServiceCard.svelte b/src/lib/components/ServiceCard.svelte index 2d5ccfa..915fd60 100644 --- a/src/lib/components/ServiceCard.svelte +++ b/src/lib/components/ServiceCard.svelte @@ -1,10 +1,11 @@ pihole status -{#await data.raw} - waiting -{:then value} -
{JSON.stringify(value, null, 2)}
-{/await}
diff --git a/src/lib/services/pihole/+service.ts b/src/lib/services/pihole/+service.ts
index 8aa0cb7..f5225ed 100644
--- a/src/lib/services/pihole/+service.ts
+++ b/src/lib/services/pihole/+service.ts
@@ -11,9 +11,15 @@ export const handle: ServiceHandler = async (config: ServiceConfig) => {
config.url + '/api.php?summaryRaw&auth=' + config.api_token
);
res.status = resp.ok ? 'online' : 'offline';
- res.raw = resp.json();
+ const raw = await resp.json();
+ res.data = {
+ queries_today: raw.dns_queries_today,
+ ads_percentage: raw.ads_percentage_today,
+ status: raw.status,
+ client: raw.unique_clients
+ };
} catch (error) {
- res.status = undefined;
+ res.status = 'offline';
console.warn('could not fetch pihole status: ' + error);
}
diff --git a/src/routes/+page.svelte b/src/routes/+page.svelte
index f33aa67..555b99f 100644
--- a/src/routes/+page.svelte
+++ b/src/routes/+page.svelte
@@ -16,8 +16,6 @@
{#each data.config.services as group, i}
{JSON.stringify(data, null, 2)}