Add T6 Zombies fleet support with Plutainer configuration
This commit is contained in:
@@ -1,16 +1,18 @@
|
||||
import { open, stat } from 'node:fs/promises';
|
||||
import { resolve, sep } from 'node:path';
|
||||
import { config } from '../config.js';
|
||||
import { rootOfServer, gameOfServer } from '../config.js';
|
||||
|
||||
// Whitelisted log files exposed to the UI, mapped to their path relative
|
||||
// to each server's root directory. Adding a new supported log = one entry
|
||||
// here + one tab in LogPanel.svelte.
|
||||
export const KNOWN_LOGS = {
|
||||
console: 'logs/console.log',
|
||||
games_sp: 'logs/games_sp.log'
|
||||
games_sp: 'logs/games_sp.log',
|
||||
games_zm: 'logs/games_zm.log'
|
||||
} as const;
|
||||
|
||||
export type LogKey = keyof typeof KNOWN_LOGS;
|
||||
export const gameLogKey = (server: string): LogKey => gameOfServer(server) === 't6' ? 'games_zm' : 'games_sp';
|
||||
|
||||
export function isLogKey(v: string): v is LogKey {
|
||||
return Object.prototype.hasOwnProperty.call(KNOWN_LOGS, v);
|
||||
@@ -26,7 +28,7 @@ export function isLogKey(v: string): v is LogKey {
|
||||
* Returns null on any escape.
|
||||
*/
|
||||
export function resolveLogPath(serverName: string, key: LogKey): string | null {
|
||||
const serversRoot = resolve(config.serversRoot);
|
||||
const serversRoot = resolve(rootOfServer(serverName));
|
||||
const serverDir = resolve(serversRoot, serverName);
|
||||
if (serverDir === serversRoot || !serverDir.startsWith(serversRoot + sep)) {
|
||||
return null;
|
||||
|
||||
Reference in New Issue
Block a user