allow setting context by hand
Ted Unangst tedu@tedunangst.com
Sat, 25 Mar 2023 14:46:11 -0400
M
fun.go
→
fun.go
@@ -425,6 +425,8 @@
var re_memes = regexp.MustCompile("meme: ?([^\n]+)") var re_avatar = regexp.MustCompile("avatar: ?([^\n]+)") var re_banner = regexp.MustCompile("banner: ?([^\n]+)") +var re_convoy = regexp.MustCompile("convoy: ?([^\n]+)") +var re_convalidate = regexp.MustCompile("^(https?|tag|data):") func memetize(honk *Honk) { repl := func(x string) string {
M
web.go
→
web.go
@@ -1612,7 +1612,18 @@ Format: format,
} } + var convoy string noise = strings.Replace(noise, "\r", "", -1) + if updatexid == "" && rid == "" { + noise = re_convoy.ReplaceAllStringFunc(noise, func(m string) string { + convoy = m[7:] + convoy = strings.TrimSpace(convoy) + if !re_convalidate.MatchString(convoy) { + convoy = "" + } + return "" + }) + } noise = quickrename(noise, userinfo.UserID) noise = hooterize(noise) honk.Noise = noise@@ -1620,7 +1631,6 @@ precipitate(honk)
noise = honk.Noise translate(honk) - var convoy string if rid != "" { xonk := getxonk(userinfo.UserID, rid) if xonk == nil {