all repos — honk @ 2e881e0ae6c88e42ee8b20873efc8878fdf3d420

my fork of honk

allow submitting preformatted html honks
Ted Unangst tedu@tedunangst.com
Tue, 04 Feb 2020 13:23:43 -0500
commit

2e881e0ae6c88e42ee8b20873efc8878fdf3d420

parent

b0025f872b6dcd3ed18eeb91d2bacb102e4e1c53

2 files changed, 15 insertions(+), 3 deletions(-)

jump to
M docs/honk.3docs/honk.3

@@ -70,7 +70,11 @@ .Dq honk .

The following values are recognized: .Bl -tag -width placename .It Fa noise -The contents of the honk in markdown format. +The contents of the honk. +.It fa format +The format of noise. +Defaults to markdown. +May also be html. .It Fa donk A file to attach. .It Fa donkdesc
M web.goweb.go

@@ -1433,6 +1433,14 @@ // what a hot mess this function is

func submithonk(w http.ResponseWriter, r *http.Request, isAPI bool) { rid := r.FormValue("rid") noise := r.FormValue("noise") + format := r.FormValue("format") + if format == "" { + format = "markdown" + } + if !(format == "markdown" || format == "html") { + http.Error(w, "unknown format", 500) + return + } userinfo := login.GetUserInfo(r) user, _ := butwhatabout(userinfo.Username)

@@ -1448,7 +1456,7 @@ return

} honk.Date = dt honk.What = "update" - honk.Format = "markdown" + honk.Format = format } else { xid := fmt.Sprintf("%s/%s/%s", user.URL, honkSep, xfiltrate()) what := "honk"

@@ -1462,7 +1470,7 @@ What: what,

Honker: user.URL, XID: xid, Date: dt, - Format: "markdown", + Format: format, } }