|
|
@ -1,3 +1,4 @@
|
|
|
|
|
|
|
|
import {nip19} from 'nostr-tools';
|
|
|
|
import {isNotNull} from './array';
|
|
|
|
import {isNotNull} from './array';
|
|
|
|
import {isValidURL} from './url';
|
|
|
|
import {isValidURL} from './url';
|
|
|
|
|
|
|
|
|
|
|
@ -96,6 +97,13 @@ export const parseTextContent = (
|
|
|
|
href: `lightning:${word}`
|
|
|
|
href: `lightning:${word}`
|
|
|
|
}, `lightning:${word.slice(0, 24)}…`);
|
|
|
|
}, `lightning:${word.slice(0, 24)}…`);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (word.startsWith('nostr:npub') && word.length === 69) {
|
|
|
|
|
|
|
|
const npub = word.slice(6);
|
|
|
|
|
|
|
|
const {type, data} = nip19.decode(npub);
|
|
|
|
|
|
|
|
if (type === 'npub') {
|
|
|
|
|
|
|
|
return elem('a', {href: `/${npub}`, data: {profile: data}}, data.slice(6, 15))
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
if (!word.match(/^(https?:\/\/|www\.)\S*/)) {
|
|
|
|
if (!word.match(/^(https?:\/\/|www\.)\S*/)) {
|
|
|
|
return word;
|
|
|
|
return word;
|
|
|
|
}
|
|
|
|
}
|
|
|
|