summaryrefslogtreecommitdiff
path: root/srv/src/http/api.go
diff options
context:
space:
mode:
Diffstat (limited to 'srv/src/http/api.go')
-rw-r--r--srv/src/http/api.go19
1 files changed, 17 insertions, 2 deletions
diff --git a/srv/src/http/api.go b/srv/src/http/api.go
index 4ba6450..eb7990f 100644
--- a/srv/src/http/api.go
+++ b/srv/src/http/api.go
@@ -37,6 +37,7 @@ type Params struct {
PostStore post.Store
PostAssetStore post.AssetStore
+ PostDraftStore post.DraftStore
MailingList mailinglist.MailingList
@@ -201,8 +202,8 @@ func (a *api) blogHandler() http.Handler {
mux.Handle("/posts/", http.StripPrefix("/posts",
apiutil.MethodMux(map[string]http.Handler{
"GET": a.renderPostHandler(),
- "POST": a.postPostHandler(),
- "DELETE": a.deletePostHandler(),
+ "POST": a.postPostHandler(false),
+ "DELETE": a.deletePostHandler(false),
"PREVIEW": a.previewPostHandler(),
}),
))
@@ -215,6 +216,20 @@ func (a *api) blogHandler() http.Handler {
}),
))
+ mux.Handle("/drafts/", http.StripPrefix("/drafts",
+
+ // everything to do with drafts is protected
+ authMiddleware(a.auther)(
+
+ apiutil.MethodMux(map[string]http.Handler{
+ "GET": a.renderDraftPostHandler(),
+ "POST": a.postPostHandler(true),
+ "DELETE": a.deletePostHandler(true),
+ "PREVIEW": a.previewPostHandler(),
+ }),
+ ),
+ ))
+
mux.Handle("/static/", http.FileServer(http.FS(staticFS)))
mux.Handle("/follow", a.renderDumbTplHandler("follow.html"))
mux.Handle("/admin", a.renderDumbTplHandler("admin.html"))