From 4c04177c05355ddb92d3d31a4c5cfbaa86555a13 Mon Sep 17 00:00:00 2001 From: Brian Picciano Date: Sat, 14 May 2022 16:14:11 -0600 Subject: Move template rendering logic into api package --- srv/src/api/pow.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'srv/src/api/pow.go') diff --git a/srv/src/api/pow.go b/srv/src/api/pow.go index 1b232b1..ae2d2f1 100644 --- a/srv/src/api/pow.go +++ b/srv/src/api/pow.go @@ -6,7 +6,7 @@ import ( "fmt" "net/http" - "github.com/mediocregopher/blog.mediocregopher.com/srv/api/apiutils" + "github.com/mediocregopher/blog.mediocregopher.com/srv/api/apiutil" ) func (a *api) newPowChallengeHandler() http.Handler { @@ -14,7 +14,7 @@ func (a *api) newPowChallengeHandler() http.Handler { challenge := a.params.PowManager.NewChallenge() - apiutils.JSONResult(rw, r, struct { + apiutil.JSONResult(rw, r, struct { Seed string `json:"seed"` Target uint32 `json:"target"` }{ @@ -30,21 +30,21 @@ func (a *api) requirePowMiddleware(h http.Handler) http.Handler { seedHex := r.FormValue("powSeed") seed, err := hex.DecodeString(seedHex) if err != nil || len(seed) == 0 { - apiutils.BadRequest(rw, r, errors.New("invalid powSeed")) + apiutil.BadRequest(rw, r, errors.New("invalid powSeed")) return } solutionHex := r.FormValue("powSolution") solution, err := hex.DecodeString(solutionHex) if err != nil || len(seed) == 0 { - apiutils.BadRequest(rw, r, errors.New("invalid powSolution")) + apiutil.BadRequest(rw, r, errors.New("invalid powSolution")) return } err = a.params.PowManager.CheckSolution(seed, solution) if err != nil { - apiutils.BadRequest(rw, r, fmt.Errorf("checking proof-of-work solution: %w", err)) + apiutil.BadRequest(rw, r, fmt.Errorf("checking proof-of-work solution: %w", err)) return } -- cgit v1.2.3