2023-11-17 00:05:35 +00:00
|
|
|
<script lang="ts">
|
2024-08-31 17:54:43 +00:00
|
|
|
import { isValidNostrRelay, getPubKey, isValidHexPubKey, isValidNpub } from '$lib';
|
2023-11-30 20:53:37 +00:00
|
|
|
import { PUBLIC_BASE_URL } from '$lib/config';
|
2024-06-08 22:23:39 +00:00
|
|
|
import { uiSettings } from '$lib/uiSettings';
|
2023-11-21 20:22:29 +00:00
|
|
|
import { createEventDispatcher } from 'svelte';
|
2023-11-17 00:05:35 +00:00
|
|
|
|
|
|
|
import { _ } from 'svelte-i18n';
|
|
|
|
import {
|
2023-11-19 19:27:22 +00:00
|
|
|
Button,
|
2023-11-17 00:05:35 +00:00
|
|
|
Card,
|
|
|
|
CardBody,
|
2023-11-19 19:27:22 +00:00
|
|
|
CardHeader,
|
|
|
|
CardTitle,
|
|
|
|
Col,
|
2023-11-17 00:05:35 +00:00
|
|
|
Form,
|
|
|
|
FormText,
|
|
|
|
Input,
|
|
|
|
InputGroup,
|
|
|
|
InputGroupText,
|
2023-11-19 19:27:22 +00:00
|
|
|
Label,
|
|
|
|
Row
|
2023-11-17 00:05:35 +00:00
|
|
|
} from 'sveltestrap';
|
|
|
|
|
|
|
|
export let settings;
|
2023-11-17 02:15:23 +00:00
|
|
|
|
2023-11-21 15:05:00 +00:00
|
|
|
const wifiTxPowerMap = new Map<string, number>([
|
|
|
|
['Default', 80],
|
|
|
|
['19.5dBm', 78], // 19.5dBm
|
|
|
|
['19dBm', 76], // 19dBm
|
|
|
|
['18.5dBm', 74], // 18.5dBm
|
|
|
|
['17dBm', 68], // 17dBm
|
|
|
|
['15dBm', 60], // 15dBm
|
|
|
|
['13dBm', 52], // 13dBm
|
|
|
|
['11dBm', 44], // 11dBm
|
|
|
|
['8.5dBm', 34], // 8.5dBm
|
|
|
|
['7dBm', 28], // 7dBm
|
|
|
|
['5dBm', 20] // 5dBm
|
|
|
|
]);
|
|
|
|
|
2023-11-21 20:22:29 +00:00
|
|
|
const dispatch = createEventDispatcher();
|
|
|
|
|
2023-11-24 23:42:37 +00:00
|
|
|
const handleReset = (e: Event) => {
|
|
|
|
e.preventDefault();
|
|
|
|
dispatch('formReset');
|
|
|
|
};
|
|
|
|
|
2024-06-24 11:58:01 +00:00
|
|
|
const getTzOffsetFromSystem = () => {
|
|
|
|
const dt = new Date();
|
|
|
|
let diffTZ = dt.getTimezoneOffset();
|
|
|
|
$settings.tzOffset = diffTZ * -1;
|
|
|
|
};
|
|
|
|
|
2023-11-19 19:27:22 +00:00
|
|
|
const onSave = async (e: Event) => {
|
|
|
|
e.preventDefault();
|
2024-08-31 17:54:43 +00:00
|
|
|
|
|
|
|
// const form = e.target as HTMLFormElement;
|
|
|
|
// const formData = new FormData(form);
|
|
|
|
|
2023-11-19 19:27:22 +00:00
|
|
|
let formSettings = $settings;
|
2023-11-17 02:15:23 +00:00
|
|
|
|
2023-11-19 19:27:22 +00:00
|
|
|
delete formSettings['gitRev'];
|
|
|
|
delete formSettings['ip'];
|
|
|
|
delete formSettings['lastBuildTime'];
|
2023-11-17 02:15:23 +00:00
|
|
|
|
2023-11-19 19:27:22 +00:00
|
|
|
await fetch(`${PUBLIC_BASE_URL}/api/json/settings`, {
|
2023-11-17 02:15:23 +00:00
|
|
|
method: 'PATCH',
|
2023-11-19 19:27:22 +00:00
|
|
|
headers: {
|
|
|
|
'Content-Type': 'application/json'
|
|
|
|
},
|
2023-11-17 02:15:23 +00:00
|
|
|
body: JSON.stringify(formSettings)
|
2023-11-21 20:22:29 +00:00
|
|
|
})
|
|
|
|
.then(() => {
|
|
|
|
dispatch('showToast', {
|
|
|
|
color: 'success',
|
|
|
|
text: $_('section.settings.settingsSaved')
|
|
|
|
});
|
|
|
|
})
|
|
|
|
.catch(() => {
|
|
|
|
dispatch('showToast', {
|
|
|
|
color: 'danger',
|
|
|
|
text: $_('section.settings.errorSavingSettings')
|
|
|
|
});
|
|
|
|
});
|
2023-11-19 19:27:22 +00:00
|
|
|
};
|
2024-06-07 22:39:44 +00:00
|
|
|
|
2024-07-11 15:34:12 +00:00
|
|
|
let validNostrRelay = false;
|
|
|
|
const testNostrRelay = async () => {
|
|
|
|
validNostrRelay = await isValidNostrRelay($settings.nostrRelay);
|
|
|
|
};
|
|
|
|
|
2024-08-31 17:54:43 +00:00
|
|
|
let validBitaxe = false;
|
|
|
|
const testBitaxe = async () => {
|
|
|
|
try {
|
|
|
|
const response = await fetch(`http://${$settings.bitaxeHostname}/api/system/info`);
|
|
|
|
|
|
|
|
if (!response.ok) {
|
|
|
|
dispatch('showToast', {
|
|
|
|
color: 'danger',
|
|
|
|
text: `Failed to connect to BitAxe HTTP error! status: ${response.status}`
|
|
|
|
});
|
|
|
|
validBitaxe = false;
|
|
|
|
throw new Error();
|
|
|
|
}
|
|
|
|
|
|
|
|
const systemInfo = await response.json();
|
|
|
|
dispatch('showToast', {
|
|
|
|
color: 'success',
|
|
|
|
text: `Connected to BitAxe ${systemInfo.ASICModel} (Board version ${systemInfo.boardVersion}) running firmware ${systemInfo.version}.\r\nCurrent hashrate ${Math.round(systemInfo.hashRate)} GH/s`
|
|
|
|
});
|
|
|
|
validBitaxe = true;
|
|
|
|
} catch (error) {
|
|
|
|
if (error instanceof TypeError && error.message.includes('Failed to fetch')) {
|
|
|
|
dispatch('showToast', {
|
|
|
|
color: 'danger',
|
|
|
|
text: `Failed to connect to BitAxe, make sure you are connected to the same network.`
|
|
|
|
});
|
|
|
|
}
|
|
|
|
console.error('Failed to fetch Bitaxe system info:', error);
|
|
|
|
validBitaxe = false;
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
const checkValidNostrPubkey = (key) => {
|
|
|
|
if (isValidNpub($settings[key])) {
|
|
|
|
dispatch('showToast', {
|
|
|
|
color: 'info',
|
|
|
|
text: $_('section.settings.convertingValidNpub')
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
let ret = getPubKey($settings[key]);
|
|
|
|
|
|
|
|
if (ret) $settings[key] = ret;
|
2024-07-11 19:48:50 +00:00
|
|
|
};
|
|
|
|
|
2024-06-07 22:39:44 +00:00
|
|
|
const onFlBrightnessChange = async () => {
|
|
|
|
await fetch(`${PUBLIC_BASE_URL}/api/frontlight/brightness/${$settings.flMaxBrightness}`, {
|
|
|
|
method: 'GET',
|
|
|
|
headers: {
|
|
|
|
'Content-Type': 'application/json'
|
|
|
|
}
|
|
|
|
});
|
|
|
|
};
|
2024-08-31 15:10:26 +00:00
|
|
|
|
|
|
|
// You can also add more props if needed
|
|
|
|
export let xs = 12;
|
|
|
|
export let sm = xs;
|
|
|
|
export let md = sm;
|
|
|
|
export let lg = md;
|
|
|
|
export let xl = lg;
|
|
|
|
export let xxl = xl;
|
2023-11-17 00:05:35 +00:00
|
|
|
</script>
|
|
|
|
|
2024-08-31 15:10:26 +00:00
|
|
|
<Col {xs} {sm} {md} {lg} {xl} {xxl}>
|
2023-11-17 00:05:35 +00:00
|
|
|
<Card>
|
|
|
|
<CardHeader>
|
2023-11-17 02:15:23 +00:00
|
|
|
<CardTitle>{$_('section.settings.title', { default: 'Settings' })}</CardTitle>
|
2023-11-17 00:05:35 +00:00
|
|
|
</CardHeader>
|
|
|
|
<CardBody>
|
2023-11-17 02:15:23 +00:00
|
|
|
<Form on:submit={onSave}>
|
2023-11-17 00:05:35 +00:00
|
|
|
<Row>
|
2024-06-08 22:11:27 +00:00
|
|
|
<Label md={6} for="fgColor" size={$uiSettings.inputSize}
|
2023-11-19 19:27:22 +00:00
|
|
|
>{$_('section.settings.textColor', { default: 'Text color' })}</Label
|
|
|
|
>
|
2023-11-17 00:05:35 +00:00
|
|
|
<Col md="6">
|
|
|
|
<Input
|
|
|
|
type="select"
|
2023-11-17 02:15:23 +00:00
|
|
|
bind:value={$settings.fgColor}
|
2023-11-17 00:05:35 +00:00
|
|
|
name="select"
|
|
|
|
id="fgColor"
|
2024-06-08 22:11:27 +00:00
|
|
|
bsSize={$uiSettings.inputSize}
|
|
|
|
class={$uiSettings.selectClass}
|
2023-11-17 00:05:35 +00:00
|
|
|
>
|
2023-11-19 19:27:22 +00:00
|
|
|
<option value="0">{$_('colors.black')}</option>
|
|
|
|
<option value="65535">{$_('colors.white')}</option>
|
2023-11-17 00:05:35 +00:00
|
|
|
</Input>
|
|
|
|
</Col>
|
|
|
|
</Row>
|
|
|
|
<Row>
|
2024-06-08 22:11:27 +00:00
|
|
|
<Label md={6} for="bgColor" size={$uiSettings.inputSize}
|
|
|
|
>{$_('section.settings.backgroundColor')}</Label
|
|
|
|
>
|
2023-11-17 00:05:35 +00:00
|
|
|
<Col md="6">
|
|
|
|
<Input
|
|
|
|
type="select"
|
|
|
|
bind:value={$settings.bgColor}
|
|
|
|
name="select"
|
|
|
|
id="bgColor"
|
2024-06-08 22:11:27 +00:00
|
|
|
bsSize={$uiSettings.inputSize}
|
|
|
|
class={$uiSettings.selectClass}
|
2023-11-17 00:05:35 +00:00
|
|
|
>
|
2023-11-19 19:27:22 +00:00
|
|
|
<option value="0">{$_('colors.black')}</option>
|
|
|
|
<option value="65535">{$_('colors.white')}</option>
|
2023-11-17 00:05:35 +00:00
|
|
|
</Input>
|
|
|
|
</Col>
|
|
|
|
</Row>
|
|
|
|
<Row>
|
2024-06-08 22:11:27 +00:00
|
|
|
<Label md={6} for="timePerScreen" size={$uiSettings.inputSize}
|
|
|
|
>{$_('section.settings.timePerScreen')}</Label
|
|
|
|
>
|
2023-11-17 00:05:35 +00:00
|
|
|
<Col md="6">
|
2024-06-08 22:11:27 +00:00
|
|
|
<InputGroup size={$uiSettings.inputSize}>
|
2023-11-24 23:42:37 +00:00
|
|
|
<Input
|
|
|
|
type="number"
|
|
|
|
id="timePerScreen"
|
|
|
|
min={1}
|
|
|
|
step="1"
|
2024-08-31 17:54:43 +00:00
|
|
|
required
|
2023-11-24 23:42:37 +00:00
|
|
|
bind:value={$settings.timePerScreen}
|
|
|
|
/>
|
2023-11-19 19:27:22 +00:00
|
|
|
<InputGroupText>{$_('time.minutes')}</InputGroupText>
|
2023-11-17 00:05:35 +00:00
|
|
|
</InputGroup>
|
|
|
|
</Col>
|
|
|
|
</Row>
|
|
|
|
<Row>
|
2024-06-08 22:11:27 +00:00
|
|
|
<Label md={6} for="fullRefreshMin" size={$uiSettings.inputSize}
|
2023-11-19 19:27:22 +00:00
|
|
|
>{$_('section.settings.fullRefreshEvery')}</Label
|
|
|
|
>
|
2023-11-17 00:05:35 +00:00
|
|
|
<Col md="6">
|
2024-06-08 22:11:27 +00:00
|
|
|
<InputGroup size={$uiSettings.inputSize}>
|
2023-11-24 23:42:37 +00:00
|
|
|
<Input
|
|
|
|
type="number"
|
|
|
|
id="fullRefreshMin"
|
|
|
|
min={1}
|
|
|
|
step="1"
|
2024-08-31 17:54:43 +00:00
|
|
|
required
|
2023-11-24 23:42:37 +00:00
|
|
|
bind:value={$settings.fullRefreshMin}
|
|
|
|
/>
|
2023-11-19 19:27:22 +00:00
|
|
|
<InputGroupText>{$_('time.minutes')}</InputGroupText>
|
2023-11-17 00:05:35 +00:00
|
|
|
</InputGroup>
|
|
|
|
</Col>
|
|
|
|
</Row>
|
|
|
|
<Row>
|
2024-06-08 22:11:27 +00:00
|
|
|
<Label md={6} for="minSecPriceUpd" size={$uiSettings.inputSize}
|
2023-11-19 19:27:22 +00:00
|
|
|
>{$_('section.settings.timeBetweenPriceUpdates')}</Label
|
|
|
|
>
|
2023-11-17 00:05:35 +00:00
|
|
|
<Col md="6">
|
2024-06-08 22:11:27 +00:00
|
|
|
<InputGroup size={$uiSettings.inputSize}>
|
2023-11-24 23:42:37 +00:00
|
|
|
<Input
|
|
|
|
type="number"
|
|
|
|
id="minSecPriceUpd"
|
|
|
|
min={1}
|
|
|
|
step="1"
|
|
|
|
bind:value={$settings.minSecPriceUpd}
|
|
|
|
/>
|
2023-11-19 19:27:22 +00:00
|
|
|
<InputGroupText>{$_('time.seconds')}</InputGroupText>
|
2023-11-17 00:05:35 +00:00
|
|
|
</InputGroup>
|
2023-11-19 19:27:22 +00:00
|
|
|
<FormText>{$_('section.settings.shortAmountsWarning')}</FormText>
|
2023-11-17 00:05:35 +00:00
|
|
|
</Col>
|
|
|
|
</Row>
|
|
|
|
<Row>
|
2024-06-08 22:11:27 +00:00
|
|
|
<Label md={6} for="tzOffset" size={$uiSettings.inputSize}
|
|
|
|
>{$_('section.settings.timezoneOffset')}</Label
|
|
|
|
>
|
2023-11-17 00:05:35 +00:00
|
|
|
<Col md="6">
|
2024-06-08 22:11:27 +00:00
|
|
|
<InputGroup size={$uiSettings.inputSize}>
|
2023-11-17 00:05:35 +00:00
|
|
|
<Input
|
|
|
|
type="number"
|
|
|
|
step="1"
|
|
|
|
name="tzOffset"
|
|
|
|
id="tzOffset"
|
2024-08-31 17:54:43 +00:00
|
|
|
required
|
2023-11-17 00:05:35 +00:00
|
|
|
bind:value={$settings.tzOffset}
|
|
|
|
/>
|
2023-11-19 19:27:22 +00:00
|
|
|
<InputGroupText>{$_('time.minutes')}</InputGroupText>
|
2024-06-24 11:58:01 +00:00
|
|
|
<Button type="button" color="info" on:click={getTzOffsetFromSystem}
|
|
|
|
>{$_('auto-detect')}</Button
|
|
|
|
>
|
2023-11-17 00:05:35 +00:00
|
|
|
</InputGroup>
|
2023-11-19 19:27:22 +00:00
|
|
|
<FormText>{$_('section.settings.tzOffsetHelpText')}</FormText>
|
2023-11-17 00:05:35 +00:00
|
|
|
</Col>
|
|
|
|
</Row>
|
|
|
|
<Row>
|
2024-06-08 22:11:27 +00:00
|
|
|
<Label md={6} for="ledBrightness" size={$uiSettings.inputSize}
|
|
|
|
>{$_('section.settings.ledBrightness')}</Label
|
|
|
|
>
|
2023-11-17 00:05:35 +00:00
|
|
|
<Col md="6">
|
|
|
|
<Input
|
|
|
|
type="range"
|
|
|
|
name="ledBrightness"
|
|
|
|
id="ledBrightness"
|
2023-11-19 19:27:22 +00:00
|
|
|
bind:value={$settings.ledBrightness}
|
2023-11-17 00:05:35 +00:00
|
|
|
min={0}
|
|
|
|
max={255}
|
|
|
|
step={1}
|
|
|
|
/>
|
|
|
|
</Col>
|
|
|
|
</Row>
|
2024-05-08 21:38:56 +00:00
|
|
|
{#if $settings.hasFrontlight}
|
|
|
|
<Row>
|
2024-06-08 22:11:27 +00:00
|
|
|
<Label md={6} for="flMaxBrightness" size={$uiSettings.inputSize}
|
2024-05-08 21:38:56 +00:00
|
|
|
>{$_('section.settings.flMaxBrightness')}</Label
|
|
|
|
>
|
|
|
|
<Col md="6">
|
|
|
|
<Input
|
|
|
|
type="range"
|
|
|
|
name="flMaxBrightness"
|
|
|
|
id="flMaxBrightness"
|
|
|
|
bind:value={$settings.flMaxBrightness}
|
2024-06-07 22:39:44 +00:00
|
|
|
on:change={onFlBrightnessChange}
|
2024-05-08 21:38:56 +00:00
|
|
|
min={0}
|
|
|
|
max={4095}
|
|
|
|
step={1}
|
|
|
|
/>
|
|
|
|
</Col>
|
|
|
|
</Row>
|
2024-06-07 22:39:44 +00:00
|
|
|
<Row>
|
2024-06-08 22:11:27 +00:00
|
|
|
<Label md={6} for="flEffectDelay" size={$uiSettings.inputSize}
|
2024-06-07 22:39:44 +00:00
|
|
|
>{$_('section.settings.flEffectDelay')}</Label
|
|
|
|
>
|
|
|
|
<Col md="6">
|
|
|
|
<Input
|
|
|
|
type="range"
|
|
|
|
name="flEffectDelay"
|
|
|
|
id="flEffectDelay"
|
|
|
|
bind:value={$settings.flEffectDelay}
|
|
|
|
min={5}
|
|
|
|
max={300}
|
|
|
|
step={1}
|
|
|
|
/>
|
|
|
|
</Col>
|
|
|
|
</Row>
|
2024-05-08 21:38:56 +00:00
|
|
|
{/if}
|
2024-06-29 00:12:29 +00:00
|
|
|
{#if $settings.hasLightLevel}
|
|
|
|
<Row>
|
|
|
|
<Label md={6} for="luxLightToggle" size={$uiSettings.inputSize}
|
|
|
|
>{$_('section.settings.luxLightToggle')} ({$settings.luxLightToggle})</Label
|
|
|
|
>
|
|
|
|
<Col md="6">
|
|
|
|
<Input
|
|
|
|
type="range"
|
|
|
|
name="luxLightToggle"
|
|
|
|
id="luxLightToggle"
|
|
|
|
bind:value={$settings.luxLightToggle}
|
|
|
|
min={0}
|
|
|
|
max={1000}
|
|
|
|
step={1}
|
|
|
|
/>
|
|
|
|
</Col>
|
|
|
|
</Row>
|
|
|
|
{/if}
|
2024-07-29 18:10:26 +00:00
|
|
|
{#if $settings.bitaxeEnabled}
|
|
|
|
<Row>
|
|
|
|
<Label md={6} for="bitaxeHostname" size={$uiSettings.inputSize}
|
|
|
|
>{$_('section.settings.bitaxeHostname')}</Label
|
|
|
|
>
|
|
|
|
<Col md="6">
|
2024-08-31 17:54:43 +00:00
|
|
|
<InputGroup size={$uiSettings.inputSize}>
|
|
|
|
<Input
|
|
|
|
type="text"
|
|
|
|
bind:value={$settings.bitaxeHostname}
|
|
|
|
name="bitaxeHostname"
|
|
|
|
valid={validBitaxe}
|
|
|
|
id="bitaxeHostname"
|
|
|
|
required
|
|
|
|
></Input>
|
|
|
|
<Button type="button" color="success" on:click={testBitaxe}
|
|
|
|
>{$_('test', { default: 'Test' })}</Button
|
|
|
|
>
|
|
|
|
</InputGroup>
|
2024-07-29 18:10:26 +00:00
|
|
|
</Col>
|
|
|
|
</Row>
|
|
|
|
{/if}
|
2024-08-31 17:54:43 +00:00
|
|
|
{#if 'nostrZapNotify' in $settings && $settings['nostrZapNotify']}
|
2024-08-24 13:02:49 +00:00
|
|
|
<Row>
|
|
|
|
<Label md={6} for="nostrZapPubkey" size={$uiSettings.inputSize}
|
|
|
|
>{$_('section.settings.nostrZapPubkey')}</Label
|
|
|
|
>
|
|
|
|
<Col md="6">
|
|
|
|
<Input
|
|
|
|
type="text"
|
|
|
|
bind:value={$settings.nostrZapPubkey}
|
|
|
|
name="nostrZapPubkey"
|
|
|
|
id="nostrZapPubkey"
|
2024-08-31 17:54:43 +00:00
|
|
|
on:change={() => checkValidNostrPubkey('nostrZapPubkey')}
|
2024-08-24 13:02:49 +00:00
|
|
|
invalid={!isValidHexPubKey($settings.nostrZapPubkey)}
|
|
|
|
bsSize={$uiSettings.inputSize}
|
2024-08-31 17:54:43 +00:00
|
|
|
required
|
|
|
|
minlength="64"
|
2024-08-24 13:02:49 +00:00
|
|
|
></Input>
|
2024-08-31 17:54:43 +00:00
|
|
|
{#if !isValidHexPubKey($settings.nostrZapPubkey)}
|
|
|
|
<FormText>{$_('section.settings.invalidNostrPubkey')}</FormText>
|
|
|
|
{/if}
|
2024-08-24 13:02:49 +00:00
|
|
|
</Col>
|
|
|
|
</Row>
|
|
|
|
{/if}
|
2024-07-11 19:48:50 +00:00
|
|
|
{#if $settings.useNostr}
|
2024-07-11 15:34:12 +00:00
|
|
|
<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"
|
2024-08-31 17:54:43 +00:00
|
|
|
on:change={() => checkValidNostrPubkey('nostrPubKey')}
|
2024-07-11 19:48:50 +00:00
|
|
|
invalid={!isValidHexPubKey($settings.nostrPubKey)}
|
2024-07-11 15:34:12 +00:00
|
|
|
bsSize={$uiSettings.inputSize}
|
|
|
|
></Input>
|
2024-08-31 17:54:43 +00:00
|
|
|
{#if !isValidHexPubKey($settings.nostrPubKey)}
|
|
|
|
<FormText>{$_('section.settings.invalidNostrPubkey')}</FormText>
|
|
|
|
{/if}
|
2024-07-11 15:34:12 +00:00
|
|
|
</Col>
|
|
|
|
</Row>
|
2024-08-24 13:02:49 +00:00
|
|
|
{/if}
|
|
|
|
{#if 'nostrZapNotify' in $settings || $settings.useNostr}
|
2024-07-11 15:34:12 +00:00
|
|
|
<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}
|
2024-08-31 17:54:43 +00:00
|
|
|
required
|
2024-07-11 15:34:12 +00:00
|
|
|
></Input>
|
|
|
|
<Button type="button" color="success" on:click={testNostrRelay}
|
|
|
|
>{$_('test', { default: 'Test' })}</Button
|
|
|
|
>
|
|
|
|
</InputGroup>
|
|
|
|
</Col>
|
|
|
|
</Row>
|
|
|
|
{/if}
|
2024-06-28 15:32:06 +00:00
|
|
|
<Row>
|
|
|
|
<Label md={6} for="mempoolInstance" size="sm"
|
|
|
|
>{$_('section.settings.mempoolnstance')}</Label
|
|
|
|
>
|
|
|
|
<Col md="6">
|
|
|
|
<InputGroup size={$uiSettings.inputSize}>
|
|
|
|
<Input
|
|
|
|
type="text"
|
|
|
|
bind:value={$settings.mempoolInstance}
|
|
|
|
name="mempoolInstance"
|
|
|
|
id="mempoolInstance"
|
|
|
|
disabled={$settings.ownDataSource}
|
|
|
|
bsSize="sm"
|
2024-08-31 17:54:43 +00:00
|
|
|
required
|
2024-06-28 15:32:06 +00:00
|
|
|
></Input>
|
|
|
|
<InputGroupText>
|
|
|
|
<Input
|
|
|
|
addon
|
|
|
|
type="checkbox"
|
|
|
|
bind:checked={$settings.mempoolSecure}
|
|
|
|
disabled={$settings.ownDataSource}
|
|
|
|
bsSize={$uiSettings.inputSize}
|
|
|
|
/>
|
|
|
|
HTTPS
|
|
|
|
</InputGroupText>
|
|
|
|
</InputGroup>
|
|
|
|
<FormText>{$_('section.settings.mempoolInstanceHelpText')}</FormText>
|
|
|
|
</Col>
|
|
|
|
</Row>
|
2023-11-17 00:05:35 +00:00
|
|
|
<Row>
|
2024-06-08 22:11:27 +00:00
|
|
|
<Label md={6} for="hostnamePrefix" size={$uiSettings.inputSize}
|
2023-11-19 19:27:22 +00:00
|
|
|
>{$_('section.settings.hostnamePrefix')}</Label
|
|
|
|
>
|
|
|
|
<Col md="6">
|
2023-11-17 00:05:35 +00:00
|
|
|
<Input
|
|
|
|
type="text"
|
|
|
|
bind:value={$settings.hostnamePrefix}
|
|
|
|
name="hostnamePrefix"
|
|
|
|
id="hostnamePrefix"
|
2024-06-08 22:11:27 +00:00
|
|
|
bsSize={$uiSettings.inputSize}
|
2024-08-31 17:54:43 +00:00
|
|
|
required
|
|
|
|
minlength="1"
|
2023-11-19 19:27:22 +00:00
|
|
|
></Input>
|
|
|
|
</Col>
|
|
|
|
</Row>
|
2023-11-21 15:05:00 +00:00
|
|
|
<Row>
|
2024-06-08 22:11:27 +00:00
|
|
|
<Label md={6} for="wifiTxPower" size={$uiSettings.inputSize}
|
2023-11-21 15:05:00 +00:00
|
|
|
>{$_('section.settings.wifiTxPower', { default: 'WiFi Tx Power' })}</Label
|
|
|
|
>
|
|
|
|
<Col md="6">
|
|
|
|
<Input
|
|
|
|
type="select"
|
|
|
|
bind:value={$settings.txPower}
|
|
|
|
name="select"
|
|
|
|
id="fgColor"
|
2024-06-08 22:11:27 +00:00
|
|
|
bsSize={$uiSettings.inputSize}
|
|
|
|
class={$uiSettings.selectClass}
|
2023-11-21 15:05:00 +00:00
|
|
|
>
|
|
|
|
{#each wifiTxPowerMap as [key, value]}
|
|
|
|
<option {value}>{key}</option>
|
|
|
|
{/each}
|
|
|
|
</Input>
|
|
|
|
<FormText>{$_('section.settings.wifiTxPowerText')}</FormText>
|
|
|
|
</Col>
|
|
|
|
</Row>
|
2024-07-11 12:01:10 +00:00
|
|
|
<Row>
|
|
|
|
<Label md={6} for="wpTimeout" size={$uiSettings.inputSize}
|
|
|
|
>{$_('section.settings.wpTimeout')}</Label
|
|
|
|
>
|
|
|
|
<Col md="6">
|
|
|
|
<InputGroup size={$uiSettings.inputSize}>
|
|
|
|
<Input
|
|
|
|
type="number"
|
|
|
|
id="minSecPriceUpd"
|
|
|
|
min={1}
|
|
|
|
step="1"
|
|
|
|
bind:value={$settings.wpTimeout}
|
2024-08-31 17:54:43 +00:00
|
|
|
required
|
2024-07-11 12:01:10 +00:00
|
|
|
/>
|
|
|
|
<InputGroupText>{$_('time.seconds')}</InputGroupText>
|
|
|
|
</InputGroup>
|
|
|
|
</Col>
|
|
|
|
</Row>
|
2023-11-19 19:27:22 +00:00
|
|
|
<Row>
|
2024-08-31 15:10:26 +00:00
|
|
|
<Col md="6" xl="12" xxl="6">
|
2023-11-19 19:27:22 +00:00
|
|
|
<Input
|
|
|
|
id="ledTestOnPower"
|
|
|
|
bind:checked={$settings.ledTestOnPower}
|
|
|
|
type="switch"
|
2024-06-08 22:11:27 +00:00
|
|
|
bsSize={$uiSettings.inputSize}
|
2023-11-19 19:27:22 +00:00
|
|
|
label={$_('section.settings.ledPowerOnTest')}
|
|
|
|
/>
|
|
|
|
</Col>
|
2024-08-31 15:10:26 +00:00
|
|
|
<Col md="6" xl="12" xxl="6">
|
2023-11-19 19:27:22 +00:00
|
|
|
<Input
|
|
|
|
id="ledFlashOnUpd"
|
|
|
|
bind:checked={$settings.ledFlashOnUpd}
|
|
|
|
type="switch"
|
2024-06-08 22:11:27 +00:00
|
|
|
bsSize={$uiSettings.inputSize}
|
2023-11-19 19:27:22 +00:00
|
|
|
label={$_('section.settings.ledFlashOnBlock')}
|
|
|
|
/>
|
|
|
|
</Col>
|
2024-08-31 15:10:26 +00:00
|
|
|
<Col md="6" xl="12" xxl="6">
|
2023-11-19 19:27:22 +00:00
|
|
|
<Input
|
|
|
|
id="stealFocus"
|
|
|
|
bind:checked={$settings.stealFocus}
|
|
|
|
type="switch"
|
2024-06-08 22:11:27 +00:00
|
|
|
bsSize={$uiSettings.inputSize}
|
2023-11-19 19:27:22 +00:00
|
|
|
label={$_('section.settings.StealFocusOnNewBlock')}
|
|
|
|
/>
|
|
|
|
</Col>
|
2024-08-31 15:10:26 +00:00
|
|
|
<Col md="6" xl="12" xxl="6">
|
2023-11-19 19:27:22 +00:00
|
|
|
<Input
|
|
|
|
id="mcapBigChar"
|
|
|
|
bind:checked={$settings.mcapBigChar}
|
|
|
|
type="switch"
|
2024-06-08 22:11:27 +00:00
|
|
|
bsSize={$uiSettings.inputSize}
|
2023-11-19 19:27:22 +00:00
|
|
|
label={$_('section.settings.useBigCharsMcap')}
|
|
|
|
/>
|
|
|
|
</Col>
|
2024-08-31 15:10:26 +00:00
|
|
|
<Col md="6" xl="12" xxl="6">
|
2023-11-19 19:27:22 +00:00
|
|
|
<Input
|
|
|
|
id="otaEnabled"
|
|
|
|
bind:checked={$settings.otaEnabled}
|
|
|
|
type="switch"
|
2024-06-08 22:11:27 +00:00
|
|
|
bsSize={$uiSettings.inputSize}
|
2023-11-19 19:27:22 +00:00
|
|
|
label="{$_('section.settings.otaUpdates')} ({$_('restartRequired')})"
|
|
|
|
/>
|
|
|
|
</Col>
|
2024-08-31 15:10:26 +00:00
|
|
|
<Col md="6" xl="12" xxl="6">
|
2023-11-19 19:27:22 +00:00
|
|
|
<Input
|
|
|
|
id="mdnsEnabled"
|
|
|
|
bind:checked={$settings.mdnsEnabled}
|
|
|
|
type="switch"
|
2024-06-08 22:11:27 +00:00
|
|
|
bsSize={$uiSettings.inputSize}
|
2023-11-19 19:27:22 +00:00
|
|
|
label="{$_('section.settings.enableMdns')} ({$_('restartRequired')})"
|
|
|
|
/>
|
|
|
|
</Col>
|
2024-08-31 15:10:26 +00:00
|
|
|
<Col md="6" xl="12" xxl="6">
|
2023-11-19 19:27:22 +00:00
|
|
|
<Input
|
|
|
|
id="fetchEurPrice"
|
|
|
|
bind:checked={$settings.fetchEurPrice}
|
|
|
|
type="switch"
|
2024-06-08 22:11:27 +00:00
|
|
|
bsSize={$uiSettings.inputSize}
|
2023-11-19 19:27:22 +00:00
|
|
|
label="{$_('section.settings.fetchEuroPrice')} ({$_('restartRequired')})"
|
|
|
|
/>
|
2023-11-17 00:05:35 +00:00
|
|
|
</Col>
|
2024-08-31 15:10:26 +00:00
|
|
|
<Col md="6" xl="12" xxl="6">
|
2024-03-10 11:21:25 +00:00
|
|
|
<Input
|
|
|
|
id="useBlkCountdown"
|
|
|
|
bind:checked={$settings.useBlkCountdown}
|
|
|
|
type="switch"
|
2024-06-08 22:11:27 +00:00
|
|
|
bsSize={$uiSettings.inputSize}
|
2024-03-10 11:21:25 +00:00
|
|
|
label={$_('section.settings.useBlkCountdown')}
|
|
|
|
/>
|
|
|
|
</Col>
|
2024-08-31 15:10:26 +00:00
|
|
|
<Col md="6" xl="12" xxl="6">
|
2024-03-10 11:21:25 +00:00
|
|
|
<Input
|
|
|
|
id="useSatsSymbol"
|
|
|
|
bind:checked={$settings.useSatsSymbol}
|
|
|
|
type="switch"
|
2024-06-08 22:11:27 +00:00
|
|
|
bsSize={$uiSettings.inputSize}
|
2024-03-10 11:21:25 +00:00
|
|
|
label={$_('section.settings.useSatsSymbol')}
|
|
|
|
/>
|
|
|
|
</Col>
|
2024-08-31 15:10:26 +00:00
|
|
|
<Col md="6" xl="12" xxl="6">
|
2024-03-11 20:09:15 +00:00
|
|
|
<Input
|
|
|
|
id="suffixPrice"
|
|
|
|
bind:checked={$settings.suffixPrice}
|
|
|
|
type="switch"
|
2024-06-08 22:11:27 +00:00
|
|
|
bsSize={$uiSettings.inputSize}
|
2024-03-11 20:09:15 +00:00
|
|
|
label={$_('section.settings.suffixPrice')}
|
|
|
|
/>
|
|
|
|
</Col>
|
2024-08-31 15:10:26 +00:00
|
|
|
<Col md="6" xl="12" xxl="6">
|
2024-03-11 20:09:15 +00:00
|
|
|
<Input
|
|
|
|
id="disableLeds"
|
|
|
|
bind:checked={$settings.disableLeds}
|
|
|
|
type="switch"
|
2024-06-08 22:11:27 +00:00
|
|
|
bsSize={$uiSettings.inputSize}
|
2024-03-11 20:09:15 +00:00
|
|
|
label={$_('section.settings.disableLeds')}
|
|
|
|
/>
|
|
|
|
</Col>
|
2024-08-31 15:10:26 +00:00
|
|
|
<Col md="6" xl="12" xxl="6">
|
2024-05-08 21:38:56 +00:00
|
|
|
<Input
|
2024-05-08 22:54:55 +00:00
|
|
|
id="ownDataSource"
|
|
|
|
bind:checked={$settings.ownDataSource}
|
2024-05-08 21:38:56 +00:00
|
|
|
type="switch"
|
2024-06-08 22:11:27 +00:00
|
|
|
bsSize={$uiSettings.inputSize}
|
2024-05-08 22:54:55 +00:00
|
|
|
label="{$_('section.settings.ownDataSource')} ({$_('restartRequired')})"
|
2024-05-08 21:38:56 +00:00
|
|
|
/>
|
|
|
|
</Col>
|
2024-07-11 19:48:50 +00:00
|
|
|
{#if $settings.nostrRelay}
|
2024-08-31 15:10:26 +00:00
|
|
|
<Col md="6" xl="12" xxl="6">
|
2024-07-11 19:48:50 +00:00
|
|
|
<Input
|
|
|
|
id="useNostr"
|
|
|
|
bind:checked={$settings.useNostr}
|
|
|
|
type="switch"
|
|
|
|
bsSize={$uiSettings.inputSize}
|
|
|
|
label="{$_('section.settings.useNostr')} ({$_('restartRequired')})"
|
|
|
|
/>
|
|
|
|
</Col>
|
|
|
|
{/if}
|
2024-08-24 13:02:49 +00:00
|
|
|
{#if 'nostrZapNotify' in $settings}
|
2024-08-31 15:10:26 +00:00
|
|
|
<Col md="6" xl="12" xxl="6">
|
2024-08-24 13:02:49 +00:00
|
|
|
<Input
|
|
|
|
id="nostrZapNotify"
|
|
|
|
bind:checked={$settings.nostrZapNotify}
|
|
|
|
type="switch"
|
|
|
|
bsSize={$uiSettings.inputSize}
|
|
|
|
label="{$_('section.settings.nostrZapNotify')} ({$_('restartRequired')})"
|
|
|
|
/>
|
|
|
|
</Col>
|
|
|
|
{/if}
|
2024-07-29 18:10:26 +00:00
|
|
|
{#if 'bitaxeEnabled' in $settings}
|
2024-08-31 15:10:26 +00:00
|
|
|
<Col md="6" xl="12" xxl="6">
|
2024-07-29 18:10:26 +00:00
|
|
|
<Input
|
|
|
|
id="bitaxeEnabled"
|
|
|
|
bind:checked={$settings.bitaxeEnabled}
|
|
|
|
type="switch"
|
|
|
|
bsSize={$uiSettings.inputSize}
|
|
|
|
label="{$_('section.settings.bitaxeEnabled')} ({$_('restartRequired')})"
|
|
|
|
/>
|
|
|
|
</Col>
|
|
|
|
{/if}
|
2024-05-08 21:38:56 +00:00
|
|
|
{#if $settings.hasFrontlight}
|
2024-08-31 15:10:26 +00:00
|
|
|
<Col md="6" xl="12" xxl="6">
|
2024-05-08 21:38:56 +00:00
|
|
|
<Input
|
|
|
|
id="flAlwaysOn"
|
|
|
|
bind:checked={$settings.flAlwaysOn}
|
|
|
|
type="switch"
|
2024-06-08 22:11:27 +00:00
|
|
|
bsSize={$uiSettings.inputSize}
|
2024-05-08 21:38:56 +00:00
|
|
|
label={$_('section.settings.flAlwaysOn')}
|
|
|
|
/>
|
|
|
|
</Col>
|
2024-08-31 15:10:26 +00:00
|
|
|
<Col md="6" xl="12" xxl="6">
|
2024-06-07 22:39:44 +00:00
|
|
|
<Input
|
|
|
|
id="flFlashOnUpd"
|
|
|
|
bind:checked={$settings.flFlashOnUpd}
|
|
|
|
type="switch"
|
2024-06-08 22:11:27 +00:00
|
|
|
bsSize={$uiSettings.inputSize}
|
2024-06-07 22:39:44 +00:00
|
|
|
label={$_('section.settings.flFlashOnUpd')}
|
|
|
|
/>
|
|
|
|
</Col>
|
2024-05-08 21:38:56 +00:00
|
|
|
{/if}
|
2023-11-17 00:05:35 +00:00
|
|
|
</Row>
|
2023-11-17 02:15:23 +00:00
|
|
|
|
2023-11-19 19:27:22 +00:00
|
|
|
<Row>
|
|
|
|
<h3>{$_('section.settings.screens')}</h3>
|
|
|
|
{#if $settings.screens}
|
|
|
|
{#each $settings.screens as s}
|
2024-08-31 15:10:26 +00:00
|
|
|
<Col md="6" xl="12" xxl="6">
|
2023-11-19 19:27:22 +00:00
|
|
|
<Input
|
|
|
|
id="screens_{s.id}"
|
|
|
|
bind:checked={s.enabled}
|
|
|
|
type="switch"
|
2024-06-08 22:11:27 +00:00
|
|
|
bsSize={$uiSettings.inputSize}
|
2023-11-19 19:27:22 +00:00
|
|
|
label={s.name}
|
|
|
|
/>
|
|
|
|
</Col>
|
|
|
|
{/each}
|
|
|
|
{/if}
|
|
|
|
</Row>
|
2024-06-08 22:11:27 +00:00
|
|
|
<Row>
|
|
|
|
<Col class="d-flex justify-content-end">
|
|
|
|
<Button on:click={handleReset} color="secondary">{$_('button.reset')}</Button>
|
|
|
|
<div class="mx-2"></div>
|
|
|
|
<Button color="primary">{$_('button.save')}</Button>
|
|
|
|
</Col>
|
|
|
|
</Row>
|
2023-11-17 00:05:35 +00:00
|
|
|
</Form>
|
|
|
|
</CardBody>
|
|
|
|
</Card>
|
|
|
|
</Col>
|