summaryrefslogtreecommitdiff
path: root/src/http/http.go
diff options
context:
space:
mode:
Diffstat (limited to 'src/http/http.go')
-rw-r--r--src/http/http.go35
1 files changed, 2 insertions, 33 deletions
diff --git a/src/http/http.go b/src/http/http.go
index ba81577..4b98d2b 100644
--- a/src/http/http.go
+++ b/src/http/http.go
@@ -18,10 +18,8 @@ import (
"github.com/mediocregopher/blog.mediocregopher.com/srv/cache"
"github.com/mediocregopher/blog.mediocregopher.com/srv/cfg"
"github.com/mediocregopher/blog.mediocregopher.com/srv/http/apiutil"
- "github.com/mediocregopher/blog.mediocregopher.com/srv/mailinglist"
"github.com/mediocregopher/blog.mediocregopher.com/srv/post"
"github.com/mediocregopher/blog.mediocregopher.com/srv/post/asset"
- "github.com/mediocregopher/blog.mediocregopher.com/srv/pow"
"github.com/mediocregopher/mediocre-go-lib/v2/mctx"
"github.com/mediocregopher/mediocre-go-lib/v2/mlog"
)
@@ -32,17 +30,14 @@ var staticFS embed.FS
// Params are used to instantiate a new API instance. All fields are required
// unless otherwise noted.
type Params struct {
- Logger *mlog.Logger
- PowManager pow.Manager
- Cache cache.Cache
+ Logger *mlog.Logger
+ Cache cache.Cache
PostStore post.Store
PostAssetStore asset.Store
PostAssetLoader asset.Loader
PostDraftStore post.DraftStore
- MailingList mailinglist.MailingList
-
// PublicURL is the base URL which site visitors can navigate to.
PublicURL *url.URL
@@ -176,25 +171,6 @@ func (a *api) Shutdown(ctx context.Context) error {
return nil
}
-func (a *api) apiHandler() http.Handler {
- mux := http.NewServeMux()
-
- mux.Handle("/pow/challenge", a.newPowChallengeHandler())
- mux.Handle("/pow/check",
- a.requirePowMiddleware(
- http.HandlerFunc(func(rw http.ResponseWriter, r *http.Request) {}),
- ),
- )
-
- mux.Handle("/mailinglist/subscribe", a.requirePowMiddleware(a.mailingListSubscribeHandler()))
- mux.Handle("/mailinglist/finalize", a.mailingListFinalizeHandler())
- mux.Handle("/mailinglist/unsubscribe", a.mailingListUnsubscribeHandler())
-
- return apiutil.MethodMux(map[string]http.Handler{
- "POST": mux,
- })
-}
-
func (a *api) blogHandler() http.Handler {
mux := http.NewServeMux()
@@ -237,8 +213,6 @@ func (a *api) blogHandler() http.Handler {
mux.Handle("/static/", http.FileServer(http.FS(staticFS)))
mux.Handle("/follow", a.renderDumbTplHandler("follow.html"))
mux.Handle("/admin", a.renderDumbTplHandler("admin.html"))
- mux.Handle("/mailinglist/unsubscribe", a.renderDumbTplHandler("unsubscribe.html"))
- mux.Handle("/mailinglist/finalize", a.renderDumbTplHandler("finalize.html"))
mux.Handle("/feed.xml", a.renderFeedHandler())
mux.Handle("/", a.renderIndexHandler())
@@ -266,11 +240,6 @@ func (a *api) handler() http.Handler {
mux := http.NewServeMux()
- mux.Handle("/api/", applyMiddlewares(
- http.StripPrefix("/api", a.apiHandler()),
- logReqMiddleware,
- ))
-
mux.Handle("/", a.blogHandler())
noCacheMiddleware := addResponseHeadersMiddleware(map[string]string{