akanyan/app/ConfigFilesViewer.php
2022-07-11 18:18:14 +08:00

32 lines
766 B
PHP

<?php
namespace MingTsay\Akanyan;
class ConfigFilesViewer extends FileViewer
{
protected static function directory(): string
{
return '/media/sdc/mt/minecraft-docker-image/data';
}
protected static function whitelist(): ?array
{
return [
'banned-ips.json',
'banned-players.json',
'ops.json',
'server.properties',
'usercache.json',
'whitelist.json',
];
}
public static function read($file): ?string
{
$content = parent::read($file);
if ($content !== null && $file === 'server.properties')
$content = preg_replace('/^(rcon\.password)=(.*)$/m', '$1=***hidden***', $content);
return $content;
}
}