Browse Source

fix:修复config获取值断言失败问题

master
刘子旺 7 months ago
parent
commit
c0e480092e
  1. 2
      godo/cmd/main.go
  2. 24
      godo/files/os.go

2
godo/cmd/main.go

@ -102,7 +102,7 @@ func OsStart() {
fileRouter.HandleFunc("/watch", files.WatchHandler).Methods(http.MethodGet) fileRouter.HandleFunc("/watch", files.WatchHandler).Methods(http.MethodGet)
fileRouter.HandleFunc("/setfilepwd", files.HandleSetFilePwd).Methods(http.MethodGet) fileRouter.HandleFunc("/setfilepwd", files.HandleSetFilePwd).Methods(http.MethodGet)
fileRouter.HandleFunc("/changefilepwd", files.HandleChangeFilePwd).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 := router.PathPrefix("/localchat").Subrouter()
localchatRouter.HandleFunc("/message", localchat.HandleMessage).Methods(http.MethodPost) localchatRouter.HandleFunc("/message", localchat.HandleMessage).Methods(http.MethodPost)

24
godo/files/os.go

@ -369,19 +369,17 @@ func GetSalt(r *http.Request) string {
// 获取密码标识位,没有添加上 // 获取密码标识位,没有添加上
func GetPwdFlag() bool { func GetPwdFlag() bool {
// TODO@lzw:这里有一个bug,ispwd的值存储的是bool类型,但是读取的时候是float64类型,导致无法正确读取 isPwd, has := libs.GetConfig("isPwd")
// isPwd, has := libs.GetConfig("isPwd") if !has {
// if !has { req := libs.ReqBody{
// req := libs.ReqBody{ Name: "isPwd",
// Name: "isPwd", Value: false,
// Value: false, }
// } libs.SetConfig(req)
// libs.SetConfig(req) libs.SaveConfig()
// libs.SaveConfig() return false
// return false }
// } return isPwd.(bool)
// return isPwd.(bool)
return false
} }
// 判读一个目录下有没有同名隐藏文件 // 判读一个目录下有没有同名隐藏文件

Loading…
Cancel
Save