<?php
include 'config.php';

// Token Verify
if ($_GET['auth_token'] !== AUTH_TOKEN) {
    die(json_encode(["error" => "Unauthorized Access"]));
}

// Latest DB File
$db_files = array_diff(scandir(DB_DIR, SCANDIR_SORT_DESCENDING), array('.', '..'));
$latest_db = reset($db_files);

// Latest APK File
$app_files = array_diff(scandir(APP_DIR, SCANDIR_SORT_DESCENDING), array('.', '..'));
$latest_apk = reset($app_files);

echo json_encode(["latest_db" => $latest_db, "latest_apk" => $latest_apk]);
?>
