diff --git a/README.md b/README.md index 4a3bc88d..41564cd1 100644 --- a/README.md +++ b/README.md @@ -76,7 +76,7 @@ HAOZI_DL_URL="https://dl.cdn.haozi.net/panel"; curl -sSL -O ${HAOZI_DL_URL}/inst HAOZI_DL_URL="https://dl.cdn.haozi.net/panel"; curl -sSL -O ${HAOZI_DL_URL}/uninstall_panel.sh && curl -sSL -O ${HAOZI_DL_URL}/uninstall_panel.sh.checksum.txt && sha256sum -c uninstall_panel.sh.checksum.txt && bash uninstall_panel.sh || echo "Checksum 验证失败,文件可能被篡改,已终止操作" ``` -卸载面板前请务必备份好所有数据,提前卸载面板全部插件。卸载后数据将**无法恢复**! +卸载面板前请务必备份好所有数据,提前卸载面板全部应用。卸载后数据将**无法恢复**! ## 日常维护 diff --git a/docs/docs.go b/docs/docs.go index 545233ca..a2d00081 100644 --- a/docs/docs.go +++ b/docs/docs.go @@ -76,7 +76,7 @@ const docTemplate = `{ "tags": [ "信息服务" ], - "summary": "首页插件", + "summary": "首页应用", "responses": { "200": { "description": "OK", diff --git a/docs/swagger.json b/docs/swagger.json index 5dbe23f4..c9560985 100644 --- a/docs/swagger.json +++ b/docs/swagger.json @@ -69,7 +69,7 @@ "tags": [ "信息服务" ], - "summary": "首页插件", + "summary": "首页应用", "responses": { "200": { "description": "OK", diff --git a/docs/swagger.yaml b/docs/swagger.yaml index 56d9c8be..ba6fc37b 100644 --- a/docs/swagger.yaml +++ b/docs/swagger.yaml @@ -69,7 +69,7 @@ paths: description: OK schema: $ref: '#/definitions/service.SuccessResponse' - summary: 首页插件 + summary: 首页应用 tags: - 信息服务 /info/installedDbAndPhp: diff --git a/internal/apps/frp/service.go b/internal/apps/frp/service.go index bb436283..a21b96c6 100644 --- a/internal/apps/frp/service.go +++ b/internal/apps/frp/service.go @@ -20,7 +20,7 @@ func NewService() *Service { // // @Summary 获取配置 // @Description 获取 Frp 配置 -// @Tags 插件-Frp +// @Tags 应用-Frp // @Produce json // @Security BearerToken // @Param service query string false "服务" @@ -46,7 +46,7 @@ func (s *Service) GetConfig(w http.ResponseWriter, r *http.Request) { // // @Summary 更新配置 // @Description 更新 Frp 配置 -// @Tags 插件-Frp +// @Tags 应用-Frp // @Produce json // @Security BearerToken // @Param data body requests.UpdateConfig true "request" diff --git a/internal/apps/gitea/service.go b/internal/apps/gitea/service.go index e13c41a5..804292c3 100644 --- a/internal/apps/gitea/service.go +++ b/internal/apps/gitea/service.go @@ -19,7 +19,7 @@ func NewService() *Service { // GetConfig // // @Summary 获取配置 -// @Tags 插件-Gitea +// @Tags 应用-Gitea // @Produce json // @Security BearerToken // @Success 200 {object} controllers.SuccessResponse @@ -37,7 +37,7 @@ func (s *Service) GetConfig(w http.ResponseWriter, r *http.Request) { // UpdateConfig // // @Summary 更新配置 -// @Tags 插件-Gitea +// @Tags 应用-Gitea // @Produce json // @Security BearerToken // @Param data body requests.UpdateConfig true "request" diff --git a/internal/apps/openresty/service.go b/internal/apps/openresty/service.go index 7f3b64a5..812a386e 100644 --- a/internal/apps/openresty/service.go +++ b/internal/apps/openresty/service.go @@ -29,7 +29,7 @@ func NewService() *Service { // GetConfig // // @Summary 获取配置 -// @Tags 插件-OpenResty +// @Tags 应用-OpenResty // @Produce json // @Security BearerToken // @Success 200 {object} h.SuccessResponse @@ -47,7 +47,7 @@ func (s *Service) GetConfig(w http.ResponseWriter, r *http.Request) { // SaveConfig // // @Summary 保存配置 -// @Tags 插件-OpenResty +// @Tags 应用-OpenResty // @Produce json // @Security BearerToken // @Param config body string true "配置" @@ -74,7 +74,7 @@ func (s *Service) SaveConfig(w http.ResponseWriter, r *http.Request) { // ErrorLog // // @Summary 获取错误日志 -// @Tags 插件-OpenResty +// @Tags 应用-OpenResty // @Produce json // @Security BearerToken // @Success 200 {object} h.SuccessResponse @@ -95,7 +95,7 @@ func (s *Service) ErrorLog(w http.ResponseWriter, r *http.Request) { // ClearErrorLog // // @Summary 清空错误日志 -// @Tags 插件-OpenResty +// @Tags 应用-OpenResty // @Produce json // @Security BearerToken // @Success 200 {object} h.SuccessResponse @@ -111,7 +111,7 @@ func (s *Service) ClearErrorLog(w http.ResponseWriter, r *http.Request) { // Load // // @Summary 获取负载状态 -// @Tags 插件-OpenResty +// @Tags 应用-OpenResty // @Produce json // @Security BearerToken // @Success 200 {object} h.SuccessResponse diff --git a/internal/apps/php/service.go b/internal/apps/php/service.go index e9c95604..6ed26f94 100644 --- a/internal/apps/php/service.go +++ b/internal/apps/php/service.go @@ -35,7 +35,7 @@ func NewService(version uint) *Service { // GetConfig // // @Summary 获取配置 -// @Tags 插件-PHP +// @Tags 应用-PHP // @Produce json // @Security BearerToken // @Param version path int true "PHP 版本" @@ -54,7 +54,7 @@ func (s *Service) GetConfig(w http.ResponseWriter, r *http.Request) { // UpdateConfig // // @Summary 保存配置 -// @Tags 插件-PHP +// @Tags 应用-PHP // @Produce json // @Security BearerToken // @Param version path int true "PHP 版本" @@ -79,7 +79,7 @@ func (s *Service) UpdateConfig(w http.ResponseWriter, r *http.Request) { // GetFPMConfig // // @Summary 获取 FPM 配置 -// @Tags 插件-PHP +// @Tags 应用-PHP // @Produce json // @Security BearerToken // @Param version path int true "PHP 版本" @@ -98,7 +98,7 @@ func (s *Service) GetFPMConfig(w http.ResponseWriter, r *http.Request) { // UpdateFPMConfig // // @Summary 保存 FPM 配置 -// @Tags 插件-PHP +// @Tags 应用-PHP // @Produce json // @Security BearerToken // @Param version path int true "PHP 版本" @@ -123,7 +123,7 @@ func (s *Service) UpdateFPMConfig(w http.ResponseWriter, r *http.Request) { // Load // // @Summary 获取负载状态 -// @Tags 插件-PHP +// @Tags 应用-PHP // @Produce json // @Security BearerToken // @Param version path int true "PHP 版本" @@ -159,7 +159,7 @@ func (s *Service) Load(w http.ResponseWriter, r *http.Request) { // ErrorLog // // @Summary 获取错误日志 -// @Tags 插件-PHP +// @Tags 应用-PHP // @Produce json // @Security BearerToken // @Param version path int true "PHP 版本" @@ -173,7 +173,7 @@ func (s *Service) ErrorLog(w http.ResponseWriter, r *http.Request) { // SlowLog // // @Summary 获取慢日志 -// @Tags 插件-PHP +// @Tags 应用-PHP // @Produce json // @Security BearerToken // @Param version path int true "PHP 版本" @@ -187,7 +187,7 @@ func (s *Service) SlowLog(w http.ResponseWriter, r *http.Request) { // ClearErrorLog // // @Summary 清空错误日志 -// @Tags 插件-PHP +// @Tags 应用-PHP // @Produce json // @Security BearerToken // @Param version path int true "PHP 版本" @@ -205,7 +205,7 @@ func (s *Service) ClearErrorLog(w http.ResponseWriter, r *http.Request) { // ClearSlowLog // // @Summary 清空慢日志 -// @Tags 插件-PHP +// @Tags 应用-PHP // @Produce json // @Security BearerToken // @Param version path int true "PHP 版本" @@ -223,7 +223,7 @@ func (s *Service) ClearSlowLog(w http.ResponseWriter, r *http.Request) { // ExtensionList // // @Summary 获取扩展列表 -// @Tags 插件-PHP +// @Tags 应用-PHP // @Produce json // @Security BearerToken // @Param version path int true "PHP 版本" @@ -266,7 +266,7 @@ func (s *Service) ExtensionList(w http.ResponseWriter, r *http.Request) { // InstallExtension // // @Summary 安装扩展 -// @Tags 插件-PHP +// @Tags 应用-PHP // @Produce json // @Security BearerToken // @Param version path int true "PHP 版本" @@ -307,7 +307,7 @@ func (s *Service) InstallExtension(w http.ResponseWriter, r *http.Request) { // UninstallExtension // // @Summary 卸载扩展 -// @Tags 插件-PHP +// @Tags 应用-PHP // @Produce json // @Security BearerToken // @Param version path int true "PHP 版本" diff --git a/internal/apps/rsync/service.go b/internal/apps/rsync/service.go index a94776c4..bcf36adb 100644 --- a/internal/apps/rsync/service.go +++ b/internal/apps/rsync/service.go @@ -25,7 +25,7 @@ func NewService() *Service { // // @Summary 列出模块 // @Description 列出所有 Rsync 模块 -// @Tags 插件-Rsync +// @Tags 应用-Rsync // @Produce json // @Security BearerToken // @Param data query commonrequests.Paginate true "request" @@ -100,7 +100,7 @@ func (s *Service) List(w http.ResponseWriter, r *http.Request) { // // @Summary 添加模块 // @Description 添加 Rsync 模块 -// @Tags 插件-Rsync +// @Tags 应用-Rsync // @Produce json // @Security BearerToken // @Param data body requests.Create true "request" @@ -155,7 +155,7 @@ secrets file = /etc/rsyncd.secrets // // @Summary 删除模块 // @Description 删除 Rsync 模块 -// @Tags 插件-Rsync +// @Tags 应用-Rsync // @Produce json // @Security BearerToken // @Param name path string true "模块名称" @@ -207,7 +207,7 @@ func (s *Service) Delete(w http.ResponseWriter, r *http.Request) { // // @Summary 更新模块 // @Description 更新 Rsync 模块 -// @Tags 插件-Rsync +// @Tags 应用-Rsync // @Produce json // @Security BearerToken // @Param name path string true "模块名称" @@ -274,7 +274,7 @@ secrets file = /etc/rsyncd.secrets // // @Summary 获取配置 // @Description 获取 Rsync 配置 -// @Tags 插件-Rsync +// @Tags 应用-Rsync // @Produce json // @Security BearerToken // @Success 200 {object} controllers.SuccessResponse @@ -293,7 +293,7 @@ func (s *Service) GetConfig(w http.ResponseWriter, r *http.Request) { // // @Summary 更新配置 // @Description 更新 Rsync 配置 -// @Tags 插件-Rsync +// @Tags 应用-Rsync // @Produce json // @Security BearerToken // @Param data body requests.UpdateConfig true "request" diff --git a/internal/data/app.go b/internal/data/app.go index 476228b1..3ad27fb6 100644 --- a/internal/data/app.go +++ b/internal/data/app.go @@ -266,16 +266,16 @@ func (r *appRepo) preCheck(app *api.App) error { var apps []string var installed []string - allPlugins := r.All() - for _, p := range allPlugins { - apps = append(apps, p.Slug) + all := r.All() + for _, item := range all { + apps = append(apps, item.Slug) } - installedPlugins, err := r.Installed() + installedApps, err := r.Installed() if err != nil { return err } - for _, p := range installedPlugins { - installed = append(installed, p.Slug) + for _, item := range installedApps { + installed = append(installed, item.Slug) } env := map[string]any{ diff --git a/internal/http/request/plugin.go b/internal/http/request/app.go similarity index 71% rename from internal/http/request/plugin.go rename to internal/http/request/app.go index e23f9cc4..eac27701 100644 --- a/internal/http/request/plugin.go +++ b/internal/http/request/app.go @@ -1,10 +1,10 @@ package request -type PluginSlug struct { +type AppSlug struct { Slug string `json:"slug" form:"slug"` } -type PluginUpdateShow struct { +type AppUpdateShow struct { Slug string `json:"slug" form:"slug"` Show bool `json:"show" form:"show"` } diff --git a/internal/http/request/paginate.go b/internal/http/request/paginate.go index eb200cf4..432a4486 100644 --- a/internal/http/request/paginate.go +++ b/internal/http/request/paginate.go @@ -6,14 +6,14 @@ import ( type Paginate struct { Page uint `json:"page" form:"page" query:"page" validate:"required,number,gte=1"` - Limit uint `json:"limit" form:"limit" query:"limit" validate:"required,number,gte=1,lte=1000"` + Limit uint `json:"limit" form:"limit" query:"limit" validate:"required,number,gte=1,lte=10000"` } func (r *Paginate) Messages(_ *http.Request) map[string]string { return map[string]string{ "Page.gte": "页码必须大于或等于1", "Limit.gte": "每页数量必须大于或等于1", - "Limit.lte": "每页数量必须小于或等于1000", + "Limit.lte": "每页数量必须小于或等于10000", "Page.number": "页码必须是数字", "Limit.number": "每页数量必须是数字", "Page.required": "页码不能为空", diff --git a/internal/route/http.go b/internal/route/http.go index 145becaf..e2b1d137 100644 --- a/internal/route/http.go +++ b/internal/route/http.go @@ -27,8 +27,8 @@ func Http(r chi.Router) { r.Route("/info", func(r chi.Router) { info := service.NewInfoService() r.Get("/panel", info.Panel) - r.With(middleware.MustLogin).Get("/homePlugins", info.HomePlugins) - r.With(middleware.MustLogin).Get("/nowMonitor", info.NowMonitor) + r.With(middleware.MustLogin).Get("/homeApps", info.HomeApps) + r.With(middleware.MustLogin).Get("/realtime", info.Realtime) r.With(middleware.MustLogin).Get("/systemInfo", info.SystemInfo) r.With(middleware.MustLogin).Get("/countInfo", info.CountInfo) r.With(middleware.MustLogin).Get("/installedDbAndPhp", info.InstalledDbAndPhp) diff --git a/internal/service/app.go b/internal/service/app.go index 23fd68ab..b40e1699 100644 --- a/internal/service/app.go +++ b/internal/service/app.go @@ -66,7 +66,7 @@ func (s *AppService) List(w http.ResponseWriter, r *http.Request) { } func (s *AppService) Install(w http.ResponseWriter, r *http.Request) { - req, err := Bind[request.PluginSlug](r) + req, err := Bind[request.AppSlug](r) if err != nil { Error(w, http.StatusUnprocessableEntity, err.Error()) return @@ -81,7 +81,7 @@ func (s *AppService) Install(w http.ResponseWriter, r *http.Request) { } func (s *AppService) Uninstall(w http.ResponseWriter, r *http.Request) { - req, err := Bind[request.PluginSlug](r) + req, err := Bind[request.AppSlug](r) if err != nil { Error(w, http.StatusUnprocessableEntity, err.Error()) return @@ -96,7 +96,7 @@ func (s *AppService) Uninstall(w http.ResponseWriter, r *http.Request) { } func (s *AppService) Update(w http.ResponseWriter, r *http.Request) { - req, err := Bind[request.PluginSlug](r) + req, err := Bind[request.AppSlug](r) if err != nil { Error(w, http.StatusUnprocessableEntity, err.Error()) return @@ -111,7 +111,7 @@ func (s *AppService) Update(w http.ResponseWriter, r *http.Request) { } func (s *AppService) UpdateShow(w http.ResponseWriter, r *http.Request) { - req, err := Bind[request.PluginUpdateShow](r) + req, err := Bind[request.AppUpdateShow](r) if err != nil { Error(w, http.StatusUnprocessableEntity, err.Error()) return @@ -126,7 +126,7 @@ func (s *AppService) UpdateShow(w http.ResponseWriter, r *http.Request) { } func (s *AppService) IsInstalled(w http.ResponseWriter, r *http.Request) { - req, err := Bind[request.PluginSlug](r) + req, err := Bind[request.AppSlug](r) if err != nil { Error(w, http.StatusUnprocessableEntity, err.Error()) return diff --git a/internal/service/info.go b/internal/service/info.go index 79c53503..5186343d 100644 --- a/internal/service/info.go +++ b/internal/service/info.go @@ -56,33 +56,33 @@ func (s *InfoService) Panel(w http.ResponseWriter, r *http.Request) { }) } -// HomePlugins +// HomeApps // -// @Summary 首页插件 +// @Summary 首页应用 // @Tags 信息服务 // @Accept json // @Produce json // @Success 200 {object} SuccessResponse -// @Router /info/homePlugins [get] -func (s *InfoService) HomePlugins(w http.ResponseWriter, r *http.Request) { +// @Router /info/homeApps [get] +func (s *InfoService) HomeApps(w http.ResponseWriter, r *http.Request) { apps, err := s.appRepo.GetHomeShow() if err != nil { - Error(w, http.StatusInternalServerError, "获取首页插件失败") + Error(w, http.StatusInternalServerError, "获取首页应用失败") return } Success(w, apps) } -// NowMonitor +// Realtime // // @Summary 实时监控 // @Tags 信息服务 // @Accept json // @Produce json // @Success 200 {object} SuccessResponse -// @Router /info/nowMonitor [get] -func (s *InfoService) NowMonitor(w http.ResponseWriter, r *http.Request) { +// @Router /info/realtime [get] +func (s *InfoService) Realtime(w http.ResponseWriter, r *http.Request) { Success(w, tools.GetMonitoringInfo()) } diff --git a/pkg/apploader/apploader.go b/pkg/apploader/apploader.go index 84248a12..fed6d5f3 100644 --- a/pkg/apploader/apploader.go +++ b/pkg/apploader/apploader.go @@ -46,7 +46,7 @@ func All() []*types.App { func Boot(r chi.Router) { apps.Range(func(_, app any) bool { if p, ok := app.(*types.App); ok { - r.Route(fmt.Sprintf("/api/app/%s", p.Slug), p.Route) + r.Route(fmt.Sprintf("/api/apps/%s", p.Slug), p.Route) } return true }) diff --git a/pkg/types/app.go b/pkg/types/app.go index 7ce22612..7512f3f3 100644 --- a/pkg/types/app.go +++ b/pkg/types/app.go @@ -4,7 +4,7 @@ import "github.com/go-chi/chi/v5" // App 应用元数据结构 type App struct { - Slug string `json:"slug"` // 插件标识 + Slug string `json:"slug"` // 应用标识 Route func(r chi.Router) `json:"-"` // 路由 } diff --git a/web/build/plugins/unplugin.ts b/web/build/plugins/unplugin.ts index cc0534be..ebeaf1fa 100644 --- a/web/build/plugins/unplugin.ts +++ b/web/build/plugins/unplugin.ts @@ -3,7 +3,7 @@ import Components from 'unplugin-vue-components/vite' import { NaiveUiResolver } from 'unplugin-vue-components/resolvers' /** - * * unplugin-icons插件,自动引入iconify图标 + * * unplugin-icons应用,自动引入iconify图标 * usage: https://github.com/antfu/unplugin-icons * 图标库: https://icones.js.org/ */ diff --git a/web/src/api/plugins/fail2ban/index.ts b/web/src/api/apps/fail2ban/index.ts similarity index 52% rename from web/src/api/plugins/fail2ban/index.ts rename to web/src/api/apps/fail2ban/index.ts index 3bf8e67e..446559d6 100644 --- a/web/src/api/plugins/fail2ban/index.ts +++ b/web/src/api/apps/fail2ban/index.ts @@ -4,21 +4,20 @@ import type { AxiosResponse } from 'axios' export default { // 保护列表 jails: (page: number, limit: number): Promise> => - request.get('/plugins/fail2ban/jails', { params: { page, limit } }), + request.get('/apps/fail2ban/jails', { params: { page, limit } }), // 添加保护 - add: (data: any): Promise> => request.post('/plugins/fail2ban/jails', data), + add: (data: any): Promise> => request.post('/apps/fail2ban/jails', data), // 删除保护 delete: (name: string): Promise> => - request.delete('/plugins/fail2ban/jails', { params: { name } }), + request.delete('/apps/fail2ban/jails', { params: { name } }), // 封禁列表 - jail: (name: string): Promise> => - request.get('/plugins/fail2ban/jails/' + name), + jail: (name: string): Promise> => request.get('/apps/fail2ban/jails/' + name), // 解封 IP unban: (name: string, ip: string): Promise> => - request.post('/plugins/fail2ban/unban', { name, ip }), + request.post('/apps/fail2ban/unban', { name, ip }), // 获取白名单 - whitelist: (): Promise> => request.get('/plugins/fail2ban/whiteList'), + whitelist: (): Promise> => request.get('/apps/fail2ban/whiteList'), // 设置白名单 setWhitelist: (ip: string): Promise> => - request.post('/plugins/fail2ban/whiteList', { ip }) + request.post('/apps/fail2ban/whiteList', { ip }) } diff --git a/web/src/api/plugins/frp/index.ts b/web/src/api/apps/frp/index.ts similarity index 68% rename from web/src/api/plugins/frp/index.ts rename to web/src/api/apps/frp/index.ts index dfe43919..1bd1c38c 100644 --- a/web/src/api/plugins/frp/index.ts +++ b/web/src/api/apps/frp/index.ts @@ -4,8 +4,8 @@ import type { AxiosResponse } from 'axios' export default { // 获取配置 config: (service: string): Promise> => - request.get('/plugins/frp/config', { params: { service } }), + request.get('/apps/frp/config', { params: { service } }), // 保存配置 saveConfig: (service: string, config: string): Promise> => - request.post('/plugins/frp/config', { service, config }) + request.post('/apps/frp/config', { service, config }) } diff --git a/web/src/api/plugins/gitea/index.ts b/web/src/api/apps/gitea/index.ts similarity index 58% rename from web/src/api/plugins/gitea/index.ts rename to web/src/api/apps/gitea/index.ts index 0b7005d9..755eab30 100644 --- a/web/src/api/plugins/gitea/index.ts +++ b/web/src/api/apps/gitea/index.ts @@ -3,8 +3,8 @@ import type { AxiosResponse } from 'axios' export default { // 获取配置 - config: (): Promise> => request.get('/plugins/gitea/config'), + config: (): Promise> => request.get('/apps/gitea/config'), // 保存配置 saveConfig: (config: string): Promise> => - request.post('/plugins/gitea/config', { config }) + request.post('/apps/gitea/config', { config }) } diff --git a/web/src/api/plugins/mysql/index.ts b/web/src/api/apps/mysql/index.ts similarity index 56% rename from web/src/api/plugins/mysql/index.ts rename to web/src/api/apps/mysql/index.ts index 81622432..9cbcdfb8 100644 --- a/web/src/api/plugins/mysql/index.ts +++ b/web/src/api/apps/mysql/index.ts @@ -3,61 +3,61 @@ import type { AxiosResponse } from 'axios' export default { // 负载状态 - load: (): Promise> => request.get('/plugins/mysql/load'), + load: (): Promise> => request.get('/apps/mysql/load'), // 获取配置 - config: (): Promise> => request.get('/plugins/mysql/config'), + config: (): Promise> => request.get('/apps/mysql/config'), // 保存配置 saveConfig: (config: string): Promise> => - request.post('/plugins/mysql/config', { config }), + request.post('/apps/mysql/config', { config }), // 获取错误日志 - errorLog: (): Promise> => request.get('/plugins/mysql/errorLog'), + errorLog: (): Promise> => request.get('/apps/mysql/errorLog'), // 清空错误日志 - clearErrorLog: (): Promise> => request.post('/plugins/mysql/clearErrorLog'), + clearErrorLog: (): Promise> => request.post('/apps/mysql/clearErrorLog'), // 获取慢查询日志 - slowLog: (): Promise> => request.get('/plugins/mysql/slowLog'), + slowLog: (): Promise> => request.get('/apps/mysql/slowLog'), // 清空慢查询日志 - clearSlowLog: (): Promise> => request.post('/plugins/mysql/clearSlowLog'), + clearSlowLog: (): Promise> => request.post('/apps/mysql/clearSlowLog'), // 获取 root 密码 - rootPassword: (): Promise> => request.get('/plugins/mysql/rootPassword'), + rootPassword: (): Promise> => request.get('/apps/mysql/rootPassword'), // 修改 root 密码 setRootPassword: (password: string): Promise> => - request.post('/plugins/mysql/rootPassword', { password }), + request.post('/apps/mysql/rootPassword', { password }), // 数据库列表 databases: (page: number, limit: number): Promise> => - request.get('/plugins/mysql/databases', { params: { page, limit } }), + request.get('/apps/mysql/databases', { params: { page, limit } }), // 创建数据库 addDatabase: (database: any): Promise> => - request.post('/plugins/mysql/databases', database), + request.post('/apps/mysql/databases', database), // 删除数据库 deleteDatabase: (database: string): Promise> => - request.delete('/plugins/mysql/databases', { params: { database } }), + request.delete('/apps/mysql/databases', { params: { database } }), // 备份列表 backups: (page: number, limit: number): Promise> => - request.get('/plugins/mysql/backups', { params: { page, limit } }), + request.get('/apps/mysql/backups', { params: { page, limit } }), // 创建备份 createBackup: (database: string): Promise> => - request.post('/plugins/mysql/backups', { database }), + request.post('/apps/mysql/backups', { database }), // 上传备份 uploadBackup: (backup: any): Promise> => - request.put('/plugins/mysql/backups', backup), + request.put('/apps/mysql/backups', backup), // 删除备份 deleteBackup: (name: string): Promise> => - request.delete('/plugins/mysql/backups', { params: { name } }), + request.delete('/apps/mysql/backups', { params: { name } }), // 还原备份 restoreBackup: (backup: string, database: string): Promise> => - request.post('/plugins/mysql/backups/restore', { backup, database }), + request.post('/apps/mysql/backups/restore', { backup, database }), // 用户列表 users: (page: number, limit: number): Promise> => - request.get('/plugins/mysql/users', { params: { page, limit } }), + request.get('/apps/mysql/users', { params: { page, limit } }), // 创建用户 - addUser: (user: any): Promise> => request.post('/plugins/mysql/users', user), + addUser: (user: any): Promise> => request.post('/apps/mysql/users', user), // 删除用户 deleteUser: (user: string): Promise> => - request.delete('/plugins/mysql/users', { params: { user } }), + request.delete('/apps/mysql/users', { params: { user } }), // 设置用户密码 setUserPassword: (user: string, password: string): Promise> => - request.post('/plugins/mysql/users/password', { user, password }), + request.post('/apps/mysql/users/password', { user, password }), // 设置用户权限 setUserPrivileges: (user: string, database: string): Promise> => - request.post('/plugins/mysql/users/privileges', { user, database }) + request.post('/apps/mysql/users/privileges', { user, database }) } diff --git a/web/src/api/apps/openresty/index.ts b/web/src/api/apps/openresty/index.ts new file mode 100644 index 00000000..ef169f48 --- /dev/null +++ b/web/src/api/apps/openresty/index.ts @@ -0,0 +1,16 @@ +import { request } from '@/utils' +import type { AxiosResponse } from 'axios' + +export default { + // 负载状态 + load: (): Promise> => request.get('/apps/openresty/load'), + // 获取配置 + config: (): Promise> => request.get('/apps/openresty/config'), + // 保存配置 + saveConfig: (config: string): Promise> => + request.post('/apps/openresty/config', { config }), + // 获取错误日志 + errorLog: (): Promise> => request.get('/apps/openresty/errorLog'), + // 清空错误日志 + clearErrorLog: (): Promise> => request.post('/apps/openresty/clearErrorLog') +} diff --git a/web/src/api/plugins/php/index.ts b/web/src/api/apps/php/index.ts similarity index 59% rename from web/src/api/plugins/php/index.ts rename to web/src/api/apps/php/index.ts index c56578e0..0029e274 100644 --- a/web/src/api/plugins/php/index.ts +++ b/web/src/api/apps/php/index.ts @@ -3,39 +3,38 @@ import type { AxiosResponse } from 'axios' export default { // 负载状态 - load: (version: number): Promise> => - request.get(`/plugins/php/${version}/load`), + load: (version: number): Promise> => request.get(`/apps/php/${version}/load`), // 获取配置 config: (version: number): Promise> => - request.get(`/plugins/php/${version}/config`), + request.get(`/apps/php/${version}/config`), // 保存配置 saveConfig: (version: number, config: string): Promise> => - request.post(`/plugins/php/${version}/config`, { config }), + request.post(`/apps/php/${version}/config`, { config }), // 获取FPM配置 fpmConfig: (version: number): Promise> => - request.get(`/plugins/php/${version}/fpmConfig`), + request.get(`/apps/php/${version}/fpmConfig`), // 保存FPM配置 saveFPMConfig: (version: number, config: string): Promise> => - request.post(`/plugins/php/${version}/fpmConfig`, { config }), + request.post(`/apps/php/${version}/fpmConfig`, { config }), // 获取错误日志 errorLog: (version: number): Promise> => - request.get(`/plugins/php/${version}/errorLog`), + request.get(`/apps/php/${version}/errorLog`), // 清空错误日志 clearErrorLog: (version: number): Promise> => - request.post(`/plugins/php/${version}/clearErrorLog`), + request.post(`/apps/php/${version}/clearErrorLog`), // 获取慢日志 slowLog: (version: number): Promise> => - request.get(`/plugins/php/${version}/slowLog`), + request.get(`/apps/php/${version}/slowLog`), // 清空慢日志 clearSlowLog: (version: number): Promise> => - request.post(`/plugins/php/${version}/clearSlowLog`), + request.post(`/apps/php/${version}/clearSlowLog`), // 拓展列表 extensions: (version: number): Promise> => - request.get(`/plugins/php/${version}/extensions`), + request.get(`/apps/php/${version}/extensions`), // 安装拓展 installExtension: (version: number, slug: string): Promise> => - request.post(`/plugins/php/${version}/extensions`, { slug }), + request.post(`/apps/php/${version}/extensions`, { slug }), // 卸载拓展 uninstallExtension: (version: number, slug: string): Promise> => - request.delete(`/plugins/php/${version}/extensions`, { params: { slug } }) + request.delete(`/apps/php/${version}/extensions`, { params: { slug } }) } diff --git a/web/src/api/apps/phpmyadmin/index.ts b/web/src/api/apps/phpmyadmin/index.ts new file mode 100644 index 00000000..14d9887c --- /dev/null +++ b/web/src/api/apps/phpmyadmin/index.ts @@ -0,0 +1,15 @@ +import { request } from '@/utils' +import type { AxiosResponse } from 'axios' + +export default { + // 获取信息 + info: (): Promise> => request.get('/apps/phpmyadmin/info'), + // 设置端口 + port: (port: number): Promise> => + request.post('/apps/phpmyadmin/port', { port }), + // 获取配置 + getConfig: (): Promise> => request.get('/apps/phpmyadmin/config'), + // 保存配置 + saveConfig: (config: string): Promise> => + request.post('/apps/phpmyadmin/config', { config }) +} diff --git a/web/src/api/plugins/podman/index.ts b/web/src/api/apps/podman/index.ts similarity index 70% rename from web/src/api/plugins/podman/index.ts rename to web/src/api/apps/podman/index.ts index 931958bb..aa9710c8 100644 --- a/web/src/api/plugins/podman/index.ts +++ b/web/src/api/apps/podman/index.ts @@ -3,13 +3,13 @@ import type { AxiosResponse } from 'axios' export default { // 获取注册表配置 - registryConfig: (): Promise> => request.get('/plugins/podman/registryConfig'), + registryConfig: (): Promise> => request.get('/apps/podman/registryConfig'), // 保存注册表配置 saveRegistryConfig: (config: string): Promise> => - request.post('/plugins/podman/registryConfig', { config }), + request.post('/apps/podman/registryConfig', { config }), // 获取存储配置 - storageConfig: (): Promise> => request.get('/plugins/podman/storageConfig'), + storageConfig: (): Promise> => request.get('/apps/podman/storageConfig'), // 保存存储配置 saveStorageConfig: (config: string): Promise> => - request.post('/plugins/podman/storageConfig', { config }) + request.post('/apps/podman/storageConfig', { config }) } diff --git a/web/src/api/apps/postgresql/index.ts b/web/src/api/apps/postgresql/index.ts new file mode 100644 index 00000000..ec169a04 --- /dev/null +++ b/web/src/api/apps/postgresql/index.ts @@ -0,0 +1,56 @@ +import { request } from '@/utils' +import type { AxiosResponse } from 'axios' + +export default { + // 负载状态 + load: (): Promise> => request.get('/apps/postgresql/load'), + // 获取配置 + config: (): Promise> => request.get('/apps/postgresql/config'), + // 保存配置 + saveConfig: (config: string): Promise> => + request.post('/apps/postgresql/config', { config }), + // 获取用户配置 + userConfig: (): Promise> => request.get('/apps/postgresql/userConfig'), + // 保存配置 + saveUserConfig: (config: string): Promise> => + request.post('/apps/postgresql/userConfig', { config }), + // 获取日志 + log: (): Promise> => request.get('/apps/postgresql/log'), + // 清空错误日志 + clearLog: (): Promise> => request.post('/apps/postgresql/clearLog'), + // 数据库列表 + databases: (page: number, limit: number): Promise> => + request.get('/apps/postgresql/databases', { params: { page, limit } }), + // 创建数据库 + addDatabase: (database: any): Promise> => + request.post('/apps/postgresql/databases', database), + // 删除数据库 + deleteDatabase: (database: string): Promise> => + request.delete('/apps/postgresql/databases', { params: { database } }), + // 备份列表 + backups: (page: number, limit: number): Promise> => + request.get('/apps/postgresql/backups', { params: { page, limit } }), + // 创建备份 + createBackup: (database: string): Promise> => + request.post('/apps/postgresql/backups', { database }), + // 上传备份 + uploadBackup: (backup: any): Promise> => + request.put('/apps/postgresql/backups', backup), + // 删除备份 + deleteBackup: (name: string): Promise> => + request.delete('/apps/postgresql/backups', { params: { name } }), + // 还原备份 + restoreBackup: (backup: string, database: string): Promise> => + request.post('/apps/postgresql/backups/restore', { backup, database }), + // 角色列表 + roles: (page: number, limit: number): Promise> => + request.get('/apps/postgresql/roles', { params: { page, limit } }), + // 创建角色 + addRole: (user: any): Promise> => request.post('/apps/postgresql/roles', user), + // 删除角色 + deleteRole: (user: string): Promise> => + request.delete('/apps/postgresql/roles', { params: { user } }), + // 设置角色密码 + setRolePassword: (user: string, password: string): Promise> => + request.post('/apps/postgresql/roles/password', { user, password }) +} diff --git a/web/src/api/plugins/pureftpd/index.ts b/web/src/api/apps/pureftpd/index.ts similarity index 56% rename from web/src/api/plugins/pureftpd/index.ts rename to web/src/api/apps/pureftpd/index.ts index 79bad008..622e25a3 100644 --- a/web/src/api/plugins/pureftpd/index.ts +++ b/web/src/api/apps/pureftpd/index.ts @@ -4,19 +4,19 @@ import type { AxiosResponse } from 'axios' export default { // 列表 list: (page: number, limit: number): Promise> => - request.get('/plugins/pureftpd/list', { params: { page, limit } }), + request.get('/apps/pureftpd/list', { params: { page, limit } }), // 添加 add: (username: string, password: string, path: string): Promise> => - request.post('/plugins/pureftpd/add', { username, password, path }), + request.post('/apps/pureftpd/add', { username, password, path }), // 删除 delete: (username: string): Promise> => - request.delete('/plugins/pureftpd/delete', { params: { username } }), + request.delete('/apps/pureftpd/delete', { params: { username } }), // 修改密码 changePassword: (username: string, password: string): Promise> => - request.post('/plugins/pureftpd/changePassword', { username, password }), + request.post('/apps/pureftpd/changePassword', { username, password }), // 获取端口 - port: (): Promise> => request.get('/plugins/pureftpd/port'), + port: (): Promise> => request.get('/apps/pureftpd/port'), // 修改端口 setPort: (port: number): Promise> => - request.post('/plugins/pureftpd/port', { port }) + request.post('/apps/pureftpd/port', { port }) } diff --git a/web/src/api/apps/redis/index.ts b/web/src/api/apps/redis/index.ts new file mode 100644 index 00000000..a8f27b57 --- /dev/null +++ b/web/src/api/apps/redis/index.ts @@ -0,0 +1,12 @@ +import { request } from '@/utils' +import type { AxiosResponse } from 'axios' + +export default { + // 负载状态 + load: (): Promise> => request.get('/apps/redis/load'), + // 获取配置 + config: (): Promise> => request.get('/apps/redis/config'), + // 保存配置 + saveConfig: (config: string): Promise> => + request.post('/apps/redis/config', { config }) +} diff --git a/web/src/api/plugins/rsync/index.ts b/web/src/api/apps/rsync/index.ts similarity index 58% rename from web/src/api/plugins/rsync/index.ts rename to web/src/api/apps/rsync/index.ts index 22708131..c0bbf647 100644 --- a/web/src/api/plugins/rsync/index.ts +++ b/web/src/api/apps/rsync/index.ts @@ -3,20 +3,20 @@ import type { AxiosResponse } from 'axios' export default { // 获取配置 - config: (): Promise> => request.get('/plugins/rsync/config'), + config: (): Promise> => request.get('/apps/rsync/config'), // 保存配置 saveConfig: (config: string): Promise> => - request.post('/plugins/rsync/config', { config }), + request.post('/apps/rsync/config', { config }), // 模块列表 modules: (page: number, limit: number): Promise> => - request.get('/plugins/rsync/modules', { params: { page, limit } }), + request.get('/apps/rsync/modules', { params: { page, limit } }), // 添加模块 addModule: (module: any): Promise> => - request.post('/plugins/rsync/modules', module), + request.post('/apps/rsync/modules', module), // 删除模块 deleteModule: (name: string): Promise> => - request.delete('/plugins/rsync/modules/' + name), + request.delete('/apps/rsync/modules/' + name), // 更新模块 updateModule: (name: string, module: any): Promise> => - request.post('/plugins/rsync/modules/' + name, module) + request.post('/apps/rsync/modules/' + name, module) } diff --git a/web/src/api/plugins/s3fs/index.ts b/web/src/api/apps/s3fs/index.ts similarity index 71% rename from web/src/api/plugins/s3fs/index.ts rename to web/src/api/apps/s3fs/index.ts index c8c912e8..e4505413 100644 --- a/web/src/api/plugins/s3fs/index.ts +++ b/web/src/api/apps/s3fs/index.ts @@ -4,9 +4,9 @@ import type { AxiosResponse } from 'axios' export default { // 列表 list: (page: number, limit: number): Promise> => - request.get('/plugins/s3fs/list', { params: { page, limit } }), + request.get('/apps/s3fs/list', { params: { page, limit } }), // 添加 - add: (data: any): Promise> => request.post('/plugins/s3fs/add', data), + add: (data: any): Promise> => request.post('/apps/s3fs/add', data), // 删除 - delete: (id: number): Promise> => request.post('/plugins/s3fs/delete', { id }) + delete: (id: number): Promise> => request.post('/apps/s3fs/delete', { id }) } diff --git a/web/src/api/apps/supervisor/index.ts b/web/src/api/apps/supervisor/index.ts new file mode 100644 index 00000000..d538b469 --- /dev/null +++ b/web/src/api/apps/supervisor/index.ts @@ -0,0 +1,48 @@ +import { request } from '@/utils' +import type { AxiosResponse } from 'axios' + +export default { + // 服务名称 + service: (): Promise> => request.get('/apps/supervisor/service'), + // 负载状态 + load: (): Promise> => request.get('/apps/supervisor/load'), + // 获取错误日志 + log: (): Promise> => request.get('/apps/supervisor/log'), + // 清空错误日志 + clearLog: (): Promise> => request.post('/apps/supervisor/clearLog'), + // 获取配置 + config: (): Promise> => request.get('/apps/supervisor/config'), + // 保存配置 + saveConfig: (config: string): Promise> => + request.post('/apps/supervisor/config', { config }), + // 进程列表 + processes: (page: number, limit: number): Promise> => + request.get('/apps/supervisor/processes', { params: { page, limit } }), + // 进程启动 + startProcess: (process: string): Promise> => + request.post('/apps/supervisor/startProcess', { process }), + // 进程停止 + stopProcess: (process: string): Promise> => + request.post('/apps/supervisor/stopProcess', { process }), + // 进程重启 + restartProcess: (process: string): Promise> => + request.post('/apps/supervisor/restartProcess', { process }), + // 进程日志 + processLog: (process: string): Promise> => + request.get('/apps/supervisor/processLog', { params: { process } }), + // 清空进程日志 + clearProcessLog: (process: string): Promise> => + request.post('/apps/supervisor/clearProcessLog', { process }), + // 进程配置 + processConfig: (process: string): Promise> => + request.get('/apps/supervisor/processConfig', { params: { process } }), + // 保存进程配置 + saveProcessConfig: (process: string, config: string): Promise> => + request.post('/apps/supervisor/processConfig', { process, config }), + // 添加进程 + addProcess: (process: any): Promise> => + request.post('/apps/supervisor/addProcess', process), + // 删除进程 + deleteProcess: (process: string): Promise> => + request.post('/apps/supervisor/deleteProcess', { process }) +} diff --git a/web/src/api/apps/toolbox/index.ts b/web/src/api/apps/toolbox/index.ts new file mode 100644 index 00000000..46995882 --- /dev/null +++ b/web/src/api/apps/toolbox/index.ts @@ -0,0 +1,28 @@ +import { request } from '@/utils' +import type { AxiosResponse } from 'axios' + +export default { + // DNS + dns: (): Promise> => request.get('/apps/toolbox/dns'), + // 设置 DNS + setDns: (dns1: string, dns2: string): Promise> => + request.post('/apps/toolbox/dns', { dns1, dns2 }), + // SWAP + swap: (): Promise> => request.get('/apps/toolbox/swap'), + // 设置 SWAP + setSwap: (size: number): Promise> => + request.post('/apps/toolbox/swap', { size }), + // 时区 + timezone: (): Promise> => request.get('/apps/toolbox/timezone'), + // 设置时区 + setTimezone: (timezone: string): Promise> => + request.post('/apps/toolbox/timezone', { timezone }), + // Hosts + hosts: (): Promise> => request.get('/apps/toolbox/hosts'), + // 设置 Hosts + setHosts: (hosts: string): Promise> => + request.post('/apps/toolbox/hosts', { hosts }), + // 设置 Root 密码 + setRootPassword: (password: string): Promise> => + request.post('/apps/toolbox/rootPassword', { password }) +} diff --git a/web/src/api/panel/plugin/index.ts b/web/src/api/panel/app/index.ts similarity index 54% rename from web/src/api/panel/plugin/index.ts rename to web/src/api/panel/app/index.ts index 59ea5823..c016cdde 100644 --- a/web/src/api/panel/plugin/index.ts +++ b/web/src/api/panel/app/index.ts @@ -2,22 +2,22 @@ import { request } from '@/utils' import type { AxiosResponse } from 'axios' export default { - // 获取插件列表 + // 获取应用列表 list: (page: number, limit: number): Promise> => - request.get('/plugin/list', { params: { page, limit } }), - // 安装插件 + request.get('/app/list', { params: { page, limit } }), + // 安装应用 install: (slug: string): Promise> => - request.post('/plugin/install', { slug }), - // 卸载插件 + request.post('/app/install', { slug }), + // 卸载应用 uninstall: (slug: string): Promise> => - request.post('/plugin/uninstall', { slug }), - // 更新插件 + request.post('/app/uninstall', { slug }), + // 更新应用 update: (slug: string): Promise> => - request.post('/plugin/update', { slug }), + request.post('/app/update', { slug }), // 设置首页显示 updateShow: (slug: string, show: boolean): Promise> => - request.post('/plugin/updateShow', { slug, show }), - // 插件是否已安装 + request.post('/app/updateShow', { slug, show }), + // 应用是否已安装 isInstalled: (slug: string): Promise> => - request.get('/plugin/isInstalled', { params: { slug } }) + request.get('/app/isInstalled', { params: { slug } }) } diff --git a/web/src/api/panel/info/index.ts b/web/src/api/panel/info/index.ts index acf1e9bb..28b1d3f9 100644 --- a/web/src/api/panel/info/index.ts +++ b/web/src/api/panel/info/index.ts @@ -6,17 +6,16 @@ export default { panel: (): Promise => fetch('/api/info/panel'), // 面板菜单 menu: (): Promise> => request.get('/info/menu'), - // 首页插件 - homePlugins: (): Promise> => request.get('/info/homePlugins'), + // 首页应用 + homeApps: (): Promise> => request.get('/info/homeApps'), // 实时监控 - nowMonitor: (): Promise> => request.get('/info/nowMonitor'), + realtime: (): Promise> => request.get('/info/realtime'), // 系统信息 systemInfo: (): Promise> => request.get('/info/systemInfo'), // 统计信息 countInfo: (): Promise> => request.get('/info/countInfo'), // 已安装的数据库和PHP - installedDbAndPhp: (): Promise> => - request.get('/info/installedDbAndPhp'), + installedDbAndPhp: (): Promise> => request.get('/info/installedDbAndPhp'), // 检查更新 checkUpdate: (): Promise> => request.get('/info/checkUpdate'), // 更新日志 diff --git a/web/src/api/panel/website/index.ts b/web/src/api/panel/website/index.ts index 1c8dca05..3e1d405d 100644 --- a/web/src/api/panel/website/index.ts +++ b/web/src/api/panel/website/index.ts @@ -4,25 +4,23 @@ import type { AxiosResponse } from 'axios' export default { // 列表 list: (page: number, limit: number): Promise> => - request.get('/websites', { params: { page, limit } }), + request.get('/website', { params: { page, limit } }), // 添加 - add: (data: any): Promise> => request.post('/websites', data), + add: (data: any): Promise> => request.post('/website', data), // 删除 - delete: (data: any): Promise> => request.post('/websites/delete', data), + delete: (data: any): Promise> => request.post('/website/' + data.id, data), // 获取默认配置 defaultConfig: (): Promise> => request.get('/website/defaultConfig'), // 保存默认配置 saveDefaultConfig: (index: string, stop: string): Promise> => request.post('/website/defaultConfig', { index, stop }), // 网站配置 - config: (id: number): Promise> => - request.get('/websites/' + id + '/config'), + config: (id: number): Promise> => request.get('/websites/' + id + '/config'), // 保存网站配置 saveConfig: (id: number, data: any): Promise> => request.post('/websites/' + id + '/config', data), // 清空日志 - clearLog: (id: number): Promise> => - request.delete('/websites/' + id + '/log'), + clearLog: (id: number): Promise> => request.delete('/websites/' + id + '/log'), // 更新备注 updateRemark: (id: number, remark: string): Promise> => request.post('/websites/' + id + '/updateRemark', { remark }), diff --git a/web/src/api/plugins/openresty/index.ts b/web/src/api/plugins/openresty/index.ts deleted file mode 100644 index 5915a04a..00000000 --- a/web/src/api/plugins/openresty/index.ts +++ /dev/null @@ -1,16 +0,0 @@ -import { request } from '@/utils' -import type { AxiosResponse } from 'axios' - -export default { - // 负载状态 - load: (): Promise> => request.get('/plugins/openresty/load'), - // 获取配置 - config: (): Promise> => request.get('/plugins/openresty/config'), - // 保存配置 - saveConfig: (config: string): Promise> => - request.post('/plugins/openresty/config', { config }), - // 获取错误日志 - errorLog: (): Promise> => request.get('/plugins/openresty/errorLog'), - // 清空错误日志 - clearErrorLog: (): Promise> => request.post('/plugins/openresty/clearErrorLog') -} diff --git a/web/src/api/plugins/phpmyadmin/index.ts b/web/src/api/plugins/phpmyadmin/index.ts deleted file mode 100644 index 5df266d3..00000000 --- a/web/src/api/plugins/phpmyadmin/index.ts +++ /dev/null @@ -1,15 +0,0 @@ -import { request } from '@/utils' -import type { AxiosResponse } from 'axios' - -export default { - // 获取信息 - info: (): Promise> => request.get('/plugins/phpmyadmin/info'), - // 设置端口 - port: (port: number): Promise> => - request.post('/plugins/phpmyadmin/port', { port }), - // 获取配置 - getConfig: (): Promise> => request.get('/plugins/phpmyadmin/config'), - // 保存配置 - saveConfig: (config: string): Promise> => - request.post('/plugins/phpmyadmin/config', { config }) -} diff --git a/web/src/api/plugins/postgresql/index.ts b/web/src/api/plugins/postgresql/index.ts deleted file mode 100644 index 686ecf39..00000000 --- a/web/src/api/plugins/postgresql/index.ts +++ /dev/null @@ -1,57 +0,0 @@ -import { request } from '@/utils' -import type { AxiosResponse } from 'axios' - -export default { - // 负载状态 - load: (): Promise> => request.get('/plugins/postgresql/load'), - // 获取配置 - config: (): Promise> => request.get('/plugins/postgresql/config'), - // 保存配置 - saveConfig: (config: string): Promise> => - request.post('/plugins/postgresql/config', { config }), - // 获取用户配置 - userConfig: (): Promise> => request.get('/plugins/postgresql/userConfig'), - // 保存配置 - saveUserConfig: (config: string): Promise> => - request.post('/plugins/postgresql/userConfig', { config }), - // 获取日志 - log: (): Promise> => request.get('/plugins/postgresql/log'), - // 清空错误日志 - clearLog: (): Promise> => request.post('/plugins/postgresql/clearLog'), - // 数据库列表 - databases: (page: number, limit: number): Promise> => - request.get('/plugins/postgresql/databases', { params: { page, limit } }), - // 创建数据库 - addDatabase: (database: any): Promise> => - request.post('/plugins/postgresql/databases', database), - // 删除数据库 - deleteDatabase: (database: string): Promise> => - request.delete('/plugins/postgresql/databases', { params: { database } }), - // 备份列表 - backups: (page: number, limit: number): Promise> => - request.get('/plugins/postgresql/backups', { params: { page, limit } }), - // 创建备份 - createBackup: (database: string): Promise> => - request.post('/plugins/postgresql/backups', { database }), - // 上传备份 - uploadBackup: (backup: any): Promise> => - request.put('/plugins/postgresql/backups', backup), - // 删除备份 - deleteBackup: (name: string): Promise> => - request.delete('/plugins/postgresql/backups', { params: { name } }), - // 还原备份 - restoreBackup: (backup: string, database: string): Promise> => - request.post('/plugins/postgresql/backups/restore', { backup, database }), - // 角色列表 - roles: (page: number, limit: number): Promise> => - request.get('/plugins/postgresql/roles', { params: { page, limit } }), - // 创建角色 - addRole: (user: any): Promise> => - request.post('/plugins/postgresql/roles', user), - // 删除角色 - deleteRole: (user: string): Promise> => - request.delete('/plugins/postgresql/roles', { params: { user } }), - // 设置角色密码 - setRolePassword: (user: string, password: string): Promise> => - request.post('/plugins/postgresql/roles/password', { user, password }) -} diff --git a/web/src/api/plugins/redis/index.ts b/web/src/api/plugins/redis/index.ts deleted file mode 100644 index 8e3d6324..00000000 --- a/web/src/api/plugins/redis/index.ts +++ /dev/null @@ -1,12 +0,0 @@ -import { request } from '@/utils' -import type { AxiosResponse } from 'axios' - -export default { - // 负载状态 - load: (): Promise> => request.get('/plugins/redis/load'), - // 获取配置 - config: (): Promise> => request.get('/plugins/redis/config'), - // 保存配置 - saveConfig: (config: string): Promise> => - request.post('/plugins/redis/config', { config }) -} diff --git a/web/src/api/plugins/supervisor/index.ts b/web/src/api/plugins/supervisor/index.ts deleted file mode 100644 index 29da895b..00000000 --- a/web/src/api/plugins/supervisor/index.ts +++ /dev/null @@ -1,48 +0,0 @@ -import { request } from '@/utils' -import type { AxiosResponse } from 'axios' - -export default { - // 服务名称 - service: (): Promise> => request.get('/plugins/supervisor/service'), - // 负载状态 - load: (): Promise> => request.get('/plugins/supervisor/load'), - // 获取错误日志 - log: (): Promise> => request.get('/plugins/supervisor/log'), - // 清空错误日志 - clearLog: (): Promise> => request.post('/plugins/supervisor/clearLog'), - // 获取配置 - config: (): Promise> => request.get('/plugins/supervisor/config'), - // 保存配置 - saveConfig: (config: string): Promise> => - request.post('/plugins/supervisor/config', { config }), - // 进程列表 - processes: (page: number, limit: number): Promise> => - request.get('/plugins/supervisor/processes', { params: { page, limit } }), - // 进程启动 - startProcess: (process: string): Promise> => - request.post('/plugins/supervisor/startProcess', { process }), - // 进程停止 - stopProcess: (process: string): Promise> => - request.post('/plugins/supervisor/stopProcess', { process }), - // 进程重启 - restartProcess: (process: string): Promise> => - request.post('/plugins/supervisor/restartProcess', { process }), - // 进程日志 - processLog: (process: string): Promise> => - request.get('/plugins/supervisor/processLog', { params: { process } }), - // 清空进程日志 - clearProcessLog: (process: string): Promise> => - request.post('/plugins/supervisor/clearProcessLog', { process }), - // 进程配置 - processConfig: (process: string): Promise> => - request.get('/plugins/supervisor/processConfig', { params: { process } }), - // 保存进程配置 - saveProcessConfig: (process: string, config: string): Promise> => - request.post('/plugins/supervisor/processConfig', { process, config }), - // 添加进程 - addProcess: (process: any): Promise> => - request.post('/plugins/supervisor/addProcess', process), - // 删除进程 - deleteProcess: (process: string): Promise> => - request.post('/plugins/supervisor/deleteProcess', { process }) -} diff --git a/web/src/api/plugins/toolbox/index.ts b/web/src/api/plugins/toolbox/index.ts deleted file mode 100644 index 51939554..00000000 --- a/web/src/api/plugins/toolbox/index.ts +++ /dev/null @@ -1,28 +0,0 @@ -import { request } from '@/utils' -import type { AxiosResponse } from 'axios' - -export default { - // DNS - dns: (): Promise> => request.get('/plugins/toolbox/dns'), - // 设置 DNS - setDns: (dns1: string, dns2: string): Promise> => - request.post('/plugins/toolbox/dns', { dns1, dns2 }), - // SWAP - swap: (): Promise> => request.get('/plugins/toolbox/swap'), - // 设置 SWAP - setSwap: (size: number): Promise> => - request.post('/plugins/toolbox/swap', { size }), - // 时区 - timezone: (): Promise> => request.get('/plugins/toolbox/timezone'), - // 设置时区 - setTimezone: (timezone: string): Promise> => - request.post('/plugins/toolbox/timezone', { timezone }), - // Hosts - hosts: (): Promise> => request.get('/plugins/toolbox/hosts'), - // 设置 Hosts - setHosts: (hosts: string): Promise> => - request.post('/plugins/toolbox/hosts', { hosts }), - // 设置 Root 密码 - setRootPassword: (password: string): Promise> => - request.post('/plugins/toolbox/rootPassword', { password }) -} diff --git a/web/src/i18n/en.json b/web/src/i18n/en.json index e41fe5d1..94b496d3 100644 --- a/web/src/i18n/en.json +++ b/web/src/i18n/en.json @@ -100,8 +100,8 @@ "supporter": "" } }, - "plugins": { - "title": "Quick Plugin" + "apps": { + "title": "Quick App" } }, "homeUpdate": { @@ -127,8 +127,8 @@ "monitorIndex": { "title": "Monitoring" }, - "pluginIndex": { - "title": "Plugins", + "appIndex": { + "title": "Apps", "alerts": { "info": "Click the button once, please do not click it repeatedly to avoid repeated execution!", "warning": "It is strongly recommended to take a backup/snapshot before upgrading the plug-in to avoid being unable to roll back if problems arise!", @@ -144,9 +144,9 @@ "uninstall": "Uninstall" }, "confirm": { - "install": "Are you sure you want to install the plugin {plugin}?", - "update": "Upgrading the {plugin} plug-in may reset related configurations to the default state. Are you sure you want to continue?", - "uninstall": "Are you sure you want to uninstall the plugin {plugin}?" + "install": "Are you sure you want to install the app {app}?", + "update": "Upgrading the {app} plug-in may reset related configurations to the default state. Are you sure you want to continue?", + "uninstall": "Are you sure you want to uninstall the app {app}?" }, "columns": { "name": "Name", diff --git a/web/src/i18n/zh_CN.json b/web/src/i18n/zh_CN.json index 4e7d4156..94a43593 100644 --- a/web/src/i18n/zh_CN.json +++ b/web/src/i18n/zh_CN.json @@ -100,8 +100,8 @@ "supporter": "" } }, - "plugins": { - "title": "快捷插件" + "apps": { + "title": "快捷应用" } }, "homeUpdate": { @@ -127,11 +127,11 @@ "monitorIndex": { "title": "资源监控" }, - "pluginIndex": { - "title": "插件市场", + "appIndex": { + "title": "应用市场", "alerts": { "info": "按钮点击一次即可,请勿重复点击以免重复执行!", - "warning": "升级插件前强烈建议先备份/快照,以免出现问题时无法回滚!", + "warning": "升级应用前强烈建议先备份/快照,以免出现问题时无法回滚!", "setup": "设置成功", "install": "任务已提交,请稍后查看任务进度", "update": "任务已提交,请前往任务中心查看任务进度", @@ -144,12 +144,12 @@ "uninstall": "卸载" }, "confirm": { - "install": "确定安装插件 {plugin} 吗?", - "update": "升级 {plugin} 插件可能会重置相关配置到默认状态,确定继续吗?", - "uninstall": "确定卸载插件 {plugin} 吗?" + "install": "确定安装应用 {app} 吗?", + "update": "升级 {app} 应用可能会重置相关配置到默认状态,确定继续吗?", + "uninstall": "确定卸载应用 {app} 吗?" }, "columns": { - "name": "插件名", + "name": "应用名", "description": "描述", "installedVersion": "已装版本", "version": "最新版本", diff --git a/web/src/router/guard/plugin-install-guard.ts b/web/src/router/guard/app-install-guard.ts similarity index 51% rename from web/src/router/guard/plugin-install-guard.ts rename to web/src/router/guard/app-install-guard.ts index b73839e4..eac3a190 100644 --- a/web/src/router/guard/plugin-install-guard.ts +++ b/web/src/router/guard/app-install-guard.ts @@ -1,33 +1,33 @@ import type { Router } from 'vue-router' -import plugin from '@/api/panel/plugin' +import app from '@/api/panel/app' -export function createPluginInstallGuard(router: Router) { +export function createAppInstallGuard(router: Router) { router.beforeEach(async (to) => { const slug = to.path.split('/').pop() - if (to.path.startsWith('/plugins/') && slug) { - await plugin.isInstalled(slug).then((res) => { + if (to.path.startsWith('/apps/') && slug) { + await app.isInstalled(slug).then((res) => { if (!res.data.installed) { - window.$message.error(`插件 ${res.data.name} 未安装`) - return router.push({ name: 'plugin-index' }) + window.$message.error(`应用 ${res.data.name} 未安装`) + return router.push({ name: 'app-index' }) } }) } // 网站 if (to.path.startsWith('/website')) { - await plugin.isInstalled('openresty').then((res) => { + await app.isInstalled('openresty').then((res) => { if (!res.data.installed) { window.$message.error(`Web 服务器 ${res.data.name} 未安装`) - return router.push({ name: 'plugin-index' }) + return router.push({ name: 'app-index' }) } }) } // 容器 if (to.path.startsWith('/container')) { - await plugin.isInstalled('podman').then((res) => { + await app.isInstalled('podman').then((res) => { if (!res.data.installed) { window.$message.error(`容器引擎 ${res.data.name} 未安装`) - return router.push({ name: 'plugin-index' }) + return router.push({ name: 'app-index' }) } }) } diff --git a/web/src/router/guard/index.ts b/web/src/router/guard/index.ts index 8a9dd69e..ee8f5329 100644 --- a/web/src/router/guard/index.ts +++ b/web/src/router/guard/index.ts @@ -1,10 +1,10 @@ import type { Router } from 'vue-router' import { createPageLoadingGuard } from './page-loading-guard' import { createPageTitleGuard } from './page-title-guard' -import { createPluginInstallGuard } from './plugin-install-guard' +import { createAppInstallGuard } from './app-install-guard' export function setupRouterGuard(router: Router) { createPageLoadingGuard(router) createPageTitleGuard(router) - createPluginInstallGuard(router) + createAppInstallGuard(router) } diff --git a/web/src/views/plugin/IndexView.vue b/web/src/views/app/IndexView.vue similarity index 73% rename from web/src/views/plugin/IndexView.vue rename to web/src/views/app/IndexView.vue index d5f61182..72159409 100644 --- a/web/src/views/plugin/IndexView.vue +++ b/web/src/views/app/IndexView.vue @@ -1,7 +1,7 @@ @@ -753,31 +607,4 @@ onMounted(() => { - - - - - 创建备份 - - 上传备份 - - - - - -