Control 설정 모달 입력 보존 개선

This commit is contained in:
seo
2026-06-26 04:42:43 +09:00
parent da8c4e863d
commit ebef879634
5 changed files with 58 additions and 27 deletions
+6 -5
View File
@@ -3058,7 +3058,8 @@ function systemd_service_logs(string $unit, int $limit = 12): array
function custom_systemd_services(): array
{
$cachePath = '/tmp/control-custom-services.json';
if (is_file($cachePath) && filemtime($cachePath) >= time() - 5) {
$cacheSeconds = (int)setting_value('display.custom_service_cache_seconds');
if (is_file($cachePath) && filemtime($cachePath) >= time() - $cacheSeconds) {
$cached = json_decode((string)@file_get_contents($cachePath), true);
if (is_array($cached)) {
return $cached;
@@ -3104,7 +3105,7 @@ function custom_systemd_services(): array
foreach ($names as $name) {
$record = $records[$name] ?? [];
$logs = systemd_service_logs($name, 12);
$logs = systemd_service_logs($name, (int)setting_value('display.custom_service_log_lines'));
$rows[] = [
'name' => $name,
@@ -3259,7 +3260,7 @@ function collect_snapshot(bool $applyFan = true): array
], $battery['remaining']['seconds'] ?? null);
$history = array_slice($history, -(int)setting_value('battery.history_sync_limit'));
$processes = process_resource_data(6);
$processes = process_resource_data((int)setting_value('display.process_limit'));
$fanSpike = fan_spike_analysis($history, $fan, $system, $processes);
$shouldLogNotice = !empty($fanSpike['alert_started'])
@@ -3297,8 +3298,8 @@ function collect_snapshot(bool $applyFan = true): array
'processes' => $processes,
'custom_services' => custom_systemd_services(),
'fan_spike' => $fanSpike,
'fan_spike_history' => fan_spike_history(100),
'ha_notify_history' => ha_notify_log_rows(20),
'fan_spike_history' => fan_spike_history((int)setting_value('display.fan_notice_history_limit')),
'ha_notify_history' => ha_notify_log_rows((int)setting_value('display.ha_notify_history_limit')),
'settings' => settings_payload(),
];