Provide different output methods

git-svn-id: file:///srv/svn/repo/marisa/trunk@45 d6811dac-2434-b64a-9ddc-f563ab233461
This commit is contained in:
dev 2021-10-20 08:34:26 +00:00
parent f9ca51e268
commit ce62e39374

View File

@ -203,11 +203,14 @@ func uploaderPost(w http.ResponseWriter, r *http.Request) {
links = append(links, link)
}
if r.PostFormValue("output") == "html" {
switch r.PostFormValue("output") {
case "html":
data := templatedata{Links: links}
servetemplate(w, "/upload.html", data)
return
} else {
case "json":
data, _ := json.Marshal(links)
w.Write(data)
default:
for _, link := range links {
w.Write([]byte(link + "\r\n"))
}