allow submitting preformatted html honks

This commit is contained in:
Ted Unangst 2020-02-04 13:23:43 -05:00
parent 94e45ae56f
commit 85801689a0
2 changed files with 15 additions and 3 deletions

View File

@ -70,7 +70,11 @@ value should be
The following values are recognized: The following values are recognized:
.Bl -tag -width placename .Bl -tag -width placename
.It Fa noise .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 .It Fa donk
A file to attach. A file to attach.
.It Fa donkdesc .It Fa donkdesc

12
web.go
View File

@ -1433,6 +1433,14 @@ func submitwebhonk(w http.ResponseWriter, r *http.Request) {
func submithonk(w http.ResponseWriter, r *http.Request, isAPI bool) { func submithonk(w http.ResponseWriter, r *http.Request, isAPI bool) {
rid := r.FormValue("rid") rid := r.FormValue("rid")
noise := r.FormValue("noise") 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) userinfo := login.GetUserInfo(r)
user, _ := butwhatabout(userinfo.Username) user, _ := butwhatabout(userinfo.Username)
@ -1448,7 +1456,7 @@ func submithonk(w http.ResponseWriter, r *http.Request, isAPI bool) {
} }
honk.Date = dt honk.Date = dt
honk.What = "update" honk.What = "update"
honk.Format = "markdown" honk.Format = format
} else { } else {
xid := fmt.Sprintf("%s/%s/%s", user.URL, honkSep, xfiltrate()) xid := fmt.Sprintf("%s/%s/%s", user.URL, honkSep, xfiltrate())
what := "honk" what := "honk"
@ -1462,7 +1470,7 @@ func submithonk(w http.ResponseWriter, r *http.Request, isAPI bool) {
Honker: user.URL, Honker: user.URL,
XID: xid, XID: xid,
Date: dt, Date: dt,
Format: "markdown", Format: format,
} }
} }