From 4aea10b1950558fc3fc03173f73674939aa0f51e Mon Sep 17 00:00:00 2001 From: Ruslan Bakiev <572431+veikab@users.noreply.github.com> Date: Wed, 13 May 2026 20:10:00 +0700 Subject: [PATCH] Use static Telegram login lifetime label --- src/auth/telegram-bot-login.ts | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/src/auth/telegram-bot-login.ts b/src/auth/telegram-bot-login.ts index 66bf6f4..b6c086e 100644 --- a/src/auth/telegram-bot-login.ts +++ b/src/auth/telegram-bot-login.ts @@ -112,25 +112,22 @@ export async function fetchTelegramPhoto(fileId: string) { }; } -function formatRemaining(expiresAt: Date) { - const seconds = Math.max(0, Math.ceil((expiresAt.getTime() - Date.now()) / 1000)); - const minutes = Math.floor(seconds / 60).toString(); - const rest = (seconds % 60).toString().padStart(2, '0'); - return `${minutes}:${rest}`; +function formatLoginLifetime() { + const minutes = Math.ceil(config.botLoginMaxAgeSeconds / 60); + return `${minutes} мин`; } async function sendLoginMessage( chatId: number, text: string, token?: string, - expiresAt?: Date, ) { const replyMarkup = token ? { inline_keyboard: [ [ { - text: `Открыть MapFlow · ${formatRemaining(expiresAt ?? expiresIn(0))}`, + text: `Открыть MapFlow · ${formatLoginLifetime()}`, url: `${config.webAppUrl}?telegram_login=${encodeURIComponent(token)}`, }, ], @@ -245,5 +242,5 @@ export async function handleTelegramBotWebhook( }, }); - await sendLoginMessage(chatId, 'MapFlow', token, request.expiresAt); + await sendLoginMessage(chatId, 'MapFlow', token); }