- Changed window size to mobile phone format (400x800) - Removed width condition for ActiveProxyFooter - now always visible - Added run-umbrix.sh launch script with icon copying - Stats cards now display on all screen sizes
68 lines
2.4 KiB
PHP
68 lines
2.4 KiB
PHP
<?php
|
|
/**
|
|
* Umbrix Update Manager - Version History API
|
|
* Получение списка всех сохранённых версий (бэкапов)
|
|
*/
|
|
|
|
header('Access-Control-Allow-Origin: *');
|
|
header('Content-Type: application/json; charset=utf-8');
|
|
|
|
$backups_dir = __DIR__ . '/../';
|
|
$versions = [];
|
|
|
|
// Сканируем директорию на наличие бэкапов
|
|
$files = glob($backups_dir . 'latest.json.backup.*');
|
|
|
|
// Также добавляем текущую версию
|
|
if (file_exists($backups_dir . 'latest.json')) {
|
|
$current = json_decode(file_get_contents($backups_dir . 'latest.json'), true);
|
|
if ($current) {
|
|
$versions[] = [
|
|
'filename' => 'latest.json',
|
|
'version' => $current['version'] ?? 'unknown',
|
|
'build_number' => $current['build_number'] ?? 0,
|
|
'published_at' => $current['published_at'] ?? null,
|
|
'is_prerelease' => $current['is_prerelease'] ?? false,
|
|
'is_current' => true,
|
|
'timestamp' => file_exists($backups_dir . 'latest.json') ? filemtime($backups_dir . 'latest.json') : time(),
|
|
'size' => filesize($backups_dir . 'latest.json')
|
|
];
|
|
}
|
|
}
|
|
|
|
// Добавляем все бэкапы
|
|
foreach ($files as $file) {
|
|
$content = json_decode(file_get_contents($file), true);
|
|
if ($content) {
|
|
$filename = basename($file);
|
|
|
|
// Извлекаем дату из имени файла (формат: latest.json.backup.2026-01-17_08-30-45)
|
|
preg_match('/backup\.(\d{4}-\d{2}-\d{2}_\d{2}-\d{2}-\d{2})/', $filename, $matches);
|
|
$backup_date = $matches[1] ?? null;
|
|
|
|
$versions[] = [
|
|
'filename' => $filename,
|
|
'version' => $content['version'] ?? 'unknown',
|
|
'build_number' => $content['build_number'] ?? 0,
|
|
'published_at' => $content['published_at'] ?? null,
|
|
'is_prerelease' => $content['is_prerelease'] ?? false,
|
|
'is_current' => false,
|
|
'timestamp' => filemtime($file),
|
|
'backup_date' => $backup_date,
|
|
'size' => filesize($file),
|
|
'release_notes' => $content['release_notes'] ?? ''
|
|
];
|
|
}
|
|
}
|
|
|
|
// Сортируем по времени (новые сверху)
|
|
usort($versions, function($a, $b) {
|
|
return $b['timestamp'] - $a['timestamp'];
|
|
});
|
|
|
|
echo json_encode([
|
|
'success' => true,
|
|
'count' => count($versions),
|
|
'versions' => $versions
|
|
]);
|