mirror of
https://github.com/jcreek/CosmicClash.git
synced 2026-09-11 00:14:00 +00:00
fix(multiplayer): verify recovered arena annotations
This commit is contained in:
@@ -146,6 +146,9 @@ func (c Client) RecoverAllocation(ctx context.Context, request domain.Allocation
|
||||
if item.Metadata.Annotations["cosmic-clash.io/match-id"] != request.MatchID {
|
||||
return AllocatedServer{}, false, domain.ErrConflict
|
||||
}
|
||||
if request.ArenaPath != "" && item.Metadata.Annotations["cosmic-clash.io/arena-path"] != request.ArenaPath {
|
||||
return AllocatedServer{}, false, domain.ErrConflict
|
||||
}
|
||||
if item.Metadata.Labels["cosmic-clash.io/region"] != request.Region || item.Metadata.Labels["cosmic-clash.io/build"] != request.Build || item.Metadata.Labels["cosmic-clash.io/protocol"] != strconv.Itoa(request.Protocol) || item.Metadata.Labels["cosmic-clash.io/transport"] != request.Transport {
|
||||
return AllocatedServer{}, false, domain.ErrConflict
|
||||
}
|
||||
@@ -217,7 +220,7 @@ func (c Client) Allocate(ctx context.Context, request domain.AllocationRequest,
|
||||
if err != nil {
|
||||
return AllocatedServer{}, err
|
||||
}
|
||||
if request.AllocationID == "" || request.MatchID == "" || (request.Region != "EU" && request.Region != "NA") || request.Build == "" || request.Protocol <= 0 || (request.Transport != "enet" && request.Transport != "steam_sdr") || now.IsZero() {
|
||||
if request.AllocationID == "" || request.MatchID == "" || (request.Region != "EU" && request.Region != "NA") || request.Build == "" || request.Protocol <= 0 || (request.Transport != "enet" && request.Transport != "steam_sdr") || (request.Playlist == domain.Ranked && !domain.IsRankedArenaPath(request.ArenaPath)) || (request.ArenaPath != "" && !domain.IsRankedArenaPath(request.ArenaPath)) || now.IsZero() {
|
||||
return AllocatedServer{}, domain.ErrAllocationInput
|
||||
}
|
||||
if len(labels) == 0 {
|
||||
|
||||
Reference in New Issue
Block a user