forked from btclock/webui
Add more Nostr settings
This commit is contained in:
parent
2ed559aa84
commit
ee4d6d88c7
7 changed files with 68 additions and 9 deletions
|
@ -1,5 +1,5 @@
|
|||
<script lang="ts">
|
||||
import { isValidNpub, isValidNostrRelay } from '$lib';
|
||||
import { isValidNostrRelay, getPubKey, isValidHexPubKey } from '$lib';
|
||||
import { PUBLIC_BASE_URL } from '$lib/config';
|
||||
import { uiSettings } from '$lib/uiSettings';
|
||||
import { createEventDispatcher } from 'svelte';
|
||||
|
@ -84,6 +84,10 @@
|
|||
validNostrRelay = await isValidNostrRelay($settings.nostrRelay);
|
||||
};
|
||||
|
||||
const checkValidNostrPubkey = () => {
|
||||
$settings.nostrPubKey = getPubKey($settings.nostrPubKey);
|
||||
};
|
||||
|
||||
const onFlBrightnessChange = async () => {
|
||||
await fetch(`${PUBLIC_BASE_URL}/api/frontlight/brightness/${$settings.flMaxBrightness}`, {
|
||||
method: 'GET',
|
||||
|
@ -279,7 +283,7 @@
|
|||
</Col>
|
||||
</Row>
|
||||
{/if}
|
||||
{#if $settings.nostrPubKey}
|
||||
{#if $settings.useNostr}
|
||||
<Row>
|
||||
<Label md={6} for="nostrPubKey" size={$uiSettings.inputSize}
|
||||
>{$_('section.settings.nostrPubKey')}</Label
|
||||
|
@ -290,7 +294,8 @@
|
|||
bind:value={$settings.nostrPubKey}
|
||||
name="nostrPubKey"
|
||||
id="nostrPubKey"
|
||||
invalid={!isValidNpub($settings.nostrPubKey)}
|
||||
on:change={checkValidNostrPubkey}
|
||||
invalid={!isValidHexPubKey($settings.nostrPubKey)}
|
||||
bsSize={$uiSettings.inputSize}
|
||||
></Input>
|
||||
</Col>
|
||||
|
@ -504,6 +509,17 @@
|
|||
label="{$_('section.settings.ownDataSource')} ({$_('restartRequired')})"
|
||||
/>
|
||||
</Col>
|
||||
{#if $settings.nostrRelay}
|
||||
<Col md="6">
|
||||
<Input
|
||||
id="useNostr"
|
||||
bind:checked={$settings.useNostr}
|
||||
type="switch"
|
||||
bsSize={$uiSettings.inputSize}
|
||||
label="{$_('section.settings.useNostr')} ({$_('restartRequired')})"
|
||||
/>
|
||||
</Col>
|
||||
{/if}
|
||||
{#if $settings.hasFrontlight}
|
||||
<Col md="6">
|
||||
<Input
|
||||
|
|
|
@ -165,7 +165,9 @@
|
|||
{$_('section.status.uptime')}: {toUptimestring($status.espUptime)}
|
||||
<br />
|
||||
<p>
|
||||
{#if !$settings.ownDataSource}
|
||||
{#if $settings.useNostr}
|
||||
<span>Nostr connection status not available yet.</span>
|
||||
{:else if !$settings.ownDataSource}
|
||||
{$_('section.status.wsPriceConnection')}:
|
||||
<span>
|
||||
{#if $status.connectionStatus && $status.connectionStatus.price}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue