diff --git a/src/app.scss b/src/app.scss index 04d666f..2a461a6 100644 --- a/src/app.scss +++ b/src/app.scss @@ -22,11 +22,11 @@ a { } .title { - color: var(--text-title); + color: var(--text-title) !important; } .subtitle { - color: var(--text-subtitle); + color: var(--text-subtitle) !important; } h1 { diff --git a/src/config.yml b/src/config.yml index 908399f..e7b4dc4 100644 --- a/src/config.yml +++ b/src/config.yml @@ -13,43 +13,47 @@ links: url: 'https://example.com' services: + - title: '/Media' + icon: 'fas fa-photo-film' + items: + - title: 'Jellyfin' + subtitle: 'Media server for movies and shows' + target: '_blank' + url: 'https://eagle.tuleu.me' + type: jellyfin + keywords: 'cloud storage files' + + - title: 'Sonarr' + subtitle: 'Shows tracker' + target: '_blank' + url: 'http://sonarr.lan' + type: sonarr + keywords: 'shows tracker torrent usenet' + + - title: 'Radarr' + subtitle: 'Movie tracker' + target: '_blank' + url: 'http://radarr.lan' + type: sonarr + keywords: 'movies tracker torrent usenet' + + - title: '/Cloud' - subtitle: 'Private Cloud Utilities' icon: 'fas fa-cloud' items: - title: 'NAS' subtitle: 'Network Attached Storage' icon: 'fas fa-hard-drive' target: '_blank' - url: '/NAS' - type: prowlarr + url: 'https://owl.tuleu.me' + keywords: 'cloud nas files storage' - keywords: 'cloud storage files' - - - title: 'PiHole' - subtitle: 'A DNS Hole' - logo: 'https://cdn.rawgit.com/pi-hole/graphics/master/Vortex/Vortex.svg' - target: '_blank' - url: '/pihole' - type: 'pihole' - keywords: 'cloud storage files' - - - title: '/Cloud' - subtitle: 'Private Cloud Utilities' - icon: 'fas fa-cloud' + - title: '/Infra' + icon: 'fas fa-network-wired' items: - - title: 'NAS' - subtitle: 'Network Attached Storage' - icon: 'fas fa-hard-drive' - target: '_blank' - url: '/NAS' - - keywords: 'cloud storage files' - - title: 'PiHole' - subtitle: 'A DNS Hole' - icon: 'fas fa-hard-drive' + subtitle: 'A DNS to send telemetry and ads to the void' target: '_blank' - url: '/pihole' + url: 'https://pihole.lan/admin' type: 'pihole' - keywords: 'cloud storage files' + keywords: 'dns ads blocker internet' diff --git a/src/lib/components/Brand.svelte b/src/lib/components/Brand.svelte index 790324f..dfab94f 100644 --- a/src/lib/components/Brand.svelte +++ b/src/lib/components/Brand.svelte @@ -3,7 +3,6 @@ export let brand: BrandConfig = {}; export let color = 'var(--text)'; - console.log(brand); function masked() { return brand.logo != undefined && brand.asmask == true; diff --git a/src/lib/components/ServiceCard.svelte b/src/lib/components/ServiceCard.svelte index 158a6b9..138b7a6 100644 --- a/src/lib/components/ServiceCard.svelte +++ b/src/lib/components/ServiceCard.svelte @@ -7,6 +7,8 @@ export let data: any; const component = getServiceComponent(service.type || ''); + + console.log(service);
diff --git a/src/lib/config.ts b/src/lib/config.ts index 027b904..f9565c6 100644 --- a/src/lib/config.ts +++ b/src/lib/config.ts @@ -17,6 +17,8 @@ export interface ServiceConfig extends SectionConfig { url: string; target?: string; type?: string; + tag: string; + keywords: string; [x: string]: unknown; } diff --git a/src/lib/server/config.test.ts b/src/lib/server/config.test.ts index 3595b50..eef8d40 100644 --- a/src/lib/server/config.test.ts +++ b/src/lib/server/config.test.ts @@ -1,5 +1,11 @@ import { describe, expect, it } from 'vitest'; -import { defaultConfig, stripPrivateFields, serverConfig, clientConfig, merge } from './config'; +import { + defaultConfig, + stripPrivateFields, + serverConfig, + clientConfig, + mergeConfig +} from './config'; import type { Config } from '$lib/config'; describe('Config', () => { @@ -9,7 +15,7 @@ describe('Config', () => { }); it('should be able to merge with POJO', () => { - const merged: Config = merge(defaultConfig, { + const merged: Config = mergeConfig(defaultConfig, { subtitle: "Homer's favorite neighboor", colors: { light: { notInDefault: 'foo' } @@ -20,7 +26,8 @@ describe('Config', () => { items: [ { title: 'anoy homer', - customKey: 'all the time' + customKey: 'all the time', + keywords: 'a b cc' } ] } @@ -39,6 +46,7 @@ describe('Config', () => { expect(merged.services[0].items).toHaveLength(1); expect(merged.services[0].items[0].title).toEqual('anoy homer'); expect(merged.services[0].items[0].customKey).toEqual('all the time'); + expect(merged.services[0].items[0].keywords).toEqual('a b cc'); }); it('should be able to strip custom keys', () => { diff --git a/src/lib/server/config.ts b/src/lib/server/config.ts index e5f4f6a..bc92eb5 100644 --- a/src/lib/server/config.ts +++ b/src/lib/server/config.ts @@ -17,7 +17,9 @@ const requiredService: Required = { asmask: false, url: '', target: '', - type: '' + type: '', + tag: '', + keywords: [], }; const requiredServiceGroup: Required = { @@ -55,7 +57,7 @@ export const requiredConfig: Required = { type SPOJO = Record; -export function merge(a: Type, b: SPOJO): Type { +function merge(a: Type, b: SPOJO): Type { const res: Type = { ...a }; for (const [key, value] of Object.entries(b)) { if ( @@ -80,6 +82,11 @@ export function merge(a: Type, b: SPOJO): Type { return res; } + +export function mergeConfig(a: Config, b: SPOJO): Config { + return merge(a,b); +} + const defaultLightConfig: ColorConfig = {}; defaultLightConfig['highlight-primary'] = '#3367d6'; defaultLightConfig['highlight-secondary'] = '#4285f4'; @@ -118,11 +125,16 @@ export const defaultConfig: Config = { dark: defaultDarkConfig }, + links: [], + services: [] }; function strip(toStrip: Type, reference: Type): Type { const res: Type = { ...toStrip }; + if ( reference == undefined ) { + return res; + } const referenceNames = Object.entries(reference).map(([key, value]) => key); for (const [key, value] of Object.entries(res)) { @@ -145,6 +157,7 @@ function strip(toStrip: Type, reference: Type): Type { continue; } + // it is a child object, we strip it further const childReference: SPOJO = reference[key] as SPOJO; (res as SPOJO)[key] = strip(value as SPOJO, childReference); @@ -171,7 +184,7 @@ export function clientConfig(): Config { return _clientConfig; } -let _serverConfig = merge(defaultConfig, configData); +let _serverConfig = mergeConfig(defaultConfig, configData); let _clientConfig = stripPrivateFields(_serverConfig); @@ -181,7 +194,7 @@ export function watchDymamicConfig() { const reloadConfig = async () => { try { const dynamicConfig = yml.load(await readFile(__filepath, 'utf8')); - _serverConfig = merge(defaultConfig, dynamicConfig); + _serverConfig = mergeConfig(defaultConfig, dynamicConfig); _clientConfig = stripPrivateFields(_serverConfig); } catch (err) { console.error('could not read or parse config: ' + err); diff --git a/src/lib/services/pihole/PiHoleContent.svelte b/src/lib/services/pihole/PiHoleContent.svelte index 11d70c1..7e93f29 100644 --- a/src/lib/services/pihole/PiHoleContent.svelte +++ b/src/lib/services/pihole/PiHoleContent.svelte @@ -1,5 +1,5 @@ -

pihole status

+pihole status diff --git a/src/lib/services/prowlarr/ProwlarrContent.svelte b/src/lib/services/prowlarr/ProwlarrContent.svelte index 32b5022..96e078d 100644 --- a/src/lib/services/prowlarr/ProwlarrContent.svelte +++ b/src/lib/services/prowlarr/ProwlarrContent.svelte @@ -1,5 +1,5 @@ -

Prowlarr content

+Prowlarr content