From a32b9fe723c633cf5349bb0479d97e1f6d04445d Mon Sep 17 00:00:00 2001 From: Melonai Date: Fri, 10 Sep 2021 23:40:49 +0200 Subject: Refactor path into destination --- handlers/portgate.go | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'handlers/portgate.go') diff --git a/handlers/portgate.go b/handlers/portgate.go index 6e002e7..2cf8e13 100644 --- a/handlers/portgate.go +++ b/handlers/portgate.go @@ -1,16 +1,18 @@ package handlers import ( - "github.com/valyala/fasthttp" "net/http" "portgate" + "strings" "time" + + "github.com/valyala/fasthttp" ) // handlePortgateRequest handles all Portgate specific request for either showing Portgate // specific pages or handling creation of authorization tokens. -func (h *RequestHandler) handlePortgateRequest(ctx *fasthttp.RequestCtx, path portgate.Path) { - if path.IsPortgateStaticPath() { +func (h *RequestHandler) handlePortgateRequest(ctx *fasthttp.RequestCtx, destination portgate.Destination) { + if strings.HasPrefix(destination.Path, "/_portgate/static") { h.staticHandler(ctx) } else { // TODO: Implement authentication, authorization -- cgit 1.4.1