all repos — honk @ 91d3b49704cfcb6071dd09ac900aad8037373945

my fork of honk

all inclusive danger zone
Ted Unangst tedu@tedunangst.com
Sun, 05 Feb 2023 20:42:14 -0500
commit

91d3b49704cfcb6071dd09ac900aad8037373945

parent

a774192626249641eb7fad08ccfe075046f74396

4 files changed, 8 insertions(+), 3 deletions(-)

jump to
M docs/changelog.txtdocs/changelog.txt

@@ -2,6 +2,8 @@ changelog

=== next ++ All inclusive danger zone spoiler alerts. + + Emu peeker + CSP compliance
M docs/honk.5docs/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.gofun.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.goweb.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 } }