From f41ea45eaa317196be18e45c1fd5ed0d1140955d Mon Sep 17 00:00:00 2001 From: cdle Date: Sun, 11 Jun 2023 15:07:31 +0800 Subject: [PATCH] x --- core/plugin_subscribe.go | 9 --------- core/web.go | 18 ++++++++++++++++++ 2 files changed, 18 insertions(+), 9 deletions(-) diff --git a/core/plugin_subscribe.go b/core/plugin_subscribe.go index 534a66d..f0bea30 100644 --- a/core/plugin_subscribe.go +++ b/core/plugin_subscribe.go @@ -110,15 +110,6 @@ func initWebPluginList() { plugin_subcribe_addresses = new return nil }) - GinApi(GET, "/api/plugins/download", func(c *gin.Context) { - uuid := c.Query("uuid") - for _, f := range Functions { - if f.UUID == uuid && f.Public { - c.String(200, publicScript(plugins.GetString(f.UUID))) - return - } - } - }) GinApi(GET, "/api/plugins/list.json", func(ctx *gin.Context) { current := utils.Int(ctx.Query("current")) pageSize := utils.Int(ctx.Query("pageSize")) diff --git a/core/web.go b/core/web.go index e9883ad..dd12ce3 100644 --- a/core/web.go +++ b/core/web.go @@ -66,6 +66,24 @@ func init() { Server.Use(gzip.Gzip(gzip.DefaultCompression)) Server.GET("/api/file/:filename", FindFile) Server.GET("/api/decode/:random", Base642Binary) + Server.GET("/api/plugins/download", func(c *gin.Context) { + uuid := c.Query("uuid") + for _, f := range Functions { + if f.UUID == uuid && f.Public { + c.String(200, publicScript(plugins.GetString(f.UUID))) + return + } + } + }) + Server.GET("/api/plugins/download/:uuid", func(c *gin.Context) { + uuid := c.Param("uuid") + for _, f := range Functions { + if f.UUID == uuid && f.Public { + c.String(200, publicScript(plugins.GetString(f.UUID))) + return + } + } + }) Server.NoRoute(func(c *gin.Context) { if c.Request.URL.Path != "/api/web_chat" { logs.Debug(c.Request.URL.Path)