`, "")
+ mlinks := re_qtlinks.FindAllString(malcontent, -1)
+ for _, m := range mlinks {
+ m = m[1 : len(m)-1]
+ dlog.Printf("consider qt: %s", m)
+ if re_mast0link.MatchString(m) ||
+ re_masto1ink.MatchString(m) ||
+ re_misslink.MatchString(m) ||
+ re_honklink.MatchString(m) ||
+ re_romalink.MatchString(m) {
+ j, err := GetJunk(user.ID, m)
+ dlog.Printf("fetched %s: %s", m, err)
+ if err == nil {
+ q, ok := j.GetString("content")
+ if ok {
+ content = fmt.Sprintf("%s%s
", content, q)
+ }
+ }
+ }
+ }
+ return content
+}
+
func xonksaver(user *WhatAbout, item junk.Junk, origin string) *Honk {
depth := 0
maxdepth := 10
@@ -541,6 +575,7 @@ func xonksaver(user *WhatAbout, item junk.Junk, origin string) *Honk {
var xid, rid, url, convoy string
var replies []string
var obj junk.Junk
+ waspage := false
switch what {
case "Delete":
obj, ok = item.GetMap("object")
@@ -649,7 +684,8 @@ func xonksaver(user *WhatAbout, item junk.Junk, origin string) *Honk {
case "Move":
obj = item
what = "move"
- case "GuessWord": // dealt with below
+ case "Page":
+ waspage = true
fallthrough
case "Audio":
fallthrough
@@ -662,8 +698,6 @@ func xonksaver(user *WhatAbout, item junk.Junk, origin string) *Honk {
case "Note":
fallthrough
case "Article":
- fallthrough
- case "Page":
obj = item
what = "honk"
case "Event":
@@ -688,9 +722,11 @@ func xonksaver(user *WhatAbout, item junk.Junk, origin string) *Honk {
return nil
}
if originate(xid) != origin {
- ilog.Printf("original sin: %s not from %s", xid, origin)
- item.Write(ilog.Writer())
- return nil
+ if !develMode && origin != "" {
+ ilog.Printf("original sin: %s not from %s", xid, origin)
+ item.Write(ilog.Writer())
+ return nil
+ }
}
var xonk Honk
@@ -736,6 +772,13 @@ func xonksaver(user *WhatAbout, item junk.Junk, origin string) *Honk {
if sens, _ := obj["sensitive"].(bool); sens && precis == "" {
precis = "unspecified horror"
}
+ if waspage {
+ content += fmt.Sprintf(`%s`, url, url)
+ url = xid
+ }
+ if user.Options.InlineQuotes {
+ content = qutify(user, content)
+ }
rid, ok = obj.GetString("inReplyTo")
if !ok {
if robj, ok := obj.GetMap("inReplyTo"); ok {
@@ -775,12 +818,6 @@ func xonksaver(user *WhatAbout, item junk.Junk, origin string) *Honk {
targ, _ := obj.GetString("target")
content += string(templates.Sprintf(`
Moved to %s`, targ, targ))
}
- if ot == "GuessWord" {
- what = "wonk"
- content, _ = obj.GetString("content")
- xonk.Wonkles, _ = obj.GetString("wordlist")
- go savewonkles(xonk.Wonkles)
- }
if what == "honk" && rid != "" {
what = "tonk"
}
@@ -1136,8 +1173,6 @@ func jonkjonk(user *WhatAbout, h *Honk) (junk.Junk, junk.Junk) {
fallthrough
case "event":
fallthrough
- case "wonk":
- fallthrough
case "honk":
j["type"] = "Create"
jo = junk.New()
@@ -1145,8 +1180,6 @@ func jonkjonk(user *WhatAbout, h *Honk) (junk.Junk, junk.Junk) {
jo["type"] = "Note"
if h.What == "event" {
jo["type"] = "Event"
- } else if h.What == "wonk" {
- jo["type"] = "GuessWord"
}
if h.What == "update" {
j["type"] = "Update"
@@ -1253,9 +1286,6 @@ func jonkjonk(user *WhatAbout, h *Honk) (junk.Junk, junk.Junk) {
jo["duration"] = "PT" + strings.ToUpper(t.Duration.String())
}
}
- if w := h.Wonkles; w != "" {
- jo["wordlist"] = w
- }
atts := activatedonks(h.Donks)
if len(atts) > 0 {
jo["attachment"] = atts
@@ -1474,7 +1504,7 @@ func doesitmatter(what string) bool {
func collectiveaction(honk *Honk) {
user := getserveruser()
for _, ont := range honk.Onts {
- dubs := getnameddubs(serverUID, ont)
+ dubs := getnameddubs(readyLuserOne, ont)
if len(dubs) == 0 {
continue
}
@@ -1536,9 +1566,6 @@ func junkuser(user *WhatAbout) junk.Junk {
a["url"] = ava
} else {
u := fmt.Sprintf("https://%s/a?a=%s", serverName, url.QueryEscape(user.URL))
- if user.Options.Avahex {
- u += "&hex=1"
- }
a["url"] = u
}
j["icon"] = a
@@ -1591,7 +1618,7 @@ var handfull = cache.New(cache.Options{Filler: func(name string) (string, bool)
return href, true
}
dlog.Printf("fishing for %s", name)
- j, err := GetJunkFast(serverUID, fmt.Sprintf("https://%s/.well-known/webfinger?resource=acct:%s", m[1], name))
+ j, err := GetJunkFast(readyLuserOne, fmt.Sprintf("https://%s/.well-known/webfinger?resource=acct:%s", m[1], name))
if err != nil {
ilog.Printf("failed to go fish %s: %s", name, err)
return "", true
@@ -1636,7 +1663,7 @@ func investigate(name string) (*SomeThing, error) {
if name == "" {
return nil, fmt.Errorf("no name")
}
- obj, err := GetJunkFast(serverUID, name)
+ obj, err := GetJunkFast(readyLuserOne, name)
if err != nil {
return nil, err
}
@@ -1901,7 +1928,7 @@ func followyou2(user *WhatAbout, j junk.Junk) {
ilog.Printf("updating honker accept: %s", who)
db := opendatabase()
- row := db.QueryRow("select name, folxid from honkers where userid = ? and xid = ? and flavor in ('presub')",
+ row := db.QueryRow("select name, folxid from honkers where userid = ? and xid = ? and flavor in ('presub', 'sub')",
user.ID, who)
var name, folxid string
err := row.Scan(&name, &folxid)
diff --git a/avatar.go b/avatar.go
index 7c7d615..dac92d4 100644
--- a/avatar.go
+++ b/avatar.go
@@ -65,7 +65,7 @@ func loadAvatarColors() {
}
}
-func genAvatar(name string, hex bool) []byte {
+func genAvatar(name string) []byte {
h := sha512.New()
h.Write([]byte(name))
s := h.Sum(nil)
@@ -73,27 +73,6 @@ func genAvatar(name string, hex bool) []byte {
for i := 0; i < 64; i++ {
for j := 0; j < 64; j++ {
p := i*img.Stride + j*4
- if hex {
- tan := 0.577
- if i < 32 {
- if j < 17-int(float64(i)*tan) || j > 46+int(float64(i)*tan) {
- img.Pix[p+0] = 0
- img.Pix[p+1] = 0
- img.Pix[p+2] = 0
- img.Pix[p+3] = 255
- continue
- }
- } else {
- if j < 17-int(float64(64-i)*tan) || j > 46+int(float64(64-i)*tan) {
- img.Pix[p+0] = 0
- img.Pix[p+1] = 0
- img.Pix[p+2] = 0
- img.Pix[p+3] = 255
- continue
-
- }
- }
- }
xx := i/16*16 + j/16
x := s[xx]
if x < 64 {
diff --git a/bloat.go b/bloat.go
index d4c7867..e89675f 100644
--- a/bloat.go
+++ b/bloat.go
@@ -14,54 +14,3 @@
// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
package main
-
-import (
- "net/http"
- "strings"
-
- "humungus.tedunangst.com/r/webs/junk"
-)
-
-func servewonkles(w http.ResponseWriter, r *http.Request) {
- url := r.FormValue("w")
- dlog.Printf("getting wordlist: %s", url)
- wonkles := getxonker(url, "wonkles")
- if wonkles == "" {
- wonkles = savewonkles(url)
- if wonkles == "" {
- http.NotFound(w, r)
- return
- }
- }
- var words []string
- for _, l := range strings.Split(wonkles, "\n") {
- words = append(words, l)
- }
- if !develMode {
- w.Header().Set("Cache-Control", "max-age=7776000")
- }
-
- j := junk.New()
- j["wordlist"] = words
- j.Write(w)
-}
-
-func savewonkles(url string) string {
- w := getxonker(url, "wonkles")
- if w != "" {
- return w
- }
- ilog.Printf("fetching wonkles: %s", url)
- res, err := fetchsome(url)
- if err != nil {
- ilog.Printf("error fetching wonkles: %s", err)
- return ""
- }
- w = getxonker(url, "wonkles")
- if w != "" {
- return w
- }
- w = string(res)
- savexonker(url, w, "wonkles", "")
- return w
-}
diff --git a/database.go b/database.go
index 9ee7621..6c0b16c 100644
--- a/database.go
+++ b/database.go
@@ -437,9 +437,7 @@ func donksforhonks(honks []*Honk) {
continue
}
case "wonkles":
- h.Wonkles = j
case "guesses":
- h.Guesses = template.HTML(j)
case "oldrev":
default:
elog.Printf("unknown meta genus: %s", genus)
@@ -849,20 +847,6 @@ func saveextras(tx *sql.Tx, h *Honk) error {
return err
}
}
- if w := h.Wonkles; w != "" {
- _, err := tx.Stmt(stmtSaveMeta).Exec(h.ID, "wonkles", w)
- if err != nil {
- elog.Printf("error saving wonkles: %s", err)
- return err
- }
- }
- if g := h.Guesses; g != "" {
- _, err := tx.Stmt(stmtSaveMeta).Exec(h.ID, "guesses", g)
- if err != nil {
- elog.Printf("error saving guesses: %s", err)
- return err
- }
- }
return nil
}
diff --git a/docs/activitypub.7 b/docs/activitypub.7
index 00ca7cd..6bf4072 100644
--- a/docs/activitypub.7
+++ b/docs/activitypub.7
@@ -54,13 +54,6 @@ activities are ignored.
Limited support.
.It Vt Audio
Limited Support.
-.It Vt GuessWord
-Guess the word game.
-(Unofficial extension.)
-The solution is stored in
-.Fa content
-with the possible words, one per line, in a file located at
-.Fa wordlist .
.El
.Pp
Honk primarily supports HTML content, not markdown or other formats,
diff --git a/docs/changelog.txt b/docs/changelog.txt
index 6ca76dd..586b784 100644
--- a/docs/changelog.txt
+++ b/docs/changelog.txt
@@ -2,6 +2,22 @@ changelog
=== next
++ Remove the wonk support. Fun's over, back to work.
+
++ All inclusive danger zone spoiler alerts.
+
++ Emu peeker
+
++ CSP compliance
+
++ Filter to match anything with summary/warning.
+
++ Start collecting quties.
+
++ Fix http signatures for GET requests.
+
++ Fix adjacent mentions.
+
+ Fix argv for chpass.
+ Avoid self mention in reply all.
diff --git a/docs/hfcs.1 b/docs/hfcs.1
index 74a94df..5a7af15 100644
--- a/docs/hfcs.1
+++ b/docs/hfcs.1
@@ -51,6 +51,7 @@ fields as well.
.It Ar text
Regular expression match against the post
.Fa content .
+The special value of "." will match any post with a summary only.
.It Ar is announce
Is announced (shared).
.It Ar announce of
diff --git a/docs/honk.5 b/docs/honk.5
index 5879dcc..a215ce8 100644
--- a/docs/honk.5
+++ b/docs/honk.5
@@ -74,7 +74,8 @@ will become a horizontal rule.
.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
@@ -139,6 +140,9 @@ A 24 hour clock is assumed, unless am or pm are specified.
The duration is optional and may be specified as XdYhZm for X days, Y hours,
and Z minutes (1d12h would be a 36 hour event).
.Pp
+Clicking the pretty circle face will open the emu peeker to add in the
+selection of emus.
+.Pp
When everything is at last ready to go, press the
.Dq it's gonna be honked
button.
diff --git a/docs/honk.8 b/docs/honk.8
index 1023e18..1b045df 100644
--- a/docs/honk.8
+++ b/docs/honk.8
@@ -41,7 +41,7 @@ proxy_set_header Host $http_host;
.Ss Build
Building
.Nm
-requires a go compiler 1.13 and libsqlite.
+requires a go compiler 1.16 and libsqlite.
On
.Ox
this is the go and sqlite3 packages.
diff --git a/fun.go b/fun.go
index 2f6fc8e..27848c5 100644
--- a/fun.go
+++ b/fun.go
@@ -181,9 +181,6 @@ func reverbolate(userid int64, honks []*Honk) {
h.HTPrecis = template.HTML(h.Precis)
h.HTML = template.HTML(h.Noise)
- if h.What == "wonked" {
- h.HTML = "? wonk ?"
- }
if redo := relingo[h.What]; redo != "" {
h.What = redo
}
@@ -290,12 +287,14 @@ func imaginate(honk *Honk) {
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
@@ -457,7 +456,7 @@ func memetize(honk *Honk) {
honk.Noise = re_memes.ReplaceAllStringFunc(honk.Noise, repl)
}
-var re_quickmention = regexp.MustCompile("(^|[ \n])@[[:alnum:]]+([ \n.]|$)")
+var re_quickmention = regexp.MustCompile("(^|[ \n])@[[:alnum:]]+([ \n.,']|$)")
func quickrename(s string, userid int64) string {
nonstop := true
@@ -472,7 +471,8 @@ func quickrename(s string, userid int64) string {
prefix += "@"
m = m[1:]
tail := ""
- if last := m[len(m)-1]; last == ' ' || last == '\n' || last == '.' {
+ if last := m[len(m)-1]; last == ' ' || last == '\n' ||
+ last == '.' || last == ',' || last == '\'' {
tail = m[len(m)-1:]
m = m[:len(m)-1]
}
@@ -643,7 +643,7 @@ var zaggies = cache.New(cache.Options{Filler: func(keyname string) (httpsig.Publ
data := getxonker(keyname, "pubkey")
if data == "" {
dlog.Printf("hitting the webs for missing pubkey: %s", keyname)
- j, err := GetJunk(serverUID, keyname)
+ j, err := GetJunk(readyLuserOne, keyname)
if err != nil {
ilog.Printf("error getting %s pubkey: %s", keyname, err)
when := time.Now().UTC().Format(dbtimeformat)
diff --git a/go.mod b/go.mod
index d866adc..0a68829 100644
--- a/go.mod
+++ b/go.mod
@@ -9,5 +9,5 @@ require (
golang.org/x/crypto v0.0.0-20220411220226-7b82a4e95df4
golang.org/x/net v0.0.0-20220425223048-2871e0cb64e4
humungus.tedunangst.com/r/go-sqlite3 v1.1.3
- humungus.tedunangst.com/r/webs v0.6.59
+ humungus.tedunangst.com/r/webs v0.6.60
)
diff --git a/go.sum b/go.sum
index 1d7a565..20e6043 100644
--- a/go.sum
+++ b/go.sum
@@ -25,5 +25,5 @@ golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ=
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
humungus.tedunangst.com/r/go-sqlite3 v1.1.3 h1:G2N4wzDS0NbuvrZtQJhh4F+3X+s7BF8b9ga8k38geUI=
humungus.tedunangst.com/r/go-sqlite3 v1.1.3/go.mod h1:FtEEmQM7U2Ey1TuEEOyY1BmphTZnmiEjPsNLEAkpf/M=
-humungus.tedunangst.com/r/webs v0.6.59 h1:zOlBGZqrRo22QND1CN8HbhEv3JwoiZkspi7TgVuJS0s=
-humungus.tedunangst.com/r/webs v0.6.59/go.mod h1:03R0N9BcT49HB4TDd1YmarpbiPvPzVDm74Mk4h1hYPc=
+humungus.tedunangst.com/r/webs v0.6.60 h1:2PjVTVH3js4PXv8lrEw7nxtRmwwt1COl7t7tZMPxBPs=
+humungus.tedunangst.com/r/webs v0.6.60/go.mod h1:03R0N9BcT49HB4TDd1YmarpbiPvPzVDm74Mk4h1hYPc=
diff --git a/hfcs.go b/hfcs.go
index 610cef2..2277b8a 100644
--- a/hfcs.go
+++ b/hfcs.go
@@ -107,7 +107,7 @@ func filtcachefiller(userid int64) (afiltermap, bool) {
expflush = filt.Expiration
}
}
- if t := filt.Text; t != "" {
+ if t := filt.Text; t != "" && t != "." {
wordfront := t[0] != '#'
wordtail := true
t = "(?i:" + t + ")"
@@ -314,7 +314,7 @@ func matchfilterX(h *Honk, f *Filter) string {
rv += " announce"
}
}
- if match && f.Text != "" {
+ if match && f.Text != "" && f.Text != "." {
match = false
re := f.re_text
m := re.FindString(h.Precis)
@@ -334,6 +334,13 @@ func matchfilterX(h *Honk, f *Filter) string {
rv = m
}
}
+ if match && f.Text == "." {
+ match = false
+ if h.Precis != "" {
+ match = true
+ rv = h.Precis
+ }
+ }
if match {
return rv
}
diff --git a/honk.go b/honk.go
index e000e21..1898085 100644
--- a/honk.go
+++ b/honk.go
@@ -51,16 +51,16 @@ type WhatAbout struct {
}
type UserOptions struct {
- SkinnyCSS bool `json:",omitempty"`
- OmitImages bool `json:",omitempty"`
- Avahex bool `json:",omitempty"`
- MentionAll bool `json:",omitempty"`
- Avatar string `json:",omitempty"`
- Banner string `json:",omitempty"`
- MapLink string `json:",omitempty"`
- Reaction string `json:",omitempty"`
- MeCount int64
- ChatCount int64
+ SkinnyCSS bool `json:",omitempty"`
+ OmitImages bool `json:",omitempty"`
+ MentionAll bool `json:",omitempty"`
+ InlineQuotes bool `json:",omitempty"`
+ Avatar string `json:",omitempty"`
+ Banner string `json:",omitempty"`
+ MapLink string `json:",omitempty"`
+ Reaction string `json:",omitempty"`
+ MeCount int64
+ ChatCount int64
}
type KeyInfo struct {
@@ -69,6 +69,7 @@ type KeyInfo struct {
}
const serverUID int64 = -2
+const readyLuserOne int64 = 1
type Honk struct {
ID int64
@@ -103,8 +104,6 @@ type Honk struct {
Time *Time
Mentions []Mention
Badonks []Badonk
- Wonkles string
- Guesses template.HTML
}
type Badonk struct {
@@ -179,10 +178,6 @@ func (honk *Honk) IsReacted() bool {
return honk.Flags&flagIsReacted != 0
}
-func (honk *Honk) IsWonked() bool {
- return honk.Flags&flagIsWonked != 0
-}
-
type Donk struct {
FileID int64
XID string
diff --git a/views/about.html b/views/about.html
index 3e6e6d2..65bae2e 100644
--- a/views/about.html
+++ b/views/about.html
@@ -3,12 +3,12 @@
{{ .AboutMsg }}
-
+
-version: | {{ .HonkVersion }}
- |
memory: | {{ printf "%.02f" .Sensors.Memory }}MB
- |
uptime: | {{ printf "%.02f" .Sensors.Uptime }}s
- |
cputime: | {{ printf "%.02f" .Sensors.CPU }}s
+ |
version: | {{ .HonkVersion }}
+ |
memory: | {{ printf "%.02f" .Sensors.Memory }}MB
+ |
uptime: | {{ printf "%.02f" .Sensors.Uptime }}s
+ |
cputime: | {{ printf "%.02f" .Sensors.CPU }}s
|
diff --git a/views/account.html b/views/account.html
index 523edca..4232b87 100644
--- a/views/account.html
+++ b/views/account.html
@@ -10,13 +10,12 @@
-
-
-
+
+
diff --git a/views/chatter.html b/views/chatter.html
index 46cd451..c1ce4ee 100644
--- a/views/chatter.html
+++ b/views/chatter.html
@@ -1,4 +1,5 @@
{{ template "header.html" . }}
+
{{ $chonkcsrf := .ChonkCSRF }}
{{ range .Chatter }}
@@ -59,7 +54,7 @@ chatter: {{ .Target }}
-
+
{{ end }}
diff --git a/views/combos.html b/views/combos.html
index 2d6650c..5a4362b 100644
--- a/views/combos.html
+++ b/views/combos.html
@@ -6,7 +6,7 @@
{{ range .Combos }}
{{ end }}
diff --git a/views/emus.html b/views/emus.html
new file mode 100644
index 0000000..4e45dc4
--- /dev/null
+++ b/views/emus.html
@@ -0,0 +1 @@
+{{ range .Emus }}{{ end }}
diff --git a/views/header.html b/views/header.html
index 305e40c..8792e36 100644
--- a/views/header.html
+++ b/views/header.html
@@ -6,14 +6,11 @@
{{ if .LocalStyleParam }}
{{ end }}
-
-
+