perf: CoinGecko proxy, font-display optional, contrast fix

- Route CoinGecko API through /api/rates.php to avoid CORS blocks
- font-display: optional eliminates font-swap layout shifts (CLS ~0)
- Disabled button contrast: #bbb on #5a3520 (5.8:1 ratio)
- Nginx font caching: 1 year, immutable
This commit is contained in:
Alexander Schmidt
2026-03-25 17:00:20 +01:00
parent 6a9a5b6a75
commit 8d3e37239f
5 changed files with 30 additions and 8 deletions

22
api/rates.php Normal file
View File

@@ -0,0 +1,22 @@
<?php
header('Content-Type: application/json');
header('Cache-Control: public, max-age=60');
$url = 'https://api.coingecko.com/api/v3/simple/price?ids=monero&vs_currencies=eur,usd,chf';
$ch = curl_init($url);
curl_setopt_array($ch, [
CURLOPT_RETURNTRANSFER => true,
CURLOPT_TIMEOUT => 10,
CURLOPT_HTTPHEADER => ['Accept: application/json'],
]);
$response = curl_exec($ch);
$httpCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
curl_close($ch);
if ($response !== false && $httpCode === 200) {
echo $response;
} else {
http_response_code(502);
echo json_encode(['error' => 'Failed to fetch rates']);
}