Update MSX - hidden bug fixed (#410)

* Update msx.go

* Update msx.go
This commit is contained in:
damiva
2024-05-27 23:14:01 +03:00
committed by GitHub
parent efced45a39
commit 4165afec91

View File

@@ -8,6 +8,7 @@ import (
"path" "path"
"strconv" "strconv"
"strings" "strings"
"time"
"server/settings" "server/settings"
"server/torr" "server/torr"
@@ -29,7 +30,7 @@ const (
<meta name="author" content="damiva" /> <meta name="author" content="damiva" />
<script type="text/javascript" src="http://msx.benzac.de/js/tvx-plugin.min.js"> <script type="text/javascript" src="http://msx.benzac.de/js/tvx-plugin.min.js">
</script><script type="text/javascript" src="` </script><script type="text/javascript" src="`
htmlE = `.js"></script> htmlE = `"></script>
</head> </head>
<body></body> <body></body>
</html>` </html>`
@@ -57,8 +58,9 @@ func SetupRoute(r gin.IRouter) {
case "torrent": case "torrent":
torrent(c) torrent(c)
default: default:
if !strings.HasSuffix(p, "/") && path.Ext(p) == "" { if p != "" && !strings.HasSuffix(p, "/") && path.Ext(p) == "" {
c.Data(200, "text/html;charset=UTF-8", append(append(append([]byte(htmlB), base...), p...), htmlE...)) 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 { } else {
proxy(c, base+p) 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{ response(c, map[string]any{"action": j.Data, "data": map[string]any{
"stamp": st, "stampColor": sc, "live": map[string]any{ "stamp": st, "stampColor": sc, "live": map[string]any{
"type": "airtime", "duration": 1000, "over": 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,
}, },
}, },
}}) }})