Reaperxxxx commited on
Commit
d8d87c8
·
verified ·
1 Parent(s): b96f9ee

Create capt.html

Browse files
Files changed (1) hide show
  1. capt.html +58 -0
capt.html ADDED
@@ -0,0 +1,58 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ How does this work
2
+
3
+ <!doctype html>
4
+ <html>
5
+ <head>
6
+ <meta charset="utf-8" />
7
+ <title>Capture tgWebAppData</title>
8
+ <meta name="viewport" content="width=device-width,initial-scale=1" />
9
+ <style>
10
+ body { font-family: system-ui, Arial; padding: 18px; background:#0f0f10; color:#eaeaea; }
11
+ textarea { width:100%; height:160px; background:#111; color:#eaeaea; border:1px solid #333; padding:8px; }
12
+ button { padding:10px 14px; margin:8px 6px 0 0; }
13
+ .note { color:#aaa; font-size:0.9rem; margin-top:8px }
14
+ </style>
15
+ </head>
16
+ <body>
17
+ <h3>Capture tgWebAppData</h3>
18
+ <p>When opened in Telegram, this page will show the full URL (including <code>#tgWebAppData=…</code>).</p>
19
+ <textarea id="out" readonly>Waiting for fragment…</textarea>
20
+ <div>
21
+ <button id="copy">Copy URL</button>
22
+ <button id="continue">Continue to target</button>
23
+ </div>
24
+ <p class="note">Privacy: this page does NOT send data anywhere unless you add that behavior. The user should only share this URL if they consent.</p>
25
+
26
+ <script>
27
+ (async function(){
28
+ const out = document.getElementById('out');
29
+ const copyBtn = document.getElementById('copy');
30
+ const cont = document.getElementById('continue');
31
+
32
+ // show full href (includes fragment if present)
33
+ const full = location.href;
34
+ out.value = full;
35
+
36
+ copyBtn.addEventListener('click', async () => {
37
+ try {
38
+ await navigator.clipboard.writeText(out.value);
39
+ alert('URL copied to clipboard');
40
+ } catch(e) {
41
+ prompt('Copy this URL', out.value);
42
+ }
43
+ });
44
+
45
+ cont.addEventListener('click', () => {
46
+ const qs = new URLSearchParams(location.search);
47
+ const target = qs.get('target') || '';
48
+ if (!target) {
49
+ alert('No target specified in ?target=...');
50
+ return;
51
+ }
52
+ // preserve same fragment when forwarding
53
+ location.replace(target + location.hash);
54
+ });
55
+ })();
56
+ </script>
57
+ </body>
58
+ </html>