diff options
| author | Melonai <einebeere@gmail.com> | 2021-09-10 23:40:49 +0200 |
|---|---|---|
| committer | Melonai <einebeere@gmail.com> | 2021-09-10 23:43:57 +0200 |
| commit | a32b9fe723c633cf5349bb0479d97e1f6d04445d (patch) | |
| tree | f45869da615f5efcd0b2dd8d1baade6831dd3f4f /handlers/portgate.go | |
| parent | 175da8f22cd791e81338fe61e6099125868cf5a0 (diff) | |
| download | portgate-a32b9fe723c633cf5349bb0479d97e1f6d04445d.tar.zst portgate-a32b9fe723c633cf5349bb0479d97e1f6d04445d.zip | |
Refactor path into destination
Diffstat (limited to 'handlers/portgate.go')
| -rw-r--r-- | handlers/portgate.go | 8 |
1 files changed, 5 insertions, 3 deletions
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 |
