From c0e480092e3d571adead59f21c0dd503513efc97 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=88=98=E5=AD=90=E6=97=BA?= <15039612+liu-ziwang123@user.noreply.gitee.com> Date: Wed, 30 Oct 2024 17:39:53 +0800 Subject: [PATCH] =?UTF-8?q?fix:=E4=BF=AE=E5=A4=8Dconfig=E8=8E=B7=E5=8F=96?= =?UTF-8?q?=E5=80=BC=E6=96=AD=E8=A8=80=E5=A4=B1=E8=B4=A5=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- godo/cmd/main.go | 2 +- godo/files/os.go | 24 +++++++++++------------- 2 files changed, 12 insertions(+), 14 deletions(-) diff --git a/godo/cmd/main.go b/godo/cmd/main.go index 7bef3f6..c325e0c 100644 --- a/godo/cmd/main.go +++ b/godo/cmd/main.go @@ -102,7 +102,7 @@ func OsStart() { fileRouter.HandleFunc("/watch", files.WatchHandler).Methods(http.MethodGet) fileRouter.HandleFunc("/setfilepwd", files.HandleSetFilePwd).Methods(http.MethodGet) fileRouter.HandleFunc("/changefilepwd", files.HandleChangeFilePwd).Methods(http.MethodGet) - fileRouter.HandleFunc("/changeisPwd", files.HandleSetIsPwd).Methods(http.MethodGet) + fileRouter.HandleFunc("/changeispwd", files.HandleSetIsPwd).Methods(http.MethodGet) localchatRouter := router.PathPrefix("/localchat").Subrouter() localchatRouter.HandleFunc("/message", localchat.HandleMessage).Methods(http.MethodPost) diff --git a/godo/files/os.go b/godo/files/os.go index 6898727..0de8c97 100644 --- a/godo/files/os.go +++ b/godo/files/os.go @@ -369,19 +369,17 @@ func GetSalt(r *http.Request) string { // 获取密码标识位,没有添加上 func GetPwdFlag() bool { - // TODO@lzw:这里有一个bug,ispwd的值存储的是bool类型,但是读取的时候是float64类型,导致无法正确读取 - // isPwd, has := libs.GetConfig("isPwd") - // if !has { - // req := libs.ReqBody{ - // Name: "isPwd", - // Value: false, - // } - // libs.SetConfig(req) - // libs.SaveConfig() - // return false - // } - // return isPwd.(bool) - return false + isPwd, has := libs.GetConfig("isPwd") + if !has { + req := libs.ReqBody{ + Name: "isPwd", + Value: false, + } + libs.SetConfig(req) + libs.SaveConfig() + return false + } + return isPwd.(bool) } // 判读一个目录下有没有同名隐藏文件