From 930c57551f14dbf94fc23dfddbbe9d38b0dbbf50 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=82=A5=E7=BE=8A?= Date: Fri, 2 Jun 2023 21:51:57 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=94=B9=E8=8E=B7=E5=8F=96=E9=93=BE?= =?UTF-8?q?=E6=8E=A5=E6=96=B9=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Dockerfile | 3 +-- Golang/main.go | 10 ++++------ 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/Dockerfile b/Dockerfile index ce4c322..76136c3 100644 --- a/Dockerfile +++ b/Dockerfile @@ -17,6 +17,5 @@ FROM alpine:3.14 COPY --from=build /allinone /allinone EXPOSE 35455 -ENV LIVE_PREFIX=https://www.goodiptv.club -CMD [ "/allinone" ] +CMD [ "/allinone" ] \ No newline at end of file diff --git a/Golang/main.go b/Golang/main.go index a345e62..b569412 100644 --- a/Golang/main.go +++ b/Golang/main.go @@ -16,8 +16,8 @@ import ( "github.com/forgoer/openssl" "github.com/gin-gonic/gin" "net/http" + "net/url" "strconv" - "os" ) func duanyan(adurl string, realurl any) string { @@ -31,11 +31,9 @@ func duanyan(adurl string, realurl any) string { } func getLivePrefix(c *gin.Context) string { - prefix := os.Getenv("LIVE_PREFIX") - if len(prefix) > 0 { - return prefix - } - return fmt.Sprintf("http://%s", c.Request.Host) + firstUrl := c.DefaultQuery("url", "https://www.goodiptv.club") + realUrl, _ := url.QueryUnescape(firstUrl) + return realUrl } func setupRouter(adurl string) *gin.Engine {