<?php
header('Content-Type: application/json; charset=utf-8');
$endpoint = 'https://server.thefull.site/api/rom/community';
$query = $_SERVER['QUERY_STRING'] ?? '';
$url = $query ? $endpoint . '?' . $query : $endpoint;
$ctx = stream_context_create([
    'http' => [
        'method' => 'GET',
        'timeout' => 12,
        'header' => "Accept: application/json\r\nUser-Agent: TheFullPanel/1.0\r\n"
    ]
]);
$json = @file_get_contents($url, false, $ctx);
if ($json === false || trim($json) === '') {
    echo json_encode(['ok' => false, 'rooms' => [], 'games' => [], 'error' => 'servidor_indisponivel']);
    exit;
}
echo $json;
