Skip to content

📈 Open source, privacy-first web analytics — a cookie-less Google Analytics alternative with built-in error tracking and performance monitoring. Self-host it or use our cloud. Get started for free!

fix auth telegram notification

Blue Mouse557a96adce55
diff --git a/src/auth/auth.controller.ts b/src/auth/auth.controller.ts
index 7bcc10023..bbc09bcee 100644
--- a/src/auth/auth.controller.ts
+++ b/src/auth/auth.controller.ts
@@ -133,14 +133,18 @@ export class AuthController {
if (user.isTelegramChatIdConfirmed && process.env.TG_BOT_TOKEN) {
const ua = UAParser(userAgent)
- const br = ua.browser.name || 'unknown'
- const dv = ua.device.type || 'desktop'
- const os = ua.os.name || 'unknown'
- const tz = Intl.DateTimeFormat().resolvedOptions().timeZone
- const cc =
- ct.getCountryForTimezone(tz)?.id ||
- (headers['cf-ipcountry'] === 'XX' ? 'NULL' : headers['cf-ipcountry'])
- const country = ct.getCountry(cc)?.name || 'unknown'
+ const br = ua.browser.name || 'Unknown'
+ const dv = ua.device.type || 'Desktop'
+ const os = ua.os.name || 'Unknown'
+ let country
+
+ if (headers['cf-ipcountry'] === 'XX') {
+ country = 'Unknown'
+ } else if (headers['cf-ipcountry'] === 'T1') {
+ country = 'Unknown (Tor Browser detected)'
+ } else {
+ ct.getCountry(headers['cf-ipcountry'])?.name || 'Unknown'
+ }
this.bot.telegram.sendMessage(
user.telegramChatId,
@@ -154,8 +158,6 @@ export class AuthController {
'\n' +
`Country: \`${country}\`` +
'\n' +
- `Timezone: \`${tz}\`` +
- '\n' +
`IP: \`${ip}\`` +
'\n\n' +
`If it was you, ignore this message. If not, please contact customer support immediately.`,