From b4e6281c5cb72a93e033b417a690e55132dbb284 Mon Sep 17 00:00:00 2001 From: nikk gitanes Date: Fri, 12 Apr 2024 05:12:51 +0300 Subject: [PATCH] cosmetics --- server/docs/docs.go | 6 ++-- server/docs/swagger.json | 6 ++-- server/docs/swagger.yaml | 2 -- server/web/api/stream.go | 13 +++++--- server/web/pages/template/html.go | 20 ++++++------ .../pages/template/pages/asset-manifest.json | 14 ++++---- server/web/pages/template/pages/index.html | 2 +- server/web/pages/template/route.go | 32 +++++++++---------- 8 files changed, 46 insertions(+), 49 deletions(-) diff --git a/server/docs/docs.go b/server/docs/docs.go index 39905ff..b168c30 100644 --- a/server/docs/docs.go +++ b/server/docs/docs.go @@ -466,15 +466,13 @@ const docTemplate = `{ "type": "string", "description": "Set title of torrent", "name": "title", - "in": "query", - "required": true + "in": "query" }, { "type": "string", "description": "Set poster link of torrent", "name": "poster", - "in": "query", - "required": true + "in": "query" }, { "type": "string", diff --git a/server/docs/swagger.json b/server/docs/swagger.json index 01840cc..984a495 100644 --- a/server/docs/swagger.json +++ b/server/docs/swagger.json @@ -459,15 +459,13 @@ "type": "string", "description": "Set title of torrent", "name": "title", - "in": "query", - "required": true + "in": "query" }, { "type": "string", "description": "Set poster link of torrent", "name": "poster", - "in": "query", - "required": true + "in": "query" }, { "type": "string", diff --git a/server/docs/swagger.yaml b/server/docs/swagger.yaml index 553faed..1c22d04 100644 --- a/server/docs/swagger.yaml +++ b/server/docs/swagger.yaml @@ -603,12 +603,10 @@ paths: - description: Set title of torrent in: query name: title - required: true type: string - description: Set poster link of torrent in: query name: poster - required: true type: string - description: 'Set category of torrent, used in web: movie, tv, music, other' in: query diff --git a/server/web/api/stream.go b/server/web/api/stream.go index b87f70f..189a698 100644 --- a/server/web/api/stream.go +++ b/server/web/api/stream.go @@ -43,8 +43,8 @@ import ( // @Param m3u query string false "Get torrent as M3U playlist" // @Param fromlast query string false "Get M3U from last played file" // @Param play query string false "Start stream torrent" -// @Param title query string true "Set title of torrent" -// @Param poster query string true "Set poster link of torrent" +// @Param title query string false "Set title of torrent" +// @Param poster query string false "Set poster link of torrent" // @Param category query string false "Set category of torrent, used in web: movie, tv, music, other" // // @Produce application/octet-stream @@ -61,9 +61,10 @@ func stream(c *gin.Context) { _, play := c.GetQuery("play") title := c.Query("title") poster := c.Query("poster") - category, _ := c.GetQuery("category") + category := c.Query("category") data := "" + notAuth := c.GetBool("auth_required") && c.GetString(gin.AuthUserKey) == "" if notAuth && (play || m3u) { @@ -81,9 +82,10 @@ func stream(c *gin.Context) { return } - title, _ = url.QueryUnescape(title) link, _ = url.QueryUnescape(link) + title, _ = url.QueryUnescape(title) poster, _ = url.QueryUnescape(poster) + category, _ = url.QueryUnescape(category) spec, err := utils.ParseLink(link) if err != nil { @@ -172,9 +174,10 @@ func streamNoAuth(c *gin.Context) { _, play := c.GetQuery("play") title := c.Query("title") poster := c.Query("poster") - data := "" category := c.Query("category") + data := "" + if link == "" { c.AbortWithError(http.StatusBadRequest, errors.New("link should not be empty")) return diff --git a/server/web/pages/template/html.go b/server/web/pages/template/html.go index 4ba1c2b..c5d2ef9 100644 --- a/server/web/pages/template/html.go +++ b/server/web/pages/template/html.go @@ -118,20 +118,20 @@ var Mstile150x150png []byte //go:embed pages/site.webmanifest var Sitewebmanifest []byte -//go:embed pages/static/js/2.63f74d95.chunk.js -var Staticjs263f74d95chunkjs []byte +//go:embed pages/static/js/2.15e75e72.chunk.js +var Staticjs215e75e72chunkjs []byte -//go:embed pages/static/js/2.63f74d95.chunk.js.LICENSE.txt -var Staticjs263f74d95chunkjsLICENSEtxt []byte +//go:embed pages/static/js/2.15e75e72.chunk.js.LICENSE.txt +var Staticjs215e75e72chunkjsLICENSEtxt []byte -//go:embed pages/static/js/2.63f74d95.chunk.js.map -var Staticjs263f74d95chunkjsmap []byte +//go:embed pages/static/js/2.15e75e72.chunk.js.map +var Staticjs215e75e72chunkjsmap []byte -//go:embed pages/static/js/main.96201d04.chunk.js -var Staticjsmain96201d04chunkjs []byte +//go:embed pages/static/js/main.714fb205.chunk.js +var Staticjsmain714fb205chunkjs []byte -//go:embed pages/static/js/main.96201d04.chunk.js.map -var Staticjsmain96201d04chunkjsmap []byte +//go:embed pages/static/js/main.714fb205.chunk.js.map +var Staticjsmain714fb205chunkjsmap []byte //go:embed pages/static/js/runtime-main.f542387e.js var Staticjsruntimemainf542387ejs []byte diff --git a/server/web/pages/template/pages/asset-manifest.json b/server/web/pages/template/pages/asset-manifest.json index 500b879..9178360 100644 --- a/server/web/pages/template/pages/asset-manifest.json +++ b/server/web/pages/template/pages/asset-manifest.json @@ -1,17 +1,17 @@ { "files": { - "main.js": "/static/js/main.96201d04.chunk.js", - "main.js.map": "/static/js/main.96201d04.chunk.js.map", + "main.js": "/static/js/main.714fb205.chunk.js", + "main.js.map": "/static/js/main.714fb205.chunk.js.map", "runtime-main.js": "/static/js/runtime-main.f542387e.js", "runtime-main.js.map": "/static/js/runtime-main.f542387e.js.map", - "static/js/2.63f74d95.chunk.js": "/static/js/2.63f74d95.chunk.js", - "static/js/2.63f74d95.chunk.js.map": "/static/js/2.63f74d95.chunk.js.map", + "static/js/2.15e75e72.chunk.js": "/static/js/2.15e75e72.chunk.js", + "static/js/2.15e75e72.chunk.js.map": "/static/js/2.15e75e72.chunk.js.map", "index.html": "/index.html", - "static/js/2.63f74d95.chunk.js.LICENSE.txt": "/static/js/2.63f74d95.chunk.js.LICENSE.txt" + "static/js/2.15e75e72.chunk.js.LICENSE.txt": "/static/js/2.15e75e72.chunk.js.LICENSE.txt" }, "entrypoints": [ "static/js/runtime-main.f542387e.js", - "static/js/2.63f74d95.chunk.js", - "static/js/main.96201d04.chunk.js" + "static/js/2.15e75e72.chunk.js", + "static/js/main.714fb205.chunk.js" ] } \ No newline at end of file diff --git a/server/web/pages/template/pages/index.html b/server/web/pages/template/pages/index.html index 5146d95..bff22bd 100644 --- a/server/web/pages/template/pages/index.html +++ b/server/web/pages/template/pages/index.html @@ -1 +1 @@ -TorrServer MatriX
\ No newline at end of file +TorrServer MatriX
\ No newline at end of file diff --git a/server/web/pages/template/route.go b/server/web/pages/template/route.go index 040b768..c05523a 100644 --- a/server/web/pages/template/route.go +++ b/server/web/pages/template/route.go @@ -280,46 +280,46 @@ func RouteWebPages(route gin.IRouter) { c.Data(200, "application/manifest+json", Sitewebmanifest) }) - route.GET("/static/js/2.63f74d95.chunk.js", func(c *gin.Context) { - etag := fmt.Sprintf("%x", md5.Sum(Staticjs263f74d95chunkjs)) + route.GET("/static/js/2.15e75e72.chunk.js", func(c *gin.Context) { + etag := fmt.Sprintf("%x", md5.Sum(Staticjs215e75e72chunkjs)) c.Header("Cache-Control", "public, max-age=31536000") c.Header("ETag", etag) - c.Data(200, "text/javascript; charset=utf-8", Staticjs263f74d95chunkjs) + c.Data(200, "application/javascript; charset=utf-8", Staticjs215e75e72chunkjs) }) - route.GET("/static/js/2.63f74d95.chunk.js.LICENSE.txt", func(c *gin.Context) { - etag := fmt.Sprintf("%x", md5.Sum(Staticjs263f74d95chunkjsLICENSEtxt)) + route.GET("/static/js/2.15e75e72.chunk.js.LICENSE.txt", func(c *gin.Context) { + etag := fmt.Sprintf("%x", md5.Sum(Staticjs215e75e72chunkjsLICENSEtxt)) c.Header("Cache-Control", "public, max-age=31536000") c.Header("ETag", etag) - c.Data(200, "text/plain; charset=utf-8", Staticjs263f74d95chunkjsLICENSEtxt) + c.Data(200, "text/plain; charset=utf-8", Staticjs215e75e72chunkjsLICENSEtxt) }) - route.GET("/static/js/2.63f74d95.chunk.js.map", func(c *gin.Context) { - etag := fmt.Sprintf("%x", md5.Sum(Staticjs263f74d95chunkjsmap)) + route.GET("/static/js/2.15e75e72.chunk.js.map", func(c *gin.Context) { + etag := fmt.Sprintf("%x", md5.Sum(Staticjs215e75e72chunkjsmap)) c.Header("Cache-Control", "public, max-age=31536000") c.Header("ETag", etag) - c.Data(200, "application/json", Staticjs263f74d95chunkjsmap) + c.Data(200, "application/json", Staticjs215e75e72chunkjsmap) }) - route.GET("/static/js/main.96201d04.chunk.js", func(c *gin.Context) { - etag := fmt.Sprintf("%x", md5.Sum(Staticjsmain96201d04chunkjs)) + route.GET("/static/js/main.714fb205.chunk.js", func(c *gin.Context) { + etag := fmt.Sprintf("%x", md5.Sum(Staticjsmain714fb205chunkjs)) c.Header("Cache-Control", "public, max-age=31536000") c.Header("ETag", etag) - c.Data(200, "text/javascript; charset=utf-8", Staticjsmain96201d04chunkjs) + c.Data(200, "application/javascript; charset=utf-8", Staticjsmain714fb205chunkjs) }) - route.GET("/static/js/main.96201d04.chunk.js.map", func(c *gin.Context) { - etag := fmt.Sprintf("%x", md5.Sum(Staticjsmain96201d04chunkjsmap)) + route.GET("/static/js/main.714fb205.chunk.js.map", func(c *gin.Context) { + etag := fmt.Sprintf("%x", md5.Sum(Staticjsmain714fb205chunkjsmap)) c.Header("Cache-Control", "public, max-age=31536000") c.Header("ETag", etag) - c.Data(200, "application/json", Staticjsmain96201d04chunkjsmap) + c.Data(200, "application/json", Staticjsmain714fb205chunkjsmap) }) route.GET("/static/js/runtime-main.f542387e.js", func(c *gin.Context) { etag := fmt.Sprintf("%x", md5.Sum(Staticjsruntimemainf542387ejs)) c.Header("Cache-Control", "public, max-age=31536000") c.Header("ETag", etag) - c.Data(200, "text/javascript; charset=utf-8", Staticjsruntimemainf542387ejs) + c.Data(200, "application/javascript; charset=utf-8", Staticjsruntimemainf542387ejs) }) route.GET("/static/js/runtime-main.f542387e.js.map", func(c *gin.Context) {