Closed Scallywer closed 4 days ago
public getServerMods(): IMod[] {
const stats = this.getServerStats();
// Validate the existence of the required structure
if (!stats || !stats.Server?.Mods?.Mod) {
return []; // Return an empty array if mods are unavailable
}
// Normalize modList and assert its type
let modList: { [k: string]: unknown; name?: string; author?: string; version?: string; hash?: string; _text?: string; }[] =
Array.isArray(stats.Server.Mods.Mod)
? stats.Server.Mods.Mod
: [stats.Server.Mods.Mod];
// Map modList to IMod
return modList.map((mod) => ({
name: mod.name || 'Unknown Mod',
author: mod.author || 'Unknown Author',
version: mod.version || 'Unknown Version',
hash: mod.hash || '',
_text: mod._text || '',
}) as IMod);
}
Thank you @Scallywer for reporting this issue. I've released a hotfix for this issue. Please update your project via git pull
and restart the project via one of these methods:
docker compose up --build
for testing, for production docker compose up -d --build
npm i
and npm start
pnpm i
and pnpm start
Config file (obfuscated a bit):