2
0
mirror of https://github.com/acepanel/panel.git synced 2026-02-04 16:10:59 +08:00

feat: optimize info api

This commit is contained in:
耗子
2024-05-26 14:14:48 +08:00
parent 6e0d93257f
commit de7d50ce51
2 changed files with 5 additions and 10 deletions

View File

@@ -34,18 +34,14 @@ func NewInfoController() *InfoController {
}
}
// Name 获取面板名称
func (r *InfoController) Name(ctx http.Context) http.Response {
// Panel 获取面板信息
func (r *InfoController) Panel(ctx http.Context) http.Response {
return Success(ctx, http.Json{
"name": r.setting.Get(models.SettingKeyName),
"name": r.setting.Get(models.SettingKeyName),
"language": facades.Config().GetString("app.locale"),
})
}
// Language 获取面板语言
func (r *InfoController) Language(ctx http.Context) http.Response {
return Success(ctx, facades.Config().GetString("app.locale"))
}
// HomePlugins 获取首页插件
func (r *InfoController) HomePlugins(ctx http.Context) http.Response {
var plugins []models.Plugin

View File

@@ -12,8 +12,7 @@ func Api() {
facades.Route().Prefix("api/panel").Group(func(r route.Router) {
r.Prefix("info").Group(func(r route.Router) {
infoController := controllers.NewInfoController()
r.Get("name", infoController.Name)
r.Get("language", infoController.Language)
r.Get("panel", infoController.Panel)
r.Middleware(middleware.Jwt()).Get("homePlugins", infoController.HomePlugins)
r.Middleware(middleware.Jwt()).Get("nowMonitor", infoController.NowMonitor)
r.Middleware(middleware.Jwt()).Get("systemInfo", infoController.SystemInfo)