localhost fix
This commit is contained in:
@@ -254,9 +254,35 @@ class QuixoticApp {
|
||||
audioUrl: data.audioUrl,
|
||||
title: title
|
||||
};
|
||||
console.log('📤 Sending data to Telegram:', payload);
|
||||
this.tg.sendData(JSON.stringify(payload));
|
||||
this.showMessage('✓ MP3 готов! Отправляем в чат...', 'success');
|
||||
console.log('📤 Sending data to Telegram via sendData:', payload);
|
||||
|
||||
try {
|
||||
this.tg.sendData(JSON.stringify(payload));
|
||||
console.log('✅ Data sent via Telegram.sendData');
|
||||
this.showMessage('✓ MP3 готов! Отправляем в чат...', 'success');
|
||||
|
||||
// Fallback: also try to send via HTTP request to our server
|
||||
setTimeout(async () => {
|
||||
try {
|
||||
console.log('🔄 Sending fallback notification to server...');
|
||||
await fetch('/api/telegram-notify', {
|
||||
method: 'POST',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
body: JSON.stringify({
|
||||
userId: this.tg?.initDataUnsafe?.user?.id,
|
||||
audioUrl: data.audioUrl,
|
||||
title: title
|
||||
})
|
||||
});
|
||||
} catch (fallbackError) {
|
||||
console.log('Fallback notification failed (not critical):', fallbackError);
|
||||
}
|
||||
}, 2000); // Wait 2 seconds before fallback
|
||||
|
||||
} catch (sendError) {
|
||||
console.error('❌ Failed to send via Telegram.sendData:', sendError);
|
||||
this.showMessage('❌ Ошибка отправки в Telegram', 'error');
|
||||
}
|
||||
} else {
|
||||
// For testing in browser - download file
|
||||
const link = document.createElement('a');
|
||||
|
||||
Reference in New Issue
Block a user