🐛 修复修改服务器导致 Agent 离线

This commit is contained in:
naiba
2021-07-25 23:50:08 +08:00
parent 4ad4bd9d5a
commit c4257ad105
6 changed files with 28 additions and 12 deletions
+1 -1
View File
@@ -13,7 +13,7 @@ import (
pb "github.com/naiba/nezha/proto"
)
var Version = "v0.9.10" // !!记得修改 README 中的 badge 版本!!
var Version = "v0.9.11" // !!记得修改 README 中的 badge 版本!!
var (
Conf *model.Config
+4 -1
View File
@@ -35,8 +35,11 @@ func (a *AuthHandler) Check(ctx context.Context) (uint64, error) {
dao.ServerLock.RLock()
defer dao.ServerLock.RUnlock()
clientID, hasID := dao.SecretToID[clientSecret]
if !hasID {
return 0, status.Errorf(codes.Unauthenticated, "客户端认证失败")
}
_, hasServer := dao.ServerList[clientID]
if !hasID || !hasServer {
if !hasServer {
return 0, status.Errorf(codes.Unauthenticated, "客户端认证失败")
}
return clientID, nil