<?php
require_once __DIR__ . '/../includes/app_config.php';
streambox_no_cache_headers();
header('Content-Type: application/json; charset=utf-8');

$config = streambox_config_read();
$scheme = (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off') ? 'https' : 'http';
$host = $_SERVER['HTTP_HOST'] ?? '';
$basePath = rtrim(dirname(dirname($_SERVER['SCRIPT_NAME'] ?? '/')), '/');
$base = $scheme . '://' . $host . $basePath;

$out = $config;
$out['logo_url'] = $base . '/img/logo.png?v=' . (int)$config['logo_version'];
$out['background_url'] = $base . '/img/bg.png?v=' . (int)$config['background_version'];
$out['colors_url'] = $base . '/api/cores.php?v=' . (int)$config['colors_version'];
$out['games_url'] = $base . '/api/games.php?v=' . (int)$config['version'];

echo json_encode($out, JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES | JSON_PRETTY_PRINT);
