mirror of
https://github.com/MBombeck/HealthLog.git
synced 2026-11-15 06:52:04 +00:00
chore(release): v1.4.27
v1.4.27 — Mobile capability and maintainer-finding cleanup. ResponsiveSheet primitive (bottom-sheet on narrow viewports, centred dialog on desktop) applied to BD, Weight, Glucose, Mood, Activity forms. Maintainer-finding cleanups across Coach, Insights, Reports, Privacy. GeoLite2 offline geocoding with resilience layer (graceful fallback when EULA not yet propagated). E2E gap-fill coverage. 450-line release notes attached to the GitHub Release.
This commit is contained in:
1 parent
d98e85cd03
commit
4f09c3f862
314 files changed
+26801
-4419
No files matched your search
@@ -5,6 +5,13 @@ import { sendTelegramMessage } from "@/lib/telegram";
|
||||
import { checkRateLimit } from "@/lib/rate-limit";
|
||||
import { apiHandler, requireAuth } from "@/lib/api-handler";
|
||||
import { annotate } from "@/lib/logging/context";
|
||||
import { defaultLocale, type Locale } from "@/lib/i18n/config";
|
||||
import { getServerTranslator } from "@/lib/i18n/server-translator";
|
||||
|
||||
function isLocale(value: string | null | undefined): value is Locale {
|
||||
return value === "de" || value === "en" || value === "fr" ||
|
||||
value === "es" || value === "it" || value === "pl";
|
||||
}
|
||||
|
||||
/**
|
||||
* Send a test Telegram message to verify the bot token and chat ID.
|
||||
@@ -19,18 +26,27 @@ export const POST = apiHandler(async () => {
|
||||
|
||||
const dbUser = await prisma.user.findUnique({
|
||||
where: { id: user.id },
|
||||
select: { telegramBotToken: true, telegramChatId: true },
|
||||
select: { telegramBotToken: true, telegramChatId: true, locale: true },
|
||||
});
|
||||
|
||||
if (!dbUser?.telegramBotToken || !dbUser?.telegramChatId) {
|
||||
return apiError("Bot token and chat ID must be saved first", 422);
|
||||
}
|
||||
|
||||
// v1.4.27 F21 — the test body now reads from the user's persisted
|
||||
// locale rather than the hardcoded English string. The route talks
|
||||
// to `sendTelegramMessage` directly (it needs the boolean send
|
||||
// result for the UI) so we compose the body via the server
|
||||
// translator rather than going through the dispatcher.
|
||||
const userLocale: Locale = isLocale(dbUser.locale)
|
||||
? dbUser.locale
|
||||
: defaultLocale;
|
||||
const t = getServerTranslator(userLocale).t;
|
||||
const botToken = decrypt(dbUser.telegramBotToken);
|
||||
const result = await sendTelegramMessage(
|
||||
botToken,
|
||||
dbUser.telegramChatId,
|
||||
"HealthLog: Connection successful! Telegram notifications are active.",
|
||||
t("notifications.user.telegramTestBody"),
|
||||
);
|
||||
|
||||
if (!result.ok) {
|
||||
|
||||
Reference in new issue
Block a user