all inclusive danger zone
Ted Unangst tedu@tedunangst.com
Sun, 05 Feb 2023 20:42:14 -0500
4 files changed,
8 insertions(+),
3 deletions(-)
M
docs/changelog.txt
→
docs/changelog.txt
@@ -2,6 +2,8 @@ changelog
=== next ++ All inclusive danger zone spoiler alerts. + + Emu peeker + CSP compliance
M
docs/honk.5
→
docs/honk.5
@@ -74,7 +74,8 @@ .El
.Pp If the first line of a honk begins with .Dq DZ: -(danger zone) it will be used a summary and the post marked sensitive. +(danger zone) or any other combination of two letters and a colon, +it will be used a summary and the post marked sensitive. .Pp Mentioning a specfic user such as .Pq @user@example.social
M
fun.go
→
fun.go
@@ -290,12 +290,14 @@ htf.BaseURL, _ = url.Parse(honk.XID)
htf.String(honk.Noise) } +var re_dangerous = regexp.MustCompile("^[a-zA-Z]{2}:") + func translate(honk *Honk) { if honk.Format == "html" { return } noise := honk.Noise - if strings.HasPrefix(noise, "DZ:") { + if re_dangerous.MatchString(noise) { idx := strings.Index(noise, "\n") if idx == -1 { honk.Precis = noise
M
web.go
→
web.go
@@ -1662,7 +1662,7 @@ }
honk.RID = rid if xonk.Precis != "" && honk.Precis == "" { honk.Precis = xonk.Precis - if !(strings.HasPrefix(honk.Precis, "DZ:") || strings.HasPrefix(honk.Precis, "re: re: re: ")) { + if !re_dangerous.MatchString(honk.Precis) { honk.Precis = "re: " + honk.Precis } }