Fix comment tag values

This commit is contained in:
Jon Staab
2025-04-29 09:18:34 -07:00
parent 8ce0abbccd
commit ed10a620a7
5 changed files with 21 additions and 4 deletions
+1 -2
View File
@@ -235,8 +235,7 @@ export const parseInvoice = (text: string, context: ParseContext): ParsedInvoice
export const parseLink = (text: string, context: ParseContext): ParsedLink | void => {
const prev = last(context.results)
const [link] =
text.match(/^([a-z\+:]{2,30}:\/\/)?[-\.~\w]+\.[\w]{2,6}([^\s]*[^<>"'\.!,:\s\)\(]+)?/gi) || []
let link = text.match(/^([a-z\+:]{2,30}:\/\/)?[-\.~\w]+\.[\w]{2,6}([^\s]*[^<>"'\.!,:\s\)\(]+)?/gi)?.[0]
// Skip url if it's just the end of a filepath or an ellipse
if (!link || (prev?.type === ParsedType.Text && prev.value.endsWith("/")) || link.match(/\.\./)) {
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@welshman/util",
"version": "0.2.0",
"version": "0.2.1",
"author": "hodlbod",
"license": "MIT",
"description": "A collection of nostr-related utilities.",
+1
View File
@@ -121,6 +121,7 @@ export const INBOX_RELAYS = 10050
export const FILE_SERVERS = 10096
export const LIGHTNING_PUB_RPC = 21000
export const CLIENT_AUTH = 22242
export const BLOSSOM_AUTH = 24242
export const AUTH_JOIN = 28934
export const AUTH_INVITE = 28935
export const WALLET_INFO = 13194
+1 -1
View File
@@ -62,7 +62,7 @@ export const getCommentTags = (tags: string[][]) => {
}
export const getCommentTagValues = (tags: string[][]) =>
mapVals(tags => tags.map(nth(1)), getCommentTags(tags))
mapVals(tags => tags.filter(t => ['a', 'e'].includes(t[0].toLowerCase())).map(nth(1)), getCommentTags(tags))
export const getReplyTags = (tags: string[][]) => {
const validTags = tags.filter(t => ["a", "e", "q"].includes(t[0]))