errhead on Nostr: Mostly like this. I also search account.note and account.description for anything ...
Mostly like this. I also search account.note and account.description for anything using the ⚡️user@host format for completeness.
apiCall = "https://"; + hostAddress + "/api/v1/accounts/" + userName;
accountData = await axios.get(apiCall);
if (!accountData) {
apiCall = "https://"; + hostAddress + "/api/v1/accounts/lookup?acct=" + userName
accountData = await axios.get(apiCall);
}
if (accountData) {
let account = accountData.data
if (account.fields) {
for (var field of account.fields) {
if (field.name.toLowerCase() === "lightning address" || field.name.toLowerCase() === "lud16") {
foundLightningAddress = field.value;
}
}
}
apiCall = "https://"; + hostAddress + "/api/v1/accounts/" + userName;
accountData = await axios.get(apiCall);
if (!accountData) {
apiCall = "https://"; + hostAddress + "/api/v1/accounts/lookup?acct=" + userName
accountData = await axios.get(apiCall);
}
if (accountData) {
let account = accountData.data
if (account.fields) {
for (var field of account.fields) {
if (field.name.toLowerCase() === "lightning address" || field.name.toLowerCase() === "lud16") {
foundLightningAddress = field.value;
}
}
}