chore: refactor

This commit is contained in:
naiba
2025-01-04 12:32:29 +08:00
parent 81a08a38da
commit 3999d1f99a
3 changed files with 12 additions and 8 deletions

View File

@@ -160,15 +160,13 @@ func listServerWithServices(c *gin.Context) ([]uint64, error) {
for _, id := range serverIdsWithService {
singleton.ServerLock.RLock()
server, ok := singleton.ServerList[id]
if !ok {
singleton.ServerLock.RUnlock()
singleton.ServerLock.RUnlock()
if !ok || server == nil {
return nil, singleton.Localizer.ErrorT("server not found")
}
if !server.HideForGuest || authorized {
ret = append(ret, id)
}
singleton.ServerLock.RUnlock()
}
return ret, nil