diff --git a/src/lib/components/settings/DataSourceSettings.svelte b/src/lib/components/settings/DataSourceSettings.svelte new file mode 100644 index 0000000..5891573 --- /dev/null +++ b/src/lib/components/settings/DataSourceSettings.svelte @@ -0,0 +1,142 @@ + + + + + + +
Data Source
+ + + + + + + + + {#if $settings.nostrRelay} + + + + {/if} + + + + + + +
+ + {#if $settings.dataSource === DataSourceType.THIRD_PARTY_SOURCE} + + + + HTTPS + + + {/if} + + {#if $settings.dataSource === DataSourceType.NOSTR_SOURCE} + + checkValidNostrPubkey('nostrPubKey')} + onInput={() => checkValidNostrPubkey('nostrPubKey')} + /> + {/if} + + {#if $settings.dataSource === DataSourceType.CUSTOM_SOURCE} + + + {/if} +
+
diff --git a/src/lib/components/settings/DisplaySettings.svelte b/src/lib/components/settings/DisplaySettings.svelte new file mode 100644 index 0000000..e391a8c --- /dev/null +++ b/src/lib/components/settings/DisplaySettings.svelte @@ -0,0 +1,189 @@ + + + + + + + + + + + + + + + {#if $settings.hasFrontlight && !$settings.flDisable} + + + + {/if} + + {#if !$settings.flDisable && $settings.hasLightLevel} + + {/if} + + + + + + + + + {#if $settings.hasFrontlight} + + {/if} + + {#if $settings.hasFrontlight && !$settings.flDisable} + + + + + + {/if} + + + diff --git a/src/lib/components/settings/ExtraFeaturesSettings.svelte b/src/lib/components/settings/ExtraFeaturesSettings.svelte new file mode 100644 index 0000000..2d6615c --- /dev/null +++ b/src/lib/components/settings/ExtraFeaturesSettings.svelte @@ -0,0 +1,190 @@ + + + + + + {#if 'bitaxeEnabled' in $settings} + + +
BitAxe
+ + {#if $settings.bitaxeEnabled} + + + + {/if} + +
+ {/if} + + + {#if 'miningPoolStats' in $settings} + + +
Mining Pool stats
+ + {#if $settings.miningPoolStats} + + + {/if} + +
+ {/if} + + + {#if 'nostrZapNotify' in $settings} + + +
Nostr
+ + + {#if $settings.nostrZapNotify} + + + {#if $settings.hasFrontlight && !$settings.flDisable} + + {/if} + + checkValidNostrPubkey('nostrZapPubkey')} + onInput={() => checkValidNostrPubkey('nostrZapPubkey')} + /> + {/if} + +
+ {/if} +
+
diff --git a/src/lib/components/settings/ScreenSpecificSettings.svelte b/src/lib/components/settings/ScreenSpecificSettings.svelte new file mode 100644 index 0000000..45f9313 --- /dev/null +++ b/src/lib/components/settings/ScreenSpecificSettings.svelte @@ -0,0 +1,125 @@ + + + + + + + + + + + + + + + {#if !$settings.actCurrencies} + + {/if} + + +
{$_('section.settings.screens')}
+ {#if $settings.screens} + {#each $settings.screens as s} + + {/each} + {/if} +
+ {#if $settings.actCurrencies && $settings.useNostr !== true} + +
{$_('section.settings.currencies')}
+ {$_('restartRequired')} + {#if $settings.availableCurrencies} + {#each $settings.availableCurrencies as c} + +
+ + +
+ + {/each} + {/if} +
+ {/if} +
+
diff --git a/src/lib/components/settings/SystemSettings.svelte b/src/lib/components/settings/SystemSettings.svelte new file mode 100644 index 0000000..5f12e2d --- /dev/null +++ b/src/lib/components/settings/SystemSettings.svelte @@ -0,0 +1,113 @@ + + + + + + + + + {#if $settings.httpAuthEnabled} + + + + + {/if} + + + + + + + + + + + + + diff --git a/src/lib/components/settings/index.ts b/src/lib/components/settings/index.ts new file mode 100644 index 0000000..6ddfa7c --- /dev/null +++ b/src/lib/components/settings/index.ts @@ -0,0 +1,5 @@ +export { default as ScreenSpecificSettings } from './ScreenSpecificSettings.svelte'; +export { default as DisplaySettings } from './DisplaySettings.svelte'; +export { default as DataSourceSettings } from './DataSourceSettings.svelte'; +export { default as ExtraFeaturesSettings } from './ExtraFeaturesSettings.svelte'; +export { default as SystemSettings } from './SystemSettings.svelte'; diff --git a/src/lib/i18n/en.json b/src/lib/i18n/en.json new file mode 100644 index 0000000..e69de29 diff --git a/src/lib/locales/de.json b/src/lib/locales/de.json index e9756ff..852e68b 100644 --- a/src/lib/locales/de.json +++ b/src/lib/locales/de.json @@ -30,7 +30,7 @@ "wifiTxPower": "WiFi-TX-Leistung", "settingsSaved": "Einstellungen gespeichert", "errorSavingSettings": "Fehler beim Speichern der Einstellungen", - "ownDataSource": "BTClock-Datenquelle verwenden", + "ownDataSource": "BTClock-Datenquelle", "flAlwaysOn": "Displaybeleuchtung immer an", "flEffectDelay": "Displaybeleuchtungeffekt Geschwindigkeit", "flFlashOnUpd": "Displaybeleuchting bei neuem Block", @@ -58,7 +58,16 @@ "hideAll": "Alles ausblenden", "flOffWhenDark": "Displaybeleuchtung aus, wenn es dunkel ist", "luxLightToggleText": "Zum Deaktivieren auf 0 setzen", - "verticalDesc": "Vrtikale Bildschirmbeschreibung" + "verticalDesc": "Vrtikale Bildschirmbeschreibung", + "enableDebugLog": "Debug-Protokoll aktivieren", + "bitaxeEnabled": "BitAxe-Integration aktivieren", + "miningPoolStats": "Mining-Pool-Statistiken Integration Aktivieren", + "nostrZapNotify": "Nostr Zap-Benachrichtigungen aktivieren", + "thirdPartySource": "mempool.space/coincap.io Verwenden", + "dataSource": { + "nostr": "Nostr-Verlag", + "custom": "Benutzerdefinierter dataquelle" + } }, "control": { "systemInfo": "Systeminfo", diff --git a/src/lib/locales/en.json b/src/lib/locales/en.json index caab16c..4cd430c 100644 --- a/src/lib/locales/en.json +++ b/src/lib/locales/en.json @@ -29,7 +29,7 @@ "wifiTxPower": "WiFi TX power", "settingsSaved": "Settings saved", "errorSavingSettings": "Error saving settings", - "ownDataSource": "Use BTClock data source", + "ownDataSource": "BTClock data source", "flMaxBrightness": "Frontlight brightness", "flAlwaysOn": "Frontlight always on", "flEffectDelay": "Frontlight effect speed", @@ -40,11 +40,11 @@ "nostrPubKey": "Nostr source pubkey", "nostrZapKey": "Nostr zap pubkey", "nostrRelay": "Nostr Relay", - "nostrZapNotify": "Nostr Zap Notifications", + "nostrZapNotify": "Enable Nostr Zap Notifications", "useNostr": "Use Nostr data source", "bitaxeHostname": "BitAxe hostname or IP", - "bitaxeEnabled": "Enable BitAxe", - "miningPoolStats": "Enable Mining Pool Stats", + "bitaxeEnabled": "Enable BitAxe-integration", + "miningPoolStats": "Enable Mining Pool Stats integration", "miningPoolName": "Mining Pool", "miningPoolUser": "Mining Pool username or api key", "nostrZapPubkey": "Nostr Zap pubkey", @@ -56,7 +56,7 @@ "httpAuthPass": "WebUI Password", "httpAuthText": "Only password-protects WebUI, not API-calls.", "currencies": "Currencies", - "stagingSource": "Use Staging data source (for development)", + "customSource": "Use custom data source endpoint", "useNostrTooltip": "Very experimental and unstable. Nostr data source is not required for Nostr Zap notifications.", "mowMode": "Mow Suffix Mode", "suffixShareDot": "Suffix compact notation", @@ -73,7 +73,18 @@ "hideAll": "Hide all", "flOffWhenDark": "Frontlight off when dark", "luxLightToggleText": "Set to 0 to disable", - "verticalDesc": "Use vertical screen description" + "verticalDesc": "Use vertical screen description", + "enableDebugLog": "Enable Debug-log", + "dataSource": { + "label": "Data Source", + "btclock": "BTClock Data Source", + "thirdParty": "mempool.space/coincap.io", + "nostr": "Nostr publisher", + "custom": "Custom Endpoint" + }, + "thirdPartySource": "Use mempool.space/coincap.io", + "ceDisableSSL": "Disable SSL", + "ceEndpoint": "Endpoint hostname" }, "control": { "systemInfo": "System info", diff --git a/src/lib/locales/es.json b/src/lib/locales/es.json index 79b6673..96824e3 100644 --- a/src/lib/locales/es.json +++ b/src/lib/locales/es.json @@ -28,7 +28,7 @@ "wifiTxPowerText": "En la mayoría de los casos no es necesario configurar esto.", "settingsSaved": "Configuración guardada", "errorSavingSettings": "Error al guardar la configuración", - "ownDataSource": "Utilice la fuente de datos BTClock", + "ownDataSource": "fuente de datos BTClock", "flMaxBrightness": "Brillo de luz de la pantalla", "flAlwaysOn": "Luz de la pantalla siempre encendida", "flEffectDelay": "Velocidad del efecto de luz de la pantalla", @@ -57,7 +57,16 @@ "hideAll": "Ocultar todo", "flOffWhenDark": "Luz de la pantalla cuando está oscuro", "luxLightToggleText": "Establecer en 0 para desactivar", - "verticalDesc": "Descripción de pantalla vertical" + "verticalDesc": "Descripción de pantalla vertical", + "enableDebugLog": "Habilitar registro de depuración", + "bitaxeEnabled": "Habilitar la integración de BitAxe", + "miningPoolStats": "Habilitar la integración de estadísticas del grupo minero", + "nostrZapNotify": "Habilitar notificaciones de Nostr Zap", + "thirdPartySource": "Utilice mempool.space/coincap.io", + "dataSource": { + "nostr": "editorial nostr", + "custom": "Punto final personalizado" + } }, "control": { "turnOff": "Apagar", diff --git a/src/lib/types/dataSource.ts b/src/lib/types/dataSource.ts new file mode 100644 index 0000000..ffadd46 --- /dev/null +++ b/src/lib/types/dataSource.ts @@ -0,0 +1,6 @@ +export enum DataSourceType { + BTCLOCK_SOURCE = 0, + THIRD_PARTY_SOURCE = 1, + NOSTR_SOURCE = 2, + CUSTOM_SOURCE = 3 +} diff --git a/src/routes/Settings.svelte b/src/routes/Settings.svelte index 3360e22..1210ad6 100644 --- a/src/routes/Settings.svelte +++ b/src/routes/Settings.svelte @@ -1,7 +1,5 @@
- + + | - + +
- {$_('section.settings.title', { default: 'Settings' })} + {$_('section.settings.title')}
- -
- - - - - - - - - - - + + + + + + - {#if !$settings.actCurrencies} - - {/if} - - -
{$_('section.settings.screens')}
- {#if $settings.screens} - {#each $settings.screens as s} - - {/each} - {/if} -
- {#if $settings.actCurrencies && $settings.useNostr !== true} - -
{$_('section.settings.currencies')}
- {$_('restartRequired')} - {#if $settings.availableCurrencies} - {#each $settings.availableCurrencies as c} - -
- - -
- - {/each} - {/if} -
- {/if} -
-
- - - - - - - - - - - - {#if $settings.hasFrontlight && !$settings.flDisable} - - - - {/if} - - {#if !$settings.flDisable && $settings.hasLightLevel} - - {/if} - - - - - - - - - {#if $settings.hasFrontlight} - - {/if} - - {#if $settings.hasFrontlight && !$settings.flDisable} - - - - - - {/if} - - - - - - - - - - {#if $settings.nostrRelay} - - {/if} - - {#if 'stagingSource' in $settings} - - {/if} - - - - - {#if $settings.bitaxeEnabled} - - - - {/if} - {#if $settings.miningPoolStats} - [getMiningPoolName(pool), pool])} - size={$uiSettings.inputSize} - selectClass={$uiSettings.selectClass} - /> - - {/if} - {#if 'nostrZapNotify' in $settings && $settings['nostrZapNotify']} - checkValidNostrPubkey('nostrZapPubkey')} - onInput={() => checkValidNostrPubkey('nostrZapPubkey')} - /> - {/if} - {#if $settings.useNostr} - checkValidNostrPubkey('nostrPubKey')} - onInput={() => checkValidNostrPubkey('nostrPubKey')} - /> - {/if} - {#if 'nostrZapNotify' in $settings || $settings.useNostr} - - - - {/if} - - {#if 'bitaxeEnabled' in $settings} - - {/if} - {#if 'miningPoolStats' in $settings} - - {/if} - {#if 'nostrZapNotify' in $settings} - - - {#if $settings.hasFrontlight && !$settings.flDisable} - - {/if} - {/if} - - - - - - - - - {#if $settings.httpAuthEnabled} - - - - - {/if} - - - - - - - - - - - - - - - - - - -
- + + + + diff --git a/src/routes/Status.svelte b/src/routes/Status.svelte index 812ee68..678a23a 100644 --- a/src/routes/Status.svelte +++ b/src/routes/Status.svelte @@ -17,6 +17,7 @@ Row } from '@sveltestrap/sveltestrap'; import Rendered from './Rendered.svelte'; + import { DataSourceType } from '$lib/types/dataSource'; export let settings; export let status: writable; @@ -74,7 +75,7 @@ }); settings.subscribe((value: object) => { - lightMode = value.bgColor > value.fgColor; + lightMode = !value.invertedColor; if (value.screens) buttonChunks = chunkArray(value.screens, 5); }); @@ -218,7 +219,7 @@ {$_('section.status.uptime')}: {toUptimestring($status.espUptime)}

- {#if $settings.useNostr || $settings.nostrZapNotify} + {#if $settings.dataSource == DataSourceType.NOSTR_SOURCE || $settings.nostrZapNotify} {$_('section.status.nostrConnection')}: {#if $status.connectionStatus && $status.connectionStatus.nostr} @@ -228,8 +229,8 @@ {/if} {/if} - {#if !$settings.useNostr} - {#if !$settings.ownDataSource} + {#if $settings.dataSource != DataSourceType.NOSTR_SOURCE} + {#if $settings.dataSource == DataSourceType.THIRD_PARTY_SOURCE} {$_('section.status.wsPriceConnection')}: {#if $status.connectionStatus && $status.connectionStatus.price}