summary refs log tree commit diff
path: root/handlers/portgate.go
diff options
context:
space:
mode:
authorMelonai <einebeere@gmail.com>2021-09-10 23:40:49 +0200
committerMelonai <einebeere@gmail.com>2021-09-10 23:43:57 +0200
commita32b9fe723c633cf5349bb0479d97e1f6d04445d (patch)
treef45869da615f5efcd0b2dd8d1baade6831dd3f4f /handlers/portgate.go
parent175da8f22cd791e81338fe61e6099125868cf5a0 (diff)
downloadportgate-a32b9fe723c633cf5349bb0479d97e1f6d04445d.tar.zst
portgate-a32b9fe723c633cf5349bb0479d97e1f6d04445d.zip
Refactor path into destination
Diffstat (limited to 'handlers/portgate.go')
-rw-r--r--handlers/portgate.go8
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