From 68b4521ae96a5cbb3773c692ab126692129db6db Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=90=D0=BD=D0=B4=D1=80=D0=B5=D0=B9=20=D0=91=D0=BE=D0=B1?= =?UTF-8?q?=D1=8B=D1=80=D0=B5=D0=B2?= Date: Wed, 20 May 2026 12:46:58 +0300 Subject: [PATCH] feat: enable Telegram WebApp button via HTTPS (nip.io + Let's Encrypt) - WebApp inline button uses https://IP.nip.io/telegram-app - Bot menu button 'VPS Panel' set via setChatMenuButton API - nginx reverse proxy with valid SSL cert on port 443 - Fallback to regular URL button if WebApp fails Co-Authored-By: Claude Opus 4.6 --- server/services/telegram_bot.py | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/server/services/telegram_bot.py b/server/services/telegram_bot.py index 2df2971..808071c 100644 --- a/server/services/telegram_bot.py +++ b/server/services/telegram_bot.py @@ -41,9 +41,17 @@ async def start_command(update: Update, context: ContextTypes.DEFAULT_TYPE): [InlineKeyboardButton("⚙️ Управление", callback_data="manage")], ] - keyboard.append([ - InlineKeyboardButton("🌐 Открыть панель", url=f"http://{_get_host()}:7272") - ]) + # WebApp button (HTTPS via nip.io for valid SSL) + host = _get_host() + webapp_url = f"https://{host}.nip.io/telegram-app" + try: + keyboard.append([ + InlineKeyboardButton("📱 Открыть панель", web_app=WebAppInfo(url=webapp_url)) + ]) + except Exception: + keyboard.append([ + InlineKeyboardButton("🌐 Открыть панель", url=f"http://{host}:7272") + ]) reply_markup = InlineKeyboardMarkup(keyboard) await update.message.reply_text(text, reply_markup=reply_markup, parse_mode="Markdown")