don't allow lnc edits because they won't work

This commit is contained in:
keyan 2024-04-27 19:02:16 -05:00
parent 2da3762d40
commit 4a14e0342b
2 changed files with 4 additions and 3 deletions

View File

@ -96,7 +96,6 @@ export function LNCProvider ({ children }) {
try { try {
lnc.credentials.pairingPhrase = config.pairingPhrase lnc.credentials.pairingPhrase = config.pairingPhrase
lnc.credentials.password = config?.password || XXX_DEFAULT_PASSWORD
await lnc.connect() await lnc.connect()
await validateNarrowPerms(lnc) await validateNarrowPerms(lnc)
lnc.credentials.password = config?.password || XXX_DEFAULT_PASSWORD lnc.credentials.password = config?.password || XXX_DEFAULT_PASSWORD

View File

@ -5,7 +5,7 @@ import Info from '@/components/info'
import { CenterLayout } from '@/components/layout' import { CenterLayout } from '@/components/layout'
import Text from '@/components/text' import Text from '@/components/text'
import { useToast } from '@/components/toast' import { useToast } from '@/components/toast'
import { WalletButtonBar, WalletCard } from '@/components/wallet-card' import { WalletButtonBar, WalletCard, isConfigured } from '@/components/wallet-card'
import WalletLogs from '@/components/wallet-logs' import WalletLogs from '@/components/wallet-logs'
import { Status, useWebLNConfigurator } from '@/components/webln' import { Status, useWebLNConfigurator } from '@/components/webln'
import { XXX_DEFAULT_PASSWORD, useLNC } from '@/components/webln/lnc' import { XXX_DEFAULT_PASSWORD, useLNC } from '@/components/webln/lnc'
@ -23,6 +23,7 @@ export default function LNC () {
const { status, clearConfig, saveConfig, config, name, unlock } = lnc const { status, clearConfig, saveConfig, config, name, unlock } = lnc
const isDefault = provider?.name === name const isDefault = provider?.name === name
const unlocking = useRef(false) const unlocking = useRef(false)
const configured = isConfigured(status)
useEffect(() => { useEffect(() => {
if (!unlocking.current && status === Status.Locked) { if (!unlocking.current && status === Status.Locked) {
@ -46,7 +47,6 @@ export default function LNC () {
schema={lncSchema} schema={lncSchema}
onSubmit={async ({ isDefault, ...values }) => { onSubmit={async ({ isDefault, ...values }) => {
try { try {
await clearConfig()
await saveConfig(values) await saveConfig(values)
if (isDefault) setProvider(lnc) if (isDefault) setProvider(lnc)
toaster.success('saved settings') toaster.success('saved settings')
@ -70,6 +70,7 @@ export default function LNC () {
name='pairingPhrase' name='pairingPhrase'
initialValue={config?.pairingPhrase} initialValue={config?.pairingPhrase}
newPass={config?.pairingPhrase === undefined} newPass={config?.pairingPhrase === undefined}
readOnly={configured}
required required
autoFocus autoFocus
/> />
@ -78,6 +79,7 @@ export default function LNC () {
name='password' name='password'
initialValue={defaultPassword ? '' : config?.password} initialValue={defaultPassword ? '' : config?.password}
newPass={config?.password === undefined || defaultPassword} newPass={config?.password === undefined || defaultPassword}
readOnly={configured}
hint='encrypts your pairing phrase when stored locally' hint='encrypts your pairing phrase when stored locally'
/> />
<ClientCheckbox <ClientCheckbox