File size: 2,500 Bytes
8f06fe5
 
 
 
 
 
 
 
 
 
 
 
4ceca70
8f06fe5
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <title>Responsive Gamma Embed</title>
  <style>
    html, body { margin: 0; padding: 0; height: 100%; overflow: hidden; }
    #custom-iframe { width: 100%; height: 100%; border: none; }
  </style>
</head>
<body>
  <iframe id="custom-iframe" sandbox="allow-scripts allow-same-origin allow-popups allow-forms Access-Control-Allow-Origin allow-top-navigation-by-user-activation"></iframe>

  <script>
  const loadUrlIntoIframe = async (url) => {
    try {
      const res = await fetch(url, {
        mode: 'cors',
        headers: {
          'Accept': 'text/html',
          'User-Agent': navigator.userAgent
        }
      });
      if (!res.ok) throw new Error(`Status ${res.status}`);
      let html = await res.text();

      // Inject override.js into the page
      const overrideScript = await fetch('override.js').then(r => r.text());
      const injection = `<script>${overrideScript}<\/script>`;
      html = html.replace(/<\/head>/i, injection + '</head>');

      // Serve as blob so it runs in same origin context
      const blob = new Blob([html], { type: 'text/html' });
      const blobUrl = URL.createObjectURL(blob);

      const iframe = document.getElementById('custom-iframe');
      iframe.src = blobUrl;
      iframe.onload = () => URL.revokeObjectURL(blobUrl);
    } catch (err) {
      console.error('Embed error:', err);
      document.body.innerHTML = `<p style="color:red;">Error loading embed: ${err.message}</p>`;
    }
  };

  const default_url = 'https://www.example.com/'
  // Initial page load
  const targetUrl = default_url;
  const initialUrl = `https://embed-proxy-prod.gamma-app.workers.dev/?alt_url=${targetUrl}`;
// 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`

  // const initialUrl = 'https://example.com'; // replace with your target URL
  loadUrlIntoIframe(initialUrl);

// Listen to messages from iframe (e.g. for navigation)
window.addEventListener('message', (event) => {
  if (event.data?.type === 'navigate' && event.data.url) {
    const proxiedUrl = `https://embed-proxy-prod.gamma-app.workers.dev/?alt_url=${event.data.url}`;
    loadUrlIntoIframe(proxiedUrl);
  }
});
  </script>
</body>
</html>