Auto-sync enabled

FlatlyPage

Version 1.0.1 • 59 files • 798.19 KB
api/get-translate-config.php
<?php
header('Content-Type: application/json; charset=utf-8');
header('Access-Control-Allow-Origin: *');

$xmlPath = __DIR__ . '/../data/translate-api.xml';

if (!file_exists($xmlPath)) {
    http_response_code(404);
    die(json_encode(['error' => 'Config not found']));
}

$xml = simplexml_load_file($xmlPath);
$apis = [];

foreach ($xml->apis->api as $api) {
    $id = (string)$api->id;
    $apis[$id] = [
        'name' => (string)$api->name,
        'free' => (string)$api->free === 'true',
        'rateLimit' => (string)$api->rateLimit ?? ''
    ];
}

echo json_encode($apis);