mirror of
https://github.com/whekin/household-bot.git
synced 2026-04-01 03:04:03 +00:00
feat(miniapp): add telegram-authenticated shell
This commit is contained in:
27
apps/miniapp/src/telegram-webapp.ts
Normal file
27
apps/miniapp/src/telegram-webapp.ts
Normal file
@@ -0,0 +1,27 @@
|
||||
export interface TelegramWebAppUser {
|
||||
id: number
|
||||
first_name?: string
|
||||
username?: string
|
||||
language_code?: string
|
||||
}
|
||||
|
||||
export interface TelegramWebApp {
|
||||
initData: string
|
||||
initDataUnsafe?: {
|
||||
user?: TelegramWebAppUser
|
||||
}
|
||||
ready?: () => void
|
||||
expand?: () => void
|
||||
}
|
||||
|
||||
declare global {
|
||||
interface Window {
|
||||
Telegram?: {
|
||||
WebApp?: TelegramWebApp
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export function getTelegramWebApp(): TelegramWebApp | undefined {
|
||||
return window.Telegram?.WebApp
|
||||
}
|
||||
Reference in New Issue
Block a user