[WIP]
This commit is contained in:
@@ -56,3 +56,4 @@ services:
|
|||||||
url: 'http://pihole.lan/admin'
|
url: 'http://pihole.lan/admin'
|
||||||
type: 'pihole'
|
type: 'pihole'
|
||||||
keywords: 'dns ads blocker internet'
|
keywords: 'dns ads blocker internet'
|
||||||
|
api_token: a3996b80e3d9cdb86b338396a164a8814e8d6f44d2986261fe573bfea53a75fb
|
||||||
|
|||||||
@@ -9,7 +9,6 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
function logoURL(): string {
|
function logoURL(): string {
|
||||||
console.log(brand.logo);
|
|
||||||
if (brand.logo == undefined) {
|
if (brand.logo == undefined) {
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,4 +2,9 @@
|
|||||||
export let data;
|
export let data;
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
pihole status placeholder
|
pihole status
|
||||||
|
{#await data.raw}
|
||||||
|
waiting
|
||||||
|
{:then value}
|
||||||
|
<pre>{JSON.stringify(value, null, 2)}</pre>
|
||||||
|
{/await}
|
||||||
|
|||||||
@@ -1,7 +1,11 @@
|
|||||||
import { type ServiceHandler } from '../service';
|
import { type ServiceHandler } from '../service';
|
||||||
|
|
||||||
export const handle: ServiceHandler = () => {
|
export const handle: ServiceHandler = ({ fetch, config }) => {
|
||||||
const res = { logo: 'https://cdn.rawgit.com/pi-hole/graphics/master/Vortex/Vortex.svg' };
|
const url = config.url + '/api.php?summaryRaw&auth=' + config.api_token;
|
||||||
|
|
||||||
return res;
|
return {
|
||||||
|
logo: 'https://cdn.rawgit.com/pi-hole/graphics/master/Vortex/Vortex.svg',
|
||||||
|
raw: fetch(url).then((raw) => raw.json()),
|
||||||
|
url: url
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -5,4 +5,6 @@ interface ServiceHandlerArgs {
|
|||||||
config: ServiceConfig;
|
config: ServiceConfig;
|
||||||
}
|
}
|
||||||
|
|
||||||
export type ServiceHandler = (input: ServiceHandlerArgs) => Record<string, unknown>;
|
export type ServiceHandler = (
|
||||||
|
input: ServiceHandlerArgs
|
||||||
|
) => Record<string, unknown> | Promise<Record<string, unknown>>;
|
||||||
|
|||||||
@@ -2,7 +2,7 @@ import { clientAddressIsPrivate, clientConfig, serverConfig } from '$lib/server/
|
|||||||
import type { PageServerLoad } from './$types';
|
import type { PageServerLoad } from './$types';
|
||||||
import { getServiceHandler } from '$lib/services/services';
|
import { getServiceHandler } from '$lib/services/services';
|
||||||
|
|
||||||
export const load: PageServerLoad = ({ fetch, getClientAddress }) => {
|
export const load: PageServerLoad = async ({ fetch, getClientAddress }) => {
|
||||||
const serviceData: Array<Array<unknown>> = [];
|
const serviceData: Array<Array<unknown>> = [];
|
||||||
const config = clientConfig();
|
const config = clientConfig();
|
||||||
|
|
||||||
|
|||||||
@@ -16,6 +16,8 @@
|
|||||||
{#each data.config.services as group, i}
|
{#each data.config.services as group, i}
|
||||||
<ServiceGroup {group} groupData={data.serviceData[i]} columns={data.config.columns} />
|
<ServiceGroup {group} groupData={data.serviceData[i]} columns={data.config.columns} />
|
||||||
{/each}
|
{/each}
|
||||||
|
|
||||||
|
<pre>{JSON.stringify(data, null, 2)}</pre>
|
||||||
</main>
|
</main>
|
||||||
|
|
||||||
<footer class="flex h-8 w-full flex-row">
|
<footer class="flex h-8 w-full flex-row">
|
||||||
|
|||||||
Reference in New Issue
Block a user