feat(settings): добавить Bot API URL и ячейку ошибок уведомлений
Docker / build (push) Failing after 26s

Монитор больше не ставит «Внимание» по скрытому счётчику. Telegram можно слать через локальный telegram-bot-api.

Co-authored-by: Cursor <[email protected]>
This commit is contained in:
Denozordec
2026-08-22 02:29:07 +07:00
co-authored by Cursor
parent 9214d6fbab
commit 9e0311b53a
21 changed files with 235 additions and 20 deletions
+17
View File
@@ -2,6 +2,21 @@ import { z } from 'zod'
import { customFieldsSchema } from './custom-fields.js'
import { appSwitcherConfigSchema } from './app-switcher.js'
/** Cloud Bot API origin. Local telegram-bot-api: http://127.0.0.1:8081 or https via TLS proxy. */
export const DEFAULT_TELEGRAM_API_URL = 'https://api.telegram.org'
export function normalizeTelegramApiUrl(raw?: string | null): string {
const trimmed = String(raw ?? '').trim()
if (!trimmed) return DEFAULT_TELEGRAM_API_URL
return trimmed.replace(/\/+$/, '').replace(/\/bot$/i, '')
}
export const telegramApiUrlSchema = z
.string()
.optional()
.transform((value) => normalizeTelegramApiUrl(value))
.pipe(z.string().url('Невалидный URL'))
export const settingsSchema = z.object({
id: z.string().optional(),
baseCurrency: z.string().optional(),
@@ -15,6 +30,7 @@ export const settingsSchema = z.object({
uptimeCheckIntervalMinutes: z.coerce.number().optional(),
telegramBotToken: z.string().optional(),
telegramChatId: z.string().optional(),
telegramApiUrl: telegramApiUrlSchema,
telegramMessageThreadId: z.string().optional(),
notifyPaymentExpiryEnabled: z.boolean().optional(),
notifyNewTariffsEnabled: z.boolean().optional(),
@@ -36,6 +52,7 @@ export type Settings = z.infer<typeof settingsSchema>
export const telegramTestBodySchema = z.object({
telegramBotToken: z.string().optional(),
telegramChatId: z.string().optional(),
telegramApiUrl: z.string().url('Невалидный URL').or(z.literal('')).optional(),
telegramMessageThreadId: z.string().optional(),
})