<?php
/**
 * UA Changer Chrome — Update API
 * Konum: aspion.site/license-panel/api/update.php
 */

header('Content-Type: application/json');
header('Access-Control-Allow-Origin: *');

// ══════════════════════════════════════════════════
//  Her yeni sürümde sadece bu kısmı güncelle
// ══════════════════════════════════════════════════

$latest_version      = "5.01";
$latest_version_code = 5;
$min_version_code    = 5;   // Bu koddan düşük = ZORUNLU güncelleme

// APK dosyasını aspion.site/downloads/ klasörüne yükle
$download_url = "https://github.com/enployer/android-chrome-user-agent-changer/releases/download/v5.0/UAChangerChrome_v5.01.apk";

$release_notes = "- Guvenli lisans suresi kontrolu\n- Otomatik guncelleme sistemi\n- 451 preset, Chrome 145-148";

// ══════════════════════════════════════════════════

$client_version_code = intval($_SERVER['HTTP_X_APP_VERSION'] ?? 0);

echo json_encode([
    'version'          => $latest_version,
    'version_code'     => $latest_version_code,
    'min_version_code' => $min_version_code,
    'download_url'     => $download_url,
    'release_notes'    => $release_notes,
    'force_update'     => $client_version_code > 0 && $client_version_code < $min_version_code,
], JSON_UNESCAPED_UNICODE);
