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("/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)

24
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)
}
// 判读一个目录下有没有同名隐藏文件

Loading…
Cancel
Save