Moved hardcoded values to config file

This commit is contained in:
2025-10-23 00:56:56 +01:00
parent 04bf1d358f
commit 187ac702bf
3 changed files with 5 additions and 5 deletions

View File

@@ -17,7 +17,7 @@ if ($cmd === '') {
} }
// Restrict dangerous commands for safety // Restrict dangerous commands for safety
$blacklist = ['rm', 'shutdown', 'reboot', 'passwd', 'dd', ':(){']; $blacklist = $CONFIG['blacklist_commands'];
foreach ($blacklist as $bad) { foreach ($blacklist as $bad) {
if (stripos($cmd, $bad) !== false) { if (stripos($cmd, $bad) !== false) {
echo json_encode(['output' => "⚠️ Command '$bad' not allowed"]); echo json_encode(['output' => "⚠️ Command '$bad' not allowed"]);
@@ -30,7 +30,7 @@ $descriptor = [
1 => ['pipe', 'w'], 1 => ['pipe', 'w'],
2 => ['pipe', 'w'] 2 => ['pipe', 'w']
]; ];
$process = proc_open($cmd, $descriptor, $pipes, '/home'); $process = proc_open($cmd, $descriptor, $pipes, $CONFIG['default_dir']);
if (is_resource($process)) { if (is_resource($process)) {
$output = stream_get_contents($pipes[1]); $output = stream_get_contents($pipes[1]);
$error = stream_get_contents($pipes[2]); $error = stream_get_contents($pipes[2]);

View File

@@ -68,7 +68,7 @@ document.addEventListener('DOMContentLoaded', () => {
}); });
await checkAdmin(); await checkAdmin();
setInterval(checkAdmin, 30000); setInterval(checkAdmin, CONFIG.index_admin_status_update_interval);
})(); })();
// --- Page loader --- // --- Page loader ---

View File

@@ -60,9 +60,9 @@ document.addEventListener('page-loaded', e => {
} }
// Color thresholds // Color thresholds
if (numVal >= 85) { if (numVal >= CONFIG.home_chart_color_threshold_high) {
elements[key].className = 'high'; elements[key].className = 'high';
} else if (numVal >= 75) { } else if (numVal >= CONFIG.home_chart_color_threshold_medium) {
elements[key].className = 'medium'; elements[key].className = 'medium';
} else { } else {
elements[key].className = 'low'; elements[key].className = 'low';