Skip to content

Commit

Permalink
feat: 优化设置项
Browse files Browse the repository at this point in the history
  • Loading branch information
devhaozi committed Jul 12, 2024
1 parent 4a8ebfb commit f65cf9e
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 7 deletions.
6 changes: 3 additions & 3 deletions app/console/commands/panel.go
Original file line number Diff line number Diff line change
Expand Up @@ -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'`)
Expand All @@ -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'`)
Expand Down
2 changes: 1 addition & 1 deletion app/http/controllers/setting_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down
2 changes: 1 addition & 1 deletion app/http/middleware/entrance.go
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
2 changes: 0 additions & 2 deletions config/http.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions config/panel.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,7 @@ func init() {
"name": "耗子面板",
"version": "v2.2.24",
"ssl": config.Env("APP_SSL", false),
// 安全入口
"entrance": config.Env("APP_ENTRANCE", "/"),
})
}

0 comments on commit f65cf9e

Please sign in to comment.