func (t *thumb) Get(ctxt *websrv.Context) { png, err := db.Thumb(t.Doc, t.Page, t.DPI) if err != nil { panic(err) } ctxt.Write(png) }
func sendJson(ctxt *websrv.Context, obj interface{}) { data, err := json.Marshal(obj) if err != nil { panic(err) } ctxt.Header().Set("Content-Type", "application/json") ctxt.Write(data) }
func (req *editRequest) Post(ctxt *websrv.Context) { doc := req.Doc fmt.Println(ctxt.Request.Form) doc.Time = req.Time.Parsed if doc.Time.IsZero() { doc.Time = doc.Created } doc.Due = req.Due.Parsed doc.Tags = req.Tags doc.Desc = req.Desc doc.Text = req.Text doc.Location = req.Location if err := db.Write(doc); err != nil { panic(err) } ctxt.Redirect("/scan/doc/" + strconv.FormatInt(req.Doc.ID, 10)) }
func (s *showPDF) Get(ctxt *websrv.Context) { ctxt.ServeFile(filepath.Join(*dir, s.Doc.File)) }