-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathindex.html
More file actions
46 lines (41 loc) · 1.63 KB
/
index.html
File metadata and controls
46 lines (41 loc) · 1.63 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<link rel="preconnect" href="https://fonts.googleapis.com" />
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
<link
href="https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@200;300;400;500;600;700;800&display=swap"
rel="stylesheet"
/>
<link
href="https://fonts.googleapis.com/css2?family=Bungee&family=Plus+Jakarta+Sans:[email protected]&display=swap"
rel="stylesheet"
/>
<title>Tweetle</title>
<script src="https://telegram.org/js/telegram-web-app.js"></script>
</head>
<body>
<div id="root"></div>
<script type="module" src="/src/main.tsx"></script>
<script>
// Initialize Telegram WebApp
Telegram.WebApp.ready();
// Retrieve Telegram user info
const userData = Telegram.WebApp.initDataUnsafe;
// Extract the Telegram ID
const telegramId = userData.user?.id;
const telegramUsername = userData.user?.username;
if (telegramId) {
// save item to localstorage
localStorage.setItem("tg_id", telegramId);
localStorage.setItem("tg_name", telegramUsername);
console.log("saved");
} else {
console.log("TELEGRAM ID NOT FOUND...");
}
</script>
</body>
</html>