node.jshttpstelegramtelegram-botnode-telegram-bot-api

telegram game white screen on andoid


I'm developing a game for a telegram bot. I bought hosting and configured the domain https. There was a problem displaying the game on Android. On iPhone and desktop it displays the link to the game correctly, on Android there is a white screen. If you change the link https://www.google.com it is displayed but the simple HTML from my hosting is not displayed on andoid

bot

const TelegramBot = require("node-telegram-bot-api");
const bot = new TelegramBot(TOKEN, {
     polling: true
});

const gameName = "backgammon2";

bot.onText(/start/, (msg) => {
     bot.sendGame(msg.from.id, gameName, {
       game_short_name: gameName
     })
});


bot.on("callback_query", function (query) {
     if (query.game_short_name !== gameName) {
         bot.answerCallbackQuery(query.id, "Sorry, '" + query.game_short_name + "' is not available.");
     } else {
         let gameurl = 'https://backgammon.by/api/test2';
         bot.answerCallbackQuery(query.id, {
             url: gameurl,
         });
     }
});

server

app.get('/api/test2', (req, res) => {
     res.sendFile(__dirname + "/test.html")
})

<!doctype html>
<html lang="en">
<head>
     <meta charset="UTF-8">
     <meta name="viewport"
           content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
     <meta http-equiv="X-UA-Compatible" content="ie=edge">
     <link href="https://fonts.googleapis.com/css2?family=Roboto:wght@400;500;900&display=swap" rel="stylesheet">
     <title>Das Pensionssystem in Österreich</title>
     <script src="https://telegram.org/js/games.js"></script>
</head>
<body>

     <h1>hello</h1>
</body>
</html>

created a bot via @BotFather, set /setinline


Solution

  • The problem was with SSL certificate. Configured nginx instead of nodejs and generate certificate from https://letsencrypt.org/ru/ instead file from my hosting provider. This fixed my problem.