From 4925f64be773c967b3823013adb5f765518b1a76 Mon Sep 17 00:00:00 2001 From: Shusui MOYATANI Date: Mon, 1 May 2023 22:33:14 +0900 Subject: [PATCH] feat: enable to edit nip05 --- src/components/ProfileEdit.tsx | 30 ++++++++++++++++++++++++------ 1 file changed, 24 insertions(+), 6 deletions(-) diff --git a/src/components/ProfileEdit.tsx b/src/components/ProfileEdit.tsx index d4b7370..944ef46 100644 --- a/src/components/ProfileEdit.tsx +++ b/src/components/ProfileEdit.tsx @@ -18,14 +18,14 @@ export type ProfileEditProps = { }; const LNURLRegexString = 'LNURL1[AC-HJ-NP-Zac-hj-np-z02-9]+'; -const LightningAddressRegexString = '[-a-zA-Z0-9.]+@[-a-zA-Z0-9.]+'; -const LUDAddressRegexString = `^(${LNURLRegexString}|${LightningAddressRegexString})$`; +const InternetIdentiferRegexString = '[-_a-zA-Z0-9.]+@[-a-zA-Z0-9.]+'; +const LUDAddressRegexString = `^(${LNURLRegexString}|${InternetIdentiferRegexString})$`; const LNURLRegex = new RegExp(`^${LNURLRegexString}$`); -const LightningAddressRegex = new RegExp(`${LightningAddressRegexString}`); +const InternetIdentiferRegex = new RegExp(`^${InternetIdentiferRegexString}$`); const isLNURL = (s: string) => LNURLRegex.test(s); -const isLightningAddress = (s: string) => LightningAddressRegex.test(s); +const isInternetIdentifier = (s: string) => InternetIdentiferRegex.test(s); const ProfileEdit: Component = (props) => { const pubkey = usePubkey(); @@ -101,7 +101,7 @@ const ProfileEdit: Component = (props) => { website: website(), nip05: nip05(), lud06: isLNURL(lightningAddress()) ? lightningAddress() : null, - lud16: isLightningAddress(lightningAddress()) ? lightningAddress() : null, + lud16: isInternetIdentifier(lightningAddress()) ? lightningAddress() : null, }, (v) => v == null || v.length === 0, ); @@ -157,7 +157,7 @@ const ProfileEdit: Component = (props) => { header -
+
0}> = (props) => { onKeyDown={ignoreEnter} />
+
+ + setNIP05(ev.currentTarget.value)} + onKeyDown={ignoreEnter} + /> +
+ 保存中...