<?php
require_once dirname(__DIR__) . '/config.php';

header('Content-Type: application/json');

// 获取最新版本的更新日志
$latest = $db->fetchOne("
    SELECT * FROM updates 
    ORDER BY id DESC 
    LIMIT 1
");

if ($latest) {
    echo json_encode([
        'success' => true,
        'version' => $latest['version'],
        'release_notes' => $latest['release_notes'],
        'package_url' => $latest['package_url'],
        'created_at' => $latest['created_at']
    ]);
} else {
    echo json_encode(['success' => false, 'message' => '暂无更新记录']);
}
?>