Add nostr settings

This commit is contained in:
Djuri 2024-07-11 17:34:12 +02:00
parent 2363d98965
commit 2ed559aa84
5 changed files with 177 additions and 2 deletions

View file

@ -1,4 +1,5 @@
<script lang="ts">
import { isValidNpub, isValidNostrRelay } from '$lib';
import { PUBLIC_BASE_URL } from '$lib/config';
import { uiSettings } from '$lib/uiSettings';
import { createEventDispatcher } from 'svelte';
@ -78,6 +79,11 @@
});
};
let validNostrRelay = false;
const testNostrRelay = async () => {
validNostrRelay = await isValidNostrRelay($settings.nostrRelay);
};
const onFlBrightnessChange = async () => {
await fetch(`${PUBLIC_BASE_URL}/api/frontlight/brightness/${$settings.flMaxBrightness}`, {
method: 'GET',
@ -273,6 +279,43 @@
</Col>
</Row>
{/if}
{#if $settings.nostrPubKey}
<Row>
<Label md={6} for="nostrPubKey" size={$uiSettings.inputSize}
>{$_('section.settings.nostrPubKey')}</Label
>
<Col md="6">
<Input
type="text"
bind:value={$settings.nostrPubKey}
name="nostrPubKey"
id="nostrPubKey"
invalid={!isValidNpub($settings.nostrPubKey)}
bsSize={$uiSettings.inputSize}
></Input>
</Col>
</Row>
<Row>
<Label md={6} for="nostrRelay" size={$uiSettings.inputSize}
>{$_('section.settings.nostrRelay')}</Label
>
<Col md="6">
<InputGroup size={$uiSettings.inputSize}>
<Input
type="text"
bind:value={$settings.nostrRelay}
name="nostrRelay"
id="nostrRelay"
valid={validNostrRelay}
bsSize={$uiSettings.inputSize}
></Input>
<Button type="button" color="success" on:click={testNostrRelay}
>{$_('test', { default: 'Test' })}</Button
>
</InputGroup>
</Col>
</Row>
{/if}
<Row>
<Label md={6} for="mempoolInstance" size="sm"
>{$_('section.settings.mempoolnstance')}</Label