mirror of
https://github.com/openfrontio/OpenFrontIO.git
synced 2026-06-23 06:29:38 +00:00
Merge branch 'v26'
This commit is contained in:
@@ -390,6 +390,13 @@ export class PlayerImpl implements Player {
|
||||
if (other === this) {
|
||||
return false;
|
||||
}
|
||||
if (this.isDisconnected() || other.isDisconnected()) {
|
||||
// Disconnected players are marked as not-friendly even if they are allies,
|
||||
// so we need to return early if either player is disconnected.
|
||||
// Otherise we could end up sending an alliance request to someone
|
||||
// we are already allied with.
|
||||
return false;
|
||||
}
|
||||
if (this.isFriendly(other) || !this.isAlive()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import { Cosmetics } from "../core/CosmeticSchemas";
|
||||
import { decodePatternData } from "../core/PatternDecoder";
|
||||
import {
|
||||
FlagSchema,
|
||||
PlayerColor,
|
||||
PlayerCosmeticRefs,
|
||||
PlayerCosmetics,
|
||||
@@ -42,10 +43,14 @@ export class PrivilegeCheckerImpl implements PrivilegeChecker {
|
||||
}
|
||||
}
|
||||
if (refs.flag) {
|
||||
cosmetics.flag = cosmetics.flag = refs.flag.replace(
|
||||
/[^a-z0-9-_ ()]/gi,
|
||||
"",
|
||||
);
|
||||
const result = FlagSchema.safeParse(refs.flag);
|
||||
if (!result.success) {
|
||||
return {
|
||||
type: "forbidden",
|
||||
reason: "invalid flag: " + result.error.message,
|
||||
};
|
||||
}
|
||||
cosmetics.flag = result.data;
|
||||
}
|
||||
|
||||
return { type: "allowed", cosmetics };
|
||||
|
||||
Reference in New Issue
Block a user