From 4165afec9108267baec85197fe0f2b50a0b425b2 Mon Sep 17 00:00:00 2001 From: damiva <96115589+damiva@users.noreply.github.com> Date: Mon, 27 May 2024 23:14:01 +0300 Subject: [PATCH] Update MSX - hidden bug fixed (#410) * Update msx.go * Update msx.go --- server/web/msx/msx.go | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/server/web/msx/msx.go b/server/web/msx/msx.go index b29cffd..b797209 100644 --- a/server/web/msx/msx.go +++ b/server/web/msx/msx.go @@ -8,6 +8,7 @@ import ( "path" "strconv" "strings" + "time" "server/settings" "server/torr" @@ -29,7 +30,7 @@ const ( + htmlE = `"> ` @@ -57,8 +58,9 @@ func SetupRoute(r gin.IRouter) { case "torrent": torrent(c) default: - if !strings.HasSuffix(p, "/") && path.Ext(p) == "" { - c.Data(200, "text/html;charset=UTF-8", append(append(append([]byte(htmlB), base...), p...), htmlE...)) + if p != "" && !strings.HasSuffix(p, "/") && path.Ext(p) == "" { + p = base + p + `.js?t=` + strconv.FormatInt(time.Now().Unix(), 16) + c.Data(200, "text/html;charset=UTF-8", append(append([]byte(htmlB), p...), htmlE...)) } else { proxy(c, base+p) } @@ -193,7 +195,7 @@ func torrent(c *gin.Context) { response(c, map[string]any{"action": j.Data, "data": map[string]any{ "stamp": st, "stampColor": sc, "live": map[string]any{ "type": "airtime", "duration": 1000, "over": map[string]any{ - "action": "execute:" + utils.GetScheme(c) + c.Request.Host + c.Request.URL.Path, "data": j.Data, + "action": "execute:" + utils.GetScheme(c) + "://" + c.Request.Host + c.Request.URL.Path, "data": j.Data, }, }, }})