AstraOS commited on
Commit
8f06fe5
·
verified ·
1 Parent(s): c258daa

Update index.html

Browse files
Files changed (1) hide show
  1. index.html +64 -64
index.html CHANGED
@@ -1,64 +1,64 @@
1
- <!DOCTYPE html>
2
- <html lang="en">
3
- <head>
4
- <meta charset="utf-8">
5
- <meta name="viewport" content="width=device-width, initial-scale=1">
6
- <title>Responsive Gamma Embed</title>
7
- <style>
8
- html, body { margin: 0; padding: 0; height: 100%; overflow: hidden; }
9
- #custom-iframe { width: 100%; height: 100%; border: none; }
10
- </style>
11
- </head>
12
- <body>
13
- <iframe id="custom-iframe" sandbox="allow-scripts allow-same-origin allow-popups allow-forms Access-Control-Allow-Origin"></iframe>
14
-
15
- <script>
16
- const loadUrlIntoIframe = async (url) => {
17
- try {
18
- const res = await fetch(url, {
19
- mode: 'cors',
20
- headers: {
21
- 'Accept': 'text/html',
22
- 'User-Agent': navigator.userAgent
23
- }
24
- });
25
- if (!res.ok) throw new Error(`Status ${res.status}`);
26
- let html = await res.text();
27
-
28
- // Inject override.js into the page
29
- const overrideScript = await fetch('override.js').then(r => r.text());
30
- const injection = `<script>${overrideScript}<\/script>`;
31
- html = html.replace(/<\/head>/i, injection + '</head>');
32
-
33
- // Serve as blob so it runs in same origin context
34
- const blob = new Blob([html], { type: 'text/html' });
35
- const blobUrl = URL.createObjectURL(blob);
36
-
37
- const iframe = document.getElementById('custom-iframe');
38
- iframe.src = blobUrl;
39
- iframe.onload = () => URL.revokeObjectURL(blobUrl);
40
- } catch (err) {
41
- console.error('Embed error:', err);
42
- document.body.innerHTML = `<p style="color:red;">Error loading embed: ${err.message}</p>`;
43
- }
44
- };
45
-
46
- const default_url = 'https://www.example.com/'
47
- // Initial page load
48
- const targetUrl = default_url;
49
- const initialUrl = `https://embed-proxy-prod.gamma-app.workers.dev/?alt_url=${targetUrl}`;
50
- // const initialUrl = `https://888cfbae6aba7e08f9611637801ab91ec9bd3a08-m.proxy1.startpage.com/npd/fftzep/ST/mKNLdLUFGhRSP6lcQQfhPfTcQ//////////SURFLYROOT//////////@meloniemacgoboom:f/pride-made-runescape-fail:e?SURFLY=T?SURFLYFRAMEORIGIN=https://odysee.com`
51
-
52
- // const initialUrl = 'https://example.com'; // replace with your target URL
53
- loadUrlIntoIframe(initialUrl);
54
-
55
- // Listen to messages from iframe (e.g. for navigation)
56
- window.addEventListener('message', (event) => {
57
- if (event.data?.type === 'navigate' && event.data.url) {
58
- const proxiedUrl = `https://embed-proxy-prod.gamma-app.workers.dev/?alt_url=${event.data.url}`;
59
- loadUrlIntoIframe(proxiedUrl);
60
- }
61
- });
62
- </script>
63
- </body>
64
- </html>
 
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="utf-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1">
6
+ <title>Responsive Gamma Embed</title>
7
+ <style>
8
+ html, body { margin: 0; padding: 0; height: 100%; overflow: hidden; }
9
+ #custom-iframe { width: 100%; height: 100%; border: none; }
10
+ </style>
11
+ </head>
12
+ <body>
13
+ <iframe id="custom-iframe" sandbox="allow-scripts allow-same-origin allow-popups allow-forms Access-Control-Allow-Origin allow-top-navigation-by-user-activation allow-top-navigation"></iframe>
14
+
15
+ <script>
16
+ const loadUrlIntoIframe = async (url) => {
17
+ try {
18
+ const res = await fetch(url, {
19
+ mode: 'cors',
20
+ headers: {
21
+ 'Accept': 'text/html',
22
+ 'User-Agent': navigator.userAgent
23
+ }
24
+ });
25
+ if (!res.ok) throw new Error(`Status ${res.status}`);
26
+ let html = await res.text();
27
+
28
+ // Inject override.js into the page
29
+ const overrideScript = await fetch('override.js').then(r => r.text());
30
+ const injection = `<script>${overrideScript}<\/script>`;
31
+ html = html.replace(/<\/head>/i, injection + '</head>');
32
+
33
+ // Serve as blob so it runs in same origin context
34
+ const blob = new Blob([html], { type: 'text/html' });
35
+ const blobUrl = URL.createObjectURL(blob);
36
+
37
+ const iframe = document.getElementById('custom-iframe');
38
+ iframe.src = blobUrl;
39
+ iframe.onload = () => URL.revokeObjectURL(blobUrl);
40
+ } catch (err) {
41
+ console.error('Embed error:', err);
42
+ document.body.innerHTML = `<p style="color:red;">Error loading embed: ${err.message}</p>`;
43
+ }
44
+ };
45
+
46
+ const default_url = 'https://www.example.com/'
47
+ // Initial page load
48
+ const targetUrl = default_url;
49
+ const initialUrl = `https://embed-proxy-prod.gamma-app.workers.dev/?alt_url=${targetUrl}`;
50
+ // const initialUrl = `https://888cfbae6aba7e08f9611637801ab91ec9bd3a08-m.proxy1.startpage.com/npd/fftzep/ST/mKNLdLUFGhRSP6lcQQfhPfTcQ//////////SURFLYROOT//////////@meloniemacgoboom:f/pride-made-runescape-fail:e?SURFLY=T?SURFLYFRAMEORIGIN=https://odysee.com`
51
+
52
+ // const initialUrl = 'https://example.com'; // replace with your target URL
53
+ loadUrlIntoIframe(initialUrl);
54
+
55
+ // Listen to messages from iframe (e.g. for navigation)
56
+ window.addEventListener('message', (event) => {
57
+ if (event.data?.type === 'navigate' && event.data.url) {
58
+ const proxiedUrl = `https://embed-proxy-prod.gamma-app.workers.dev/?alt_url=${event.data.url}`;
59
+ loadUrlIntoIframe(proxiedUrl);
60
+ }
61
+ });
62
+ </script>
63
+ </body>
64
+ </html>