Add T6 Zombies fleet support with Plutainer configuration
This commit is contained in:
@@ -1,10 +1,10 @@
|
||||
import { db } from '../db/index.js';
|
||||
import { t5ZombieMapBySlug } from './map-aliases.js';
|
||||
import { zombieMapBySlug } from './map-aliases.js';
|
||||
|
||||
export function validServerId(value: unknown): value is string {
|
||||
if (typeof value !== 'string') return false;
|
||||
const match = /^t5_zombie_([a-z0-9]+)_([1-9]|1[0-9]|20)$/.exec(value);
|
||||
return !!match && !!t5ZombieMapBySlug(match[1]);
|
||||
const match = /^(t5|t6)_zombie_([a-z0-9]+)_([1-9]|1[0-9]|20)$/.exec(value);
|
||||
return !!match && !!zombieMapBySlug(match[1], match[2]);
|
||||
}
|
||||
|
||||
export function listServerKeys() {
|
||||
@@ -21,7 +21,7 @@ export function getServerKey(serverId: string): string | undefined {
|
||||
}
|
||||
|
||||
export function saveServerKey(serverId: unknown, key: unknown): void {
|
||||
if (!validServerId(serverId)) throw new Error('Choose a valid T5 zombie server ID with a lobby number from 1 to 20');
|
||||
if (!validServerId(serverId)) throw new Error('Choose a valid T5 or T6 zombie server ID with a lobby number from 1 to 20');
|
||||
if (typeof key !== 'string' || !key.trim() || key.trim().length > 512 || /\s/.test(key.trim())) {
|
||||
throw new Error('Enter a server key without whitespace (maximum 512 characters)');
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user