Deploy: 2026-05-23 18:39:58
This commit is contained in:
@@ -114,14 +114,32 @@ class WhatsAppClient {
|
||||
return;
|
||||
}
|
||||
|
||||
// Use jsDelivr CDN to bypass GitHub User-Agent blocks and rate limiting
|
||||
$fonts = [
|
||||
'Roboto-Bold.ttf' => 'https://github.com/google/fonts/raw/main/apache/roboto/static/Roboto-Bold.ttf',
|
||||
'Lora-Bold.ttf' => 'https://github.com/google/fonts/raw/main/ofl/lora/Lora-Bold.ttf'
|
||||
'Roboto-Bold.ttf' => 'https://cdn.jsdelivr.net/gh/google/fonts@main/apache/roboto/static/Roboto-Bold.ttf',
|
||||
'Lora-Bold.ttf' => 'https://cdn.jsdelivr.net/gh/google/fonts@main/ofl/lora/Lora-Bold.ttf'
|
||||
];
|
||||
|
||||
foreach ($fonts as $filename => $url) {
|
||||
$path = $fontDir . '/' . $filename;
|
||||
if (!file_exists($path) || @filesize($path) < 20000) {
|
||||
|
||||
// Validate if file exists and starts with valid TTF signatures
|
||||
$isValid = false;
|
||||
if (file_exists($path) && filesize($path) > 20000) {
|
||||
$fp = @fopen($path, 'rb');
|
||||
if ($fp) {
|
||||
$sig = fread($fp, 4);
|
||||
fclose($fp);
|
||||
// Match TTF signatures: 0x00010000, 'OTTO', 'true'
|
||||
if ($sig === "\x00\x01\x00\x00" || $sig === "OTTO" || $sig === "true") {
|
||||
$isValid = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!$isValid) {
|
||||
@unlink($path); // Delete invalid/corrupted file
|
||||
|
||||
// Try file_get_contents first
|
||||
$content = @file_get_contents($url);
|
||||
if ($content !== false && strlen($content) > 20000) {
|
||||
|
||||
Reference in New Issue
Block a user