From 437749acc58fa9d15a313ad89d2be06ab3afe8ac Mon Sep 17 00:00:00 2001 From: wsczx Date: Sun, 24 Aug 2025 01:16:27 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E7=99=BB=E5=BD=95Banner?= =?UTF-8?q?=E5=BC=80=E5=85=B3=EF=BC=8C=E9=BB=98=E8=AE=A4=E5=BC=80=E5=90=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- server/base/cfg.go | 1 + server/base/config.go | 1 + server/conf/server-sample.toml | 2 ++ server/handler/link_auth_otp.go | 11 +++++++---- 4 files changed, 11 insertions(+), 4 deletions(-) diff --git a/server/base/cfg.go b/server/base/cfg.go index fc21898..390b018 100644 --- a/server/base/cfg.go +++ b/server/base/cfg.go @@ -57,6 +57,7 @@ type ServerConfig struct { HttpServerLog bool `json:"http_server_log"` Pprof bool `json:"pprof"` Issuer string `json:"issuer"` + EnableBanner bool `json:"enable_banner"` AdminUser string `json:"admin_user"` AdminPass string `json:"admin_pass"` AdminOtp string `json:"admin_otp"` diff --git a/server/base/config.go b/server/base/config.go index 37d9789..4903ce2 100644 --- a/server/base/config.go +++ b/server/base/config.go @@ -43,6 +43,7 @@ var configs = []config{ {Typ: cfgBool, Name: "http_server_log", Usage: "开启go标准库http.Server的日志", ValBool: false}, {Typ: cfgBool, Name: "pprof", Usage: "开启pprof", ValBool: true}, {Typ: cfgStr, Name: "issuer", Usage: "系统名称", ValStr: "XX公司VPN"}, + {Typ: cfgBool, Name: "enable_banner", Usage: "登录横幅", ValBool: true}, {Typ: cfgStr, Name: "admin_user", Usage: "管理用户名", ValStr: "admin"}, {Typ: cfgStr, Name: "admin_pass", Usage: "管理用户密码", ValStr: defaultPwd}, {Typ: cfgStr, Name: "admin_otp", Usage: "管理用户otp,生成命令 ./anylink tool -o", ValStr: ""}, diff --git a/server/conf/server-sample.toml b/server/conf/server-sample.toml index 77d5135..dda032f 100644 --- a/server/conf/server-sample.toml +++ b/server/conf/server-sample.toml @@ -38,6 +38,8 @@ pprof = true #系统名称 issuer = "XX公司VPN" +#登录横幅 +enable_banner = true #后台管理用户 admin_user = "admin" #pass 123456 diff --git a/server/handler/link_auth_otp.go b/server/handler/link_auth_otp.go index aaad037..43b937b 100644 --- a/server/handler/link_auth_otp.go +++ b/server/handler/link_auth_otp.go @@ -149,10 +149,13 @@ func CreateSession(w http.ResponseWriter, r *http.Request, authSession *AuthSess rd := RequestData{ SessionId: sess.Sid, SessionToken: sess.Sid + "@" + sess.Token, - Banner: other.Banner, - ProfileName: base.Cfg.ProfileName, - ProfileHash: profileHash, - CertHash: certHash, + // Banner: other.Banner, + ProfileName: base.Cfg.ProfileName, + ProfileHash: profileHash, + CertHash: certHash, + } + if base.Cfg.EnableBanner { + rd.Banner = other.Banner } w.WriteHeader(http.StatusOK)