Exemple #1
0
func MarkdownPreviewHandler(w http.ResponseWriter, r *http.Request) {
	c := appengine.NewContext(r)

	user := core.AdminUser(c, w)
	if user == nil {
		return
	}

	html := string(blackfriday.MarkdownCommon([]byte(r.FormValue("text"))))
	core.HandleJSON(c, w, map[string]string{"html": html})
}
Exemple #2
0
func ImageUploadURLHandler(w http.ResponseWriter, r *http.Request) {
	c := appengine.NewContext(r)

	imageUploadURL, err := Router.GetRoute("imageUpload").URL()
	if err != nil {
		core.HandleError(c, w, err)
		return
	}

	uploadURL, err := blobstore.UploadURL(c, imageUploadURL.Path, nil)
	if err != nil {
		core.HandleError(c, w, err)
		return
	}

	core.HandleJSON(c, w, map[string]string{"url": uploadURL.Path})
}