From f65cf9e38e93ad4edd682315a307ae48a29bbc20 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=80=97=E5=AD=90?= Date: Sat, 13 Jul 2024 03:40:07 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E4=BC=98=E5=8C=96=E8=AE=BE=E7=BD=AE?= =?UTF-8?q?=E9=A1=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/console/commands/panel.go | 6 +++--- app/http/controllers/setting_controller.go | 2 +- app/http/middleware/entrance.go | 2 +- config/http.go | 2 -- config/panel.go | 2 ++ 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/app/console/commands/panel.go b/app/console/commands/panel.go index 9f8cb2cd85..0167aba759 100644 --- a/app/console/commands/panel.go +++ b/app/console/commands/panel.go @@ -165,8 +165,8 @@ func (receiver *Panel) Handle(ctx console.Context) error { color.Green().Printfln(translate.Get("commands.panel.getInfo.username") + ": " + user.Username) color.Green().Printfln(translate.Get("commands.panel.getInfo.password") + ": " + password) color.Green().Printfln(translate.Get("commands.panel.port") + ": " + port) - color.Green().Printfln(translate.Get("commands.panel.entrance") + ": " + facades.Config().GetString("http.entrance")) - color.Green().Printfln(translate.Get("commands.panel.getInfo.address") + ": " + protocol + "://" + ip + ":" + port + facades.Config().GetString("http.entrance")) + color.Green().Printfln(translate.Get("commands.panel.entrance") + ": " + facades.Config().GetString("panel.entrance")) + color.Green().Printfln(translate.Get("commands.panel.getInfo.address") + ": " + protocol + "://" + ip + ":" + port + facades.Config().GetString("panel.entrance")) case "getPort": port, err := shell.Execf(`cat /www/panel/panel.conf | grep APP_PORT | awk -F '=' '{print $2}' | tr -d '\n'`) @@ -178,7 +178,7 @@ func (receiver *Panel) Handle(ctx console.Context) error { color.Green().Printfln(translate.Get("commands.panel.port") + ": " + port) case "getEntrance": - color.Green().Printfln(translate.Get("commands.panel.entrance") + ": " + facades.Config().GetString("http.entrance")) + color.Green().Printfln(translate.Get("commands.panel.entrance") + ": " + facades.Config().GetString("panel.entrance")) case "deleteEntrance": oldEntrance, err := shell.Execf(`cat /www/panel/panel.conf | grep APP_ENTRANCE | awk -F '=' '{print $2}' | tr -d '\n'`) diff --git a/app/http/controllers/setting_controller.go b/app/http/controllers/setting_controller.go index 9f671fc1d7..3328962e78 100644 --- a/app/http/controllers/setting_controller.go +++ b/app/http/controllers/setting_controller.go @@ -62,7 +62,7 @@ func (r *SettingController) List(ctx http.Context) http.Response { return Success(ctx, http.Json{ "name": r.setting.Get(models.SettingKeyName), "language": facades.Config().GetString("app.locale"), - "entrance": facades.Config().GetString("http.entrance"), + "entrance": facades.Config().GetString("panel.entrance"), "ssl": facades.Config().GetBool("panel.ssl"), "website_path": r.setting.Get(models.SettingKeyWebsitePath), "backup_path": r.setting.Get(models.SettingKeyBackupPath), diff --git a/app/http/middleware/entrance.go b/app/http/middleware/entrance.go index c913d53776..67188ea52f 100644 --- a/app/http/middleware/entrance.go +++ b/app/http/middleware/entrance.go @@ -17,7 +17,7 @@ func Entrance() http.Middleware { return } - entrance := facades.Config().GetString("http.entrance") + entrance := facades.Config().GetString("panel.entrance") if ctx.Request().Path() == entrance { ctx.Request().Session().Put("verify_entrance", true) _ = ctx.Response().Redirect(http.StatusFound, "/login").Render() diff --git a/config/http.go b/config/http.go index 262fe53091..5eca9837f6 100644 --- a/config/http.go +++ b/config/http.go @@ -29,8 +29,6 @@ func init() { "host": "", // HTTP Port "port": config.Env("APP_PORT", "8888"), - // HTTP Entrance - "entrance": config.Env("APP_ENTRANCE", "/"), // HTTPS Configuration "tls": map[string]any{ // HTTPS Host diff --git a/config/panel.go b/config/panel.go index 156d4be4f9..4e703002be 100644 --- a/config/panel.go +++ b/config/panel.go @@ -10,5 +10,7 @@ func init() { "name": "耗子面板", "version": "v2.2.24", "ssl": config.Env("APP_SSL", false), + // 安全入口 + "entrance": config.Env("APP_ENTRANCE", "/"), }) }