all inclusive danger zone
This commit is contained in:
parent
50524cade2
commit
628fc34ae4
|
@ -2,6 +2,8 @@ changelog
|
||||||
|
|
||||||
=== next
|
=== next
|
||||||
|
|
||||||
|
+ All inclusive danger zone spoiler alerts.
|
||||||
|
|
||||||
+ Emu peeker
|
+ Emu peeker
|
||||||
|
|
||||||
+ CSP compliance
|
+ CSP compliance
|
||||||
|
|
|
@ -74,7 +74,8 @@ will become a horizontal rule.
|
||||||
.Pp
|
.Pp
|
||||||
If the first line of a honk begins with
|
If the first line of a honk begins with
|
||||||
.Dq DZ:
|
.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
|
.Pp
|
||||||
Mentioning a specfic user such as
|
Mentioning a specfic user such as
|
||||||
.Pq @user@example.social
|
.Pq @user@example.social
|
||||||
|
|
4
fun.go
4
fun.go
|
@ -290,12 +290,14 @@ func imaginate(honk *Honk) {
|
||||||
htf.String(honk.Noise)
|
htf.String(honk.Noise)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var re_dangerous = regexp.MustCompile("^[a-zA-Z]{2}:")
|
||||||
|
|
||||||
func translate(honk *Honk) {
|
func translate(honk *Honk) {
|
||||||
if honk.Format == "html" {
|
if honk.Format == "html" {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
noise := honk.Noise
|
noise := honk.Noise
|
||||||
if strings.HasPrefix(noise, "DZ:") {
|
if re_dangerous.MatchString(noise) {
|
||||||
idx := strings.Index(noise, "\n")
|
idx := strings.Index(noise, "\n")
|
||||||
if idx == -1 {
|
if idx == -1 {
|
||||||
honk.Precis = noise
|
honk.Precis = noise
|
||||||
|
|
2
web.go
2
web.go
|
@ -1662,7 +1662,7 @@ func submithonk(w http.ResponseWriter, r *http.Request) *Honk {
|
||||||
honk.RID = rid
|
honk.RID = rid
|
||||||
if xonk.Precis != "" && honk.Precis == "" {
|
if xonk.Precis != "" && honk.Precis == "" {
|
||||||
honk.Precis = xonk.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
|
honk.Precis = "re: " + honk.Precis
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue