[WIP]
This commit is contained in:
@@ -9,7 +9,6 @@
|
||||
}
|
||||
|
||||
function logoURL(): string {
|
||||
console.log(brand.logo);
|
||||
if (brand.logo == undefined) {
|
||||
return '';
|
||||
}
|
||||
|
||||
@@ -2,4 +2,9 @@
|
||||
export let data;
|
||||
</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';
|
||||
|
||||
export const handle: ServiceHandler = () => {
|
||||
const res = { logo: 'https://cdn.rawgit.com/pi-hole/graphics/master/Vortex/Vortex.svg' };
|
||||
export const handle: ServiceHandler = ({ fetch, config }) => {
|
||||
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;
|
||||
}
|
||||
|
||||
export type ServiceHandler = (input: ServiceHandlerArgs) => Record<string, unknown>;
|
||||
export type ServiceHandler = (
|
||||
input: ServiceHandlerArgs
|
||||
) => Record<string, unknown> | Promise<Record<string, unknown>>;
|
||||
|
||||
Reference in New Issue
Block a user