Compare commits
4 commits
main
...
feature/ln
Author | SHA1 | Date | |
---|---|---|---|
e18ae066b4 | |||
901809a29b | |||
744535eace | |||
e16062569d |
18 changed files with 481 additions and 470 deletions
|
@ -63,7 +63,8 @@
|
||||||
"nostr-tools": "^2.7.1",
|
"nostr-tools": "^2.7.1",
|
||||||
"patch-package": "^8.0.0",
|
"patch-package": "^8.0.0",
|
||||||
"svelte-bootstrap-icons": "^3.1.1",
|
"svelte-bootstrap-icons": "^3.1.1",
|
||||||
"svelte-i18n": "^4.0.0"
|
"svelte-i18n": "^4.0.0",
|
||||||
|
"svelte-multiselect": "^11.0.0-rc.1"
|
||||||
},
|
},
|
||||||
"resolutions": {
|
"resolutions": {
|
||||||
"es5-ext": ">=0.10.64",
|
"es5-ext": ">=0.10.64",
|
||||||
|
|
|
@ -25,10 +25,10 @@
|
||||||
export let invalid: boolean | undefined = undefined;
|
export let invalid: boolean | undefined = undefined;
|
||||||
export let minlength: string | undefined = undefined;
|
export let minlength: string | undefined = undefined;
|
||||||
export let onChange: (() => void) | undefined = undefined;
|
export let onChange: (() => void) | undefined = undefined;
|
||||||
export let onInput: ((e: Event) => void) | undefined = undefined;
|
export let onInput: (() => void) | undefined = undefined;
|
||||||
|
|
||||||
const onInputHandler = (e: Event) => {
|
const onInputHandler = () => {
|
||||||
onInput?.(e);
|
onInput?.();
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|
|
@ -138,5 +138,31 @@
|
||||||
size={$uiSettings.inputSize}
|
size={$uiSettings.inputSize}
|
||||||
/>
|
/>
|
||||||
{/if}
|
{/if}
|
||||||
|
<Row>
|
||||||
|
<SettingsSwitch
|
||||||
|
id="lnbitsEnabled"
|
||||||
|
bind:checked={$settings.lnbitsEnabled}
|
||||||
|
label="{$_('section.settings.lnbitsEnabled')} ({$_('restartRequired')})"
|
||||||
|
size={$uiSettings.inputSize}
|
||||||
|
/>
|
||||||
|
</Row>
|
||||||
|
{#if $settings.lnbitsEnabled}
|
||||||
|
<SettingsInput
|
||||||
|
id="lnbitsInstance"
|
||||||
|
label={$_('section.settings.lnbitsInstance')}
|
||||||
|
bind:value={$settings.lnbitsInstance}
|
||||||
|
required={true}
|
||||||
|
size={$uiSettings.inputSize}
|
||||||
|
>
|
||||||
|
<InputGroupText>
|
||||||
|
<Input
|
||||||
|
type="checkbox"
|
||||||
|
bind:checked={$settings.lnbitsHttps}
|
||||||
|
bsSize={$uiSettings.inputSize}
|
||||||
|
/>
|
||||||
|
HTTPS
|
||||||
|
</InputGroupText>
|
||||||
|
</SettingsInput>
|
||||||
|
{/if}
|
||||||
</ToggleHeader>
|
</ToggleHeader>
|
||||||
</Row>
|
</Row>
|
||||||
|
|
|
@ -33,8 +33,6 @@
|
||||||
: font.charAt(0).toUpperCase() + font.slice(1),
|
: font.charAt(0).toUpperCase() + font.slice(1),
|
||||||
font
|
font
|
||||||
]);
|
]);
|
||||||
|
|
||||||
let timePerScreen = $settings.timePerScreen;
|
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<Row>
|
<Row>
|
||||||
|
@ -63,8 +61,7 @@
|
||||||
<SettingsInput
|
<SettingsInput
|
||||||
id="timePerScreen"
|
id="timePerScreen"
|
||||||
label={$_('section.settings.timePerScreen')}
|
label={$_('section.settings.timePerScreen')}
|
||||||
bind:value={timePerScreen}
|
bind:value={$settings.timePerScreen}
|
||||||
onInput={(e) => ($settings.timePerScreen = Number(e.target.value))}
|
|
||||||
type="number"
|
type="number"
|
||||||
min={1}
|
min={1}
|
||||||
step={1}
|
step={1}
|
||||||
|
@ -72,6 +69,7 @@
|
||||||
suffix={$_('time.minutes')}
|
suffix={$_('time.minutes')}
|
||||||
size={$uiSettings.inputSize}
|
size={$uiSettings.inputSize}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<SettingsInput
|
<SettingsInput
|
||||||
id="fullRefreshMin"
|
id="fullRefreshMin"
|
||||||
label={$_('section.settings.fullRefreshEvery')}
|
label={$_('section.settings.fullRefreshEvery')}
|
||||||
|
|
|
@ -285,20 +285,6 @@
|
||||||
/>
|
/>
|
||||||
{/if}
|
{/if}
|
||||||
</Row>
|
</Row>
|
||||||
<Row>
|
|
||||||
<SettingsSwitch
|
|
||||||
id="screenRestoreZap"
|
|
||||||
bind:checked={$settings.scrnRestoreZap}
|
|
||||||
label={$_('section.settings.screenRestoreZap', {
|
|
||||||
default: 'Restore previous screen state after zap (Uses {setting} setting)',
|
|
||||||
values: {
|
|
||||||
setting: $_('section.settings.timePerScreen')
|
|
||||||
}
|
|
||||||
})}
|
|
||||||
size={$uiSettings.inputSize}
|
|
||||||
col={{ md: '12', xl: '12', xxl: '12' }}
|
|
||||||
/>
|
|
||||||
</Row>
|
|
||||||
<SettingsInput
|
<SettingsInput
|
||||||
id="nostrZapPubkey"
|
id="nostrZapPubkey"
|
||||||
label={$_('section.settings.nostrZapPubkey')}
|
label={$_('section.settings.nostrZapPubkey')}
|
||||||
|
|
|
@ -5,9 +5,49 @@
|
||||||
import ToggleHeader from '../ToggleHeader.svelte';
|
import ToggleHeader from '../ToggleHeader.svelte';
|
||||||
import { uiSettings } from '$lib/uiSettings';
|
import { uiSettings } from '$lib/uiSettings';
|
||||||
import { DataSourceType } from '$lib/types/dataSource';
|
import { DataSourceType } from '$lib/types/dataSource';
|
||||||
|
import { onMount } from 'svelte';
|
||||||
|
import MultiSelect from 'svelte-multiselect';
|
||||||
export let settings;
|
export let settings;
|
||||||
export let isOpen = false;
|
export let isOpen = false;
|
||||||
|
|
||||||
|
let availableCurrencies: string[] = [];
|
||||||
|
let prevLnbitsEnabled: boolean;
|
||||||
|
|
||||||
|
function updateCurrencies(enabled: boolean) {
|
||||||
|
if (enabled) {
|
||||||
|
fetch(`https://${$settings.lnbitsInstance}/api/v1/currencies`)
|
||||||
|
.then((res) => res.json())
|
||||||
|
.then((data) => {
|
||||||
|
availableCurrencies = data;
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
// Remove any currencies from actCurrencies that aren't in availableCurrencies
|
||||||
|
$settings.actCurrencies = $settings.actCurrencies.filter((curr: string) =>
|
||||||
|
$settings.availableCurrencies.includes(curr)
|
||||||
|
);
|
||||||
|
activeCurrencies = $settings.actCurrencies;
|
||||||
|
availableCurrencies = $settings.availableCurrencies;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
let activeCurrencies: { label: string; value: string }[] = [];
|
||||||
|
|
||||||
|
onMount(() => {
|
||||||
|
prevLnbitsEnabled = $settings.lnbitsEnabled;
|
||||||
|
updateCurrencies($settings.lnbitsEnabled);
|
||||||
|
});
|
||||||
|
|
||||||
|
$: {
|
||||||
|
if (prevLnbitsEnabled !== $settings.lnbitsEnabled) {
|
||||||
|
prevLnbitsEnabled = $settings.lnbitsEnabled;
|
||||||
|
updateCurrencies($settings.lnbitsEnabled);
|
||||||
|
}
|
||||||
|
if (!activeCurrencies.length) {
|
||||||
|
activeCurrencies = $settings.actCurrencies;
|
||||||
|
} else {
|
||||||
|
$settings.actCurrencies = activeCurrencies;
|
||||||
|
}
|
||||||
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<Row>
|
<Row>
|
||||||
|
@ -75,16 +115,6 @@
|
||||||
size={$uiSettings.inputSize}
|
size={$uiSettings.inputSize}
|
||||||
col={{ md: '6', xl: '12', xxl: '6' }}
|
col={{ md: '6', xl: '12', xxl: '6' }}
|
||||||
/>
|
/>
|
||||||
|
|
||||||
{#if !$settings.actCurrencies}
|
|
||||||
<SettingsSwitch
|
|
||||||
id="fetchEurPrice"
|
|
||||||
bind:checked={$settings.fetchEurPrice}
|
|
||||||
label="{$_('section.settings.fetchEuroPrice')} ({$_('restartRequired')})"
|
|
||||||
size={$uiSettings.inputSize}
|
|
||||||
col={{ md: '6', xl: '12', xxl: '6' }}
|
|
||||||
/>
|
|
||||||
{/if}
|
|
||||||
</Row>
|
</Row>
|
||||||
<Row>
|
<Row>
|
||||||
<h5>{$_('section.settings.screens')}</h5>
|
<h5>{$_('section.settings.screens')}</h5>
|
||||||
|
@ -104,22 +134,14 @@
|
||||||
<Row>
|
<Row>
|
||||||
<h5>{$_('section.settings.currencies')}</h5>
|
<h5>{$_('section.settings.currencies')}</h5>
|
||||||
<small>{$_('restartRequired')}</small>
|
<small>{$_('restartRequired')}</small>
|
||||||
{#if $settings.availableCurrencies}
|
<Col>
|
||||||
{#each $settings.availableCurrencies as c}
|
<MultiSelect
|
||||||
<Col md="6" xl="12" xxl="6">
|
options={availableCurrencies}
|
||||||
<div class="form-check form-control-{$uiSettings.inputSize}">
|
bind:value={activeCurrencies}
|
||||||
<input
|
placeholder={$_('section.settings.currencies')}
|
||||||
id="currency_{c}"
|
--sms-options-bg="var(--bs-body-bg, #212529)"
|
||||||
bind:group={$settings.actCurrencies}
|
/>
|
||||||
value={c}
|
</Col>
|
||||||
type="checkbox"
|
|
||||||
class="form-check-input"
|
|
||||||
/>
|
|
||||||
<label class="form-check-label" for="currency_{c}">{c}</label>
|
|
||||||
</div>
|
|
||||||
</Col>
|
|
||||||
{/each}
|
|
||||||
{/if}
|
|
||||||
</Row>
|
</Row>
|
||||||
{/if}
|
{/if}
|
||||||
</ToggleHeader>
|
</ToggleHeader>
|
||||||
|
|
|
@ -73,8 +73,7 @@
|
||||||
"dndStartHour": "Startstunde",
|
"dndStartHour": "Startstunde",
|
||||||
"dndStartMinute": "Startminute",
|
"dndStartMinute": "Startminute",
|
||||||
"dndEndHour": "Endstunde",
|
"dndEndHour": "Endstunde",
|
||||||
"dndEndMinute": "Schlussminute",
|
"dndEndMinute": "Schlussminute"
|
||||||
"screenRestoreZap": "Vorherigen Bildschirmzustand nach Zap wieder herstellen (Verwendet {setting} Einstellung)"
|
|
||||||
},
|
},
|
||||||
"control": {
|
"control": {
|
||||||
"systemInfo": "Systeminfo",
|
"systemInfo": "Systeminfo",
|
||||||
|
@ -89,8 +88,7 @@
|
||||||
"hostname": "Hostname",
|
"hostname": "Hostname",
|
||||||
"frontlight": "Displaybeleuchtung",
|
"frontlight": "Displaybeleuchtung",
|
||||||
"turnOn": "Einschalten",
|
"turnOn": "Einschalten",
|
||||||
"flashFrontlight": "Blinken",
|
"flashFrontlight": "Blinken"
|
||||||
"fwCommitMismatch": "Die Firmware -Version unterscheidet sich von der WebUI -Version, dies kann zu Problemen führen."
|
|
||||||
},
|
},
|
||||||
"status": {
|
"status": {
|
||||||
"title": "Status",
|
"title": "Status",
|
||||||
|
|
|
@ -78,7 +78,7 @@
|
||||||
"dataSource": {
|
"dataSource": {
|
||||||
"label": "Data Source",
|
"label": "Data Source",
|
||||||
"btclock": "BTClock Data Source",
|
"btclock": "BTClock Data Source",
|
||||||
"thirdParty": "mempool.space/Kraken",
|
"thirdParty": "mempool.space/coincap.io",
|
||||||
"nostr": "Nostr publisher",
|
"nostr": "Nostr publisher",
|
||||||
"custom": "Custom Endpoint"
|
"custom": "Custom Endpoint"
|
||||||
},
|
},
|
||||||
|
@ -91,7 +91,8 @@
|
||||||
"dndStartMinute": "Start minute",
|
"dndStartMinute": "Start minute",
|
||||||
"dndEndHour": "End hour",
|
"dndEndHour": "End hour",
|
||||||
"dndEndMinute": "End minute",
|
"dndEndMinute": "End minute",
|
||||||
"screenRestoreZap": "Restore previous screen state after zap (Uses {setting} setting)"
|
"lnbitsEnabled": "LNBits multi-currency integration",
|
||||||
|
"lnbitsInstance": "LNbits instance hostname"
|
||||||
},
|
},
|
||||||
"control": {
|
"control": {
|
||||||
"systemInfo": "System info",
|
"systemInfo": "System info",
|
||||||
|
@ -108,8 +109,7 @@
|
||||||
"turnOn": "Turn on",
|
"turnOn": "Turn on",
|
||||||
"flashFrontlight": "Flash",
|
"flashFrontlight": "Flash",
|
||||||
"firmwareUpdate": "Firmware update",
|
"firmwareUpdate": "Firmware update",
|
||||||
"fwCommit": "Firmware commit",
|
"fwCommit": "Firmware commit"
|
||||||
"fwCommitMismatch": "The firmware version is different from the WebUI version, this might cause problems. "
|
|
||||||
},
|
},
|
||||||
"status": {
|
"status": {
|
||||||
"title": "Status",
|
"title": "Status",
|
||||||
|
|
|
@ -47,7 +47,7 @@
|
||||||
"section": {
|
"section": {
|
||||||
"displaysAndLed": "Pantallas y LED",
|
"displaysAndLed": "Pantallas y LED",
|
||||||
"screenSettings": "Específico de la pantalla",
|
"screenSettings": "Específico de la pantalla",
|
||||||
"dataSource": "Fuente de datos",
|
"dataSource": "fuente de datos",
|
||||||
"extraFeatures": "Funciones adicionales",
|
"extraFeatures": "Funciones adicionales",
|
||||||
"system": "Sistema"
|
"system": "Sistema"
|
||||||
},
|
},
|
||||||
|
@ -72,8 +72,7 @@
|
||||||
"dndStartHour": "Hora de inicio",
|
"dndStartHour": "Hora de inicio",
|
||||||
"dndStartMinute": "Minuto de inicio",
|
"dndStartMinute": "Minuto de inicio",
|
||||||
"dndEndHour": "Hora final",
|
"dndEndHour": "Hora final",
|
||||||
"dndEndMinute": "Minuto final",
|
"dndEndMinute": "Minuto final"
|
||||||
"screenRestoreZap": "Restaurar el estado de pantalla anterior después de Zap (Usa la configuración {setting})"
|
|
||||||
},
|
},
|
||||||
"control": {
|
"control": {
|
||||||
"turnOff": "Apagar",
|
"turnOff": "Apagar",
|
||||||
|
@ -88,8 +87,7 @@
|
||||||
"hostname": "Nombre del host",
|
"hostname": "Nombre del host",
|
||||||
"turnOn": "Encender",
|
"turnOn": "Encender",
|
||||||
"frontlight": "Luz de la pantalla",
|
"frontlight": "Luz de la pantalla",
|
||||||
"flashFrontlight": "Luz intermitente",
|
"flashFrontlight": "Luz intermitente"
|
||||||
"fwCommitMismatch": "La versión de firmware es diferente de la versión WebUI, esto podría causar problemas."
|
|
||||||
},
|
},
|
||||||
"status": {
|
"status": {
|
||||||
"memoryFree": "Memoria RAM libre",
|
"memoryFree": "Memoria RAM libre",
|
||||||
|
|
|
@ -64,8 +64,7 @@
|
||||||
"dndStartHour": "Begin uur",
|
"dndStartHour": "Begin uur",
|
||||||
"dndStartMinute": "Beginminuut",
|
"dndStartMinute": "Beginminuut",
|
||||||
"dndEndHour": "Eind uur",
|
"dndEndHour": "Eind uur",
|
||||||
"dndEndMinute": "Einde minuut",
|
"dndEndMinute": "Einde minuut"
|
||||||
"screenRestoreZap": "Herstel vorige schermstatus na zap (Gebruikt {setting} instelling)"
|
|
||||||
},
|
},
|
||||||
"control": {
|
"control": {
|
||||||
"systemInfo": "Systeeminformatie",
|
"systemInfo": "Systeeminformatie",
|
||||||
|
@ -79,8 +78,7 @@
|
||||||
"title": "Besturing",
|
"title": "Besturing",
|
||||||
"frontlight": "Displaylicht",
|
"frontlight": "Displaylicht",
|
||||||
"turnOn": "Aanzetten",
|
"turnOn": "Aanzetten",
|
||||||
"flashFrontlight": "Knipper",
|
"flashFrontlight": "Knipper"
|
||||||
"fwCommitMismatch": "De firmwareversie verschilt van de WebUI -versie, dit kan problemen veroorzaken."
|
|
||||||
},
|
},
|
||||||
"status": {
|
"status": {
|
||||||
"title": "Status",
|
"title": "Status",
|
||||||
|
|
|
@ -13,8 +13,9 @@
|
||||||
import { uiSettings } from '$lib/uiSettings';
|
import { uiSettings } from '$lib/uiSettings';
|
||||||
|
|
||||||
let settings = writable({
|
let settings = writable({
|
||||||
isLoaded: false,
|
fgColor: '0',
|
||||||
timePerScreen: 0
|
bgColor: '0',
|
||||||
|
isLoaded: false
|
||||||
});
|
});
|
||||||
|
|
||||||
let status = writable({
|
let status = writable({
|
||||||
|
|
|
@ -13,8 +13,7 @@
|
||||||
Form,
|
Form,
|
||||||
Input,
|
Input,
|
||||||
Label,
|
Label,
|
||||||
Row,
|
Row
|
||||||
Alert
|
|
||||||
} from '@sveltestrap/sveltestrap';
|
} from '@sveltestrap/sveltestrap';
|
||||||
import FirmwareUpdater from './FirmwareUpdater.svelte';
|
import FirmwareUpdater from './FirmwareUpdater.svelte';
|
||||||
import { uiSettings } from '$lib/uiSettings';
|
import { uiSettings } from '$lib/uiSettings';
|
||||||
|
@ -227,11 +226,6 @@
|
||||||
<li>WebUI commit: <Placeholder value={$settings.fsRev} /></li>
|
<li>WebUI commit: <Placeholder value={$settings.fsRev} /></li>
|
||||||
<li>{$_('section.control.hostname')}: <Placeholder value={$settings.hostname} /></li>
|
<li>{$_('section.control.hostname')}: <Placeholder value={$settings.hostname} /></li>
|
||||||
</ul>
|
</ul>
|
||||||
{#if $settings.gitRev != $settings.fsRev}
|
|
||||||
<Alert color="warning">
|
|
||||||
⚠️ <strong>{$_('warning')}</strong>: {$_('section.control.fwCommitMismatch')}
|
|
||||||
</Alert>
|
|
||||||
{/if}
|
|
||||||
<Row>
|
<Row>
|
||||||
<Col class="d-flex justify-content-end">
|
<Col class="d-flex justify-content-end">
|
||||||
<Button color="danger" id="restartBtn" on:click={restartClock}
|
<Button color="danger" id="restartBtn" on:click={restartClock}
|
||||||
|
|
|
@ -306,9 +306,6 @@
|
||||||
</span>
|
</span>
|
||||||
{/if}
|
{/if}
|
||||||
{/if}
|
{/if}
|
||||||
{#if $settings.fetchEurPrice}
|
|
||||||
<small>{$_('section.status.fetchEuroNote')}</small>
|
|
||||||
{/if}
|
|
||||||
</p>
|
</p>
|
||||||
{/if}
|
{/if}
|
||||||
</CardBody>
|
</CardBody>
|
||||||
|
|
|
@ -343,10 +343,6 @@
|
||||||
"Settings": {
|
"Settings": {
|
||||||
"type": "object",
|
"type": "object",
|
||||||
"properties": {
|
"properties": {
|
||||||
"fetchEurPrice": {
|
|
||||||
"type": "boolean",
|
|
||||||
"description": "Fetch EUR price instead of USD"
|
|
||||||
},
|
|
||||||
"fgColor": {
|
"fgColor": {
|
||||||
"type": "string",
|
"type": "string",
|
||||||
"default": 16777215,
|
"default": 16777215,
|
||||||
|
|
|
@ -232,9 +232,6 @@ components:
|
||||||
Settings:
|
Settings:
|
||||||
type: object
|
type: object
|
||||||
properties:
|
properties:
|
||||||
fetchEurPrice:
|
|
||||||
type: boolean
|
|
||||||
description: Fetch EUR price instead of USD
|
|
||||||
fgColor:
|
fgColor:
|
||||||
type: string
|
type: string
|
||||||
default: 16777215
|
default: 16777215
|
||||||
|
|
|
@ -73,28 +73,6 @@ test('time values can not be zero or negative', async ({ page }) => {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
test('info message when fetch eur price is enabled', async ({ page }) => {
|
|
||||||
delete (settingsJson as { actCurrencies?: string[] }).actCurrencies;
|
|
||||||
|
|
||||||
await page.goto('/');
|
|
||||||
await page.getByRole('button', { name: 'Show all' }).click();
|
|
||||||
|
|
||||||
const inputField = 'input#fetchEurPrice';
|
|
||||||
const switchElement = await page.locator(inputField);
|
|
||||||
|
|
||||||
expect(switchElement).toBeTruthy();
|
|
||||||
const isSwitchEnabled = await switchElement.isChecked();
|
|
||||||
expect(isSwitchEnabled).toBe(false);
|
|
||||||
|
|
||||||
await expect(page.getByText('the WS Price connection will show')).toBeHidden();
|
|
||||||
|
|
||||||
await switchElement.click();
|
|
||||||
const isSwitchNowEnabled = await switchElement.isChecked();
|
|
||||||
expect(isSwitchNowEnabled).toBe(true);
|
|
||||||
|
|
||||||
await expect(page.getByText('the WS Price connection will show')).toBeVisible();
|
|
||||||
});
|
|
||||||
|
|
||||||
test('npub values will be converted to hex pubkeys', async ({ page }) => {
|
test('npub values will be converted to hex pubkeys', async ({ page }) => {
|
||||||
await page.goto('/');
|
await page.goto('/');
|
||||||
await page.getByRole('button', { name: 'Show all' }).click();
|
await page.getByRole('button', { name: 'Show all' }).click();
|
||||||
|
|
|
@ -84,7 +84,6 @@ export const settingsJson = {
|
||||||
mcapBigChar: true,
|
mcapBigChar: true,
|
||||||
mdnsEnabled: true,
|
mdnsEnabled: true,
|
||||||
otaEnabled: true,
|
otaEnabled: true,
|
||||||
fetchEurPrice: false,
|
|
||||||
hostnamePrefix: 'btclock',
|
hostnamePrefix: 'btclock',
|
||||||
hostname: 'btclock-d60b14',
|
hostname: 'btclock-d60b14',
|
||||||
ip: '192.168.20.231',
|
ip: '192.168.20.231',
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue