diff --git a/fun.go b/fun.go index b5b9148..d168ef1 100644 --- a/fun.go +++ b/fun.go @@ -425,6 +425,8 @@ func herdofemus(noise string) []Emu { 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 { diff --git a/web.go b/web.go index fefc55c..f6135a5 100644 --- a/web.go +++ b/web.go @@ -1612,7 +1612,18 @@ func submithonk(w http.ResponseWriter, r *http.Request) *Honk { } } + 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 @@ func submithonk(w http.ResponseWriter, r *http.Request) *Honk { noise = honk.Noise translate(honk) - var convoy string if rid != "" { xonk := getxonk(userinfo.UserID, rid) if xonk == nil {