mirror of
https://github.com/TeaOSLab/EdgeAdmin.git
synced 2025-11-16 05:30:27 +08:00
编译时生成components.js
This commit is contained in:
@@ -1,11 +1,10 @@
|
||||
package ui
|
||||
|
||||
import (
|
||||
"compress/gzip"
|
||||
"github.com/TeaOSLab/EdgeAdmin/internal/configloaders"
|
||||
"github.com/TeaOSLab/EdgeAdmin/internal/web/helpers"
|
||||
"github.com/iwind/TeaGo"
|
||||
"github.com/iwind/TeaGo/actions"
|
||||
"github.com/iwind/TeaGo/Tea"
|
||||
)
|
||||
|
||||
func init() {
|
||||
@@ -16,11 +15,6 @@ func init() {
|
||||
// 公共可以访问的链接
|
||||
Get("/image/:fileId", new(ImageAction)).
|
||||
|
||||
// 以下的需要压缩
|
||||
Helper(&actions.Gzip{Level: gzip.BestCompression}).
|
||||
Get("/components.js", new(ComponentsAction)).
|
||||
EndHelpers().
|
||||
|
||||
// 以下需要登录
|
||||
Helper(helpers.NewUserMustAuth(configloaders.AdminModuleCodeCommon)).
|
||||
Get("/download", new(DownloadAction)).
|
||||
@@ -31,7 +25,13 @@ func init() {
|
||||
Post("/hideTip", new(HideTipAction)).
|
||||
Post("/theme", new(ThemeAction)).
|
||||
Post("/validateIPs", new(ValidateIPsAction)).
|
||||
|
||||
EndAll()
|
||||
|
||||
// 开发环境下总是动态加载,以便于调试
|
||||
if Tea.IsTesting() {
|
||||
server.
|
||||
Get("/js/components.js", new(ComponentsAction)).
|
||||
EndAll()
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user