From d4d49cbbad0915c29c75e4415c58b2e7d31ccbfb Mon Sep 17 00:00:00 2001 From: ekzyis Date: Sun, 8 Sep 2024 20:49:27 +0200 Subject: [PATCH] Remove nostr parsing because SN has njump.me embeds now --- main.go | 48 ------------------------------------------------ 1 file changed, 48 deletions(-) diff --git a/main.go b/main.go index ab8c1fa..c0def91 100644 --- a/main.go +++ b/main.go @@ -25,31 +25,6 @@ var ( NitterClearnetUrls = []string{ "xcancel.com", } - - // since v0.4.0, bot also replaces nostr links with nostr.com so users can pick their client - NostrUrlRegexp = regexp.MustCompile( - `^(?:https?:\/\/)?(?:www\.)?` + - `(?:` + - `primal\.net\/(?:e\/)?` + - `|snort\.social\/(?:e\/)?` + - `|iris\.to\/` + - `|highlighter\.com\/(?:a\/)?` + - `|nostter\.app\/` + - `|coracle\.social\/(?:notes\/)?` + - `|satellite\.earth\/` + - `|nostrudel\.ninja\/(?:#\/n\/)?` + - `)((note|nevent)[a-zA-Z0-9]+)$`) - NostrClients = []NostrClient{ - // list from nostr.com - NostrClient{"https://primal.net/e/", "primal.net"}, - NostrClient{"https://snort.social/e/", "snort.social"}, - NostrClient{"https://nostrudel.ninja/#/n/", "nostrudel.ninja"}, - NostrClient{"https://satellite.earth/thread/", "satellite.earth"}, - NostrClient{"https://coracle.social/", "coracle.social"}, - NostrClient{"https://nostter.app/", "nostter.app"}, - NostrClient{"https://highlighter.com/a/", "highlighter.com"}, - NostrClient{"https://iris.to/", "iris.to"}, - } ) func WaitUntilNext(d time.Duration) { @@ -103,29 +78,6 @@ func main() { } else { log.Printf("item %d is not twitter link\n", item.Id) } - if m := NostrUrlRegexp.FindStringSubmatch(item.Url); m != nil { - log.Printf("item %d is nostr link\n", item.Id) - if ItemHasComment(item.Id) { - log.Printf("item %d already has nostr links comment\n", item.Id) - continue - } - noteId := m[1] - comment := "**Nostr Client Picker**\n\n" - for _, client := range NostrClients { - comment += fmt.Sprintf("[%s](%s) | ", client.Name, client.Url+noteId) - } - comment = strings.TrimRight(comment, "| ") - cId, err := c.CreateComment(item.Id, comment) - if err != nil { - log.Println(err) - SendToNostr(fmt.Sprint(err)) - continue - } - log.Printf("created comment %d\n", cId) - SaveComment(&sn.Comment{Id: cId, Text: comment, ParentId: item.Id}) - } else { - log.Printf("item %d is not nostr link\n", item.Id) - } } WaitUntilNext(time.Minute)