diff options
author | Brian Picciano <mediocregopher@gmail.com> | 2022-08-18 23:07:09 -0600 |
---|---|---|
committer | Brian Picciano <mediocregopher@gmail.com> | 2022-08-18 23:07:09 -0600 |
commit | c3135306b32e3ee18c3c412fbb2ea81b455201d5 (patch) | |
tree | f7dd21fc9e0bab9b06a713a8218e52be777f1b15 /srv/src/http/api.go | |
parent | dfa9bcb9e23b10bb28973d1d27f05e04e8638320 (diff) |
drafts functionality added, needs a publish button still
Diffstat (limited to 'srv/src/http/api.go')
-rw-r--r-- | srv/src/http/api.go | 19 |
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")) |