fix: use .png instead of .webp for Telegram photo URL

This commit is contained in:
Nik (Claude)
2026-06-17 09:27:25 +03:00
parent c147c9e839
commit efe85632f5
+6 -4
View File
@@ -345,10 +345,12 @@ async function publishOne(scheduledPost) {
} catch(_) { /* внешний URL или файл не найден — считаем реальным */ } } catch(_) { /* внешний URL или файл не найден — считаем реальным */ }
if (coverIsReal) { if (coverIsReal) {
photoUrl = article.cover_url.startsWith('http') // Telegram не принимает .webp по URL — используем .png версию
? article.cover_url const coverForTg = article.cover_url.replace(/\.webp$/, '.png');
: `https://zeropost.ru${article.cover_url}`; photoUrl = coverForTg.startsWith('http')
console.log(`[scheduled-runner] cover=${article.cover_url.split('/').pop()} article=${article.id}`); ? coverForTg
: `https://zeropost.ru${coverForTg}`;
console.log(`[scheduled-runner] cover=${coverForTg.split('/').pop()} article=${article.id}`);
} else { } else {
const attempts = scheduledPost.cover_regen_attempts || 0; const attempts = scheduledPost.cover_regen_attempts || 0;
const MAX_REGEN_ATTEMPTS = 3; // 3 × 15 мин = 45 мин максимум ждём const MAX_REGEN_ATTEMPTS = 3; // 3 × 15 мин = 45 мин максимум ждём