Fixed TG login
Build and Publish / Build and Publish Docker Image (push) Successful in 5m9s

This commit is contained in:
ab
2026-07-06 16:30:16 +03:00
parent 3b4899f785
commit 2dbbdb0252
10 changed files with 239 additions and 11 deletions
+24 -2
View File
@@ -480,6 +480,8 @@ function configsPage() {
telegramModal: null,
telegramBusy: false,
telegramPromptChecked: false,
telegramStatusTimer: null,
telegramStatusPolling: false,
isAdmin: {% if is_admin %}true{% else %}false{% endif %},
init() {
this.initTelegramWebApp();
@@ -489,6 +491,7 @@ function configsPage() {
this.loadRolloutStatus();
this.rolloutTimer = setInterval(() => this.loadRolloutStatus(), 10000);
}
this.telegramStatusTimer = setInterval(() => this.pollTelegramStatus(), 2500);
},
async request(url, options = {}) {
const response = await fetch(url, {
@@ -516,11 +519,11 @@ function configsPage() {
this.telegram.isWebApp = Boolean(webApp.initData);
this.telegram.initData = webApp.initData || '';
},
async loadTelegramStatus() {
async loadTelegramStatus(options = {}) {
try {
const status = await this.request('/api/telegram-link/status');
this.applyTelegramStatus(status);
this.maybePromptTelegram();
if (options.prompt !== false) this.maybePromptTelegram();
} catch (e) {
console.warn('telegram status failed', e);
}
@@ -595,6 +598,25 @@ function configsPage() {
this.telegramBusy = false;
}
},
async pollTelegramStatus() {
if (this.telegramStatusPolling || this.telegramBusy) return;
if (!this.telegram.enabled || !this.telegram.pending) return;
if (this.telegramModal !== 'manualGuide' && this.telegramModal !== 'manage') return;
this.telegramStatusPolling = true;
const wasPending = this.telegram.pending;
try {
await this.loadTelegramStatus({ prompt: false });
if (wasPending && this.telegram.linked) {
this.telegramModal = 'manage';
this.setNotice('success', '{{ t.notice_success_title }}', '{{ t.telegram_saved }}');
} else if (wasPending && !this.telegram.pending) {
this.telegramModal = 'manage';
}
} finally {
this.telegramStatusPolling = false;
}
},
async copyTelegramSecret() {
if (!this.telegram.pending_secret) return;
this.clearNotice();