33 lines
1.1 KiB
PHP
33 lines
1.1 KiB
PHP
<?php
|
|
// api/config.php - Serve safe config values to frontend
|
|
define('CYBERCHAT_API', true);
|
|
require_once __DIR__ . '/../bootstrap.php';
|
|
sendCorsHeaders();
|
|
|
|
header('Content-Type: application/json');
|
|
header('Cache-Control: no-store');
|
|
|
|
$config = getConfig();
|
|
|
|
// Only expose safe/needed values to frontend
|
|
$safe = [
|
|
'chat' => [
|
|
'max_message_length' => $config['chat']['max_message_length'] ?? 500,
|
|
'max_username_length' => $config['chat']['max_username_length'] ?? 12,
|
|
'poll_interval_ms' => $config['chat']['poll_interval_ms'] ?? 2000,
|
|
],
|
|
'ui' => $config['ui'] ?? [],
|
|
'security' => [
|
|
'min_password_length' => $config['security']['min_password_length'] ?? 4,
|
|
],
|
|
'colors' => $config['colors'] ?? [],
|
|
'voice' => [
|
|
'enabled' => $config['voice']['enabled'] ?? true,
|
|
'max_duration_seconds' => $config['voice']['max_duration_seconds'] ?? 60,
|
|
'max_upload_bytes' => $config['voice']['max_upload_bytes'] ?? 12582912,
|
|
'auto_play_default' => $config['voice']['auto_play_default'] ?? true,
|
|
],
|
|
];
|
|
|
|
echo json_encode($safe);
|