kweer commited on
Commit
a7765f0
·
verified ·
1 Parent(s): a4a42ef

Update index.html

Browse files
Files changed (1) hide show
  1. index.html +51 -3
index.html CHANGED
@@ -1,3 +1,51 @@
1
- <script>
2
- window.location.replace("https://vh-prod-one-api-main-961189-1c740b28.livemy.site");
3
- </script>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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.0">
6
+ <title>One API Loader</title>
7
+ <style>
8
+ body, html { margin: 0; padding: 0; width: 100%; height: 100%; overflow: hidden; }
9
+ iframe { width: 100%; height: 100%; border: none; }
10
+ </style>
11
+ </head>
12
+ <body>
13
+ <!-- Embed One API inside an iframe so JavaScript can interact with it -->
14
+ <iframe id="oneApiFrame" src="https://vh-prod-one-api-main-961189-1c740b28.livemy.site/"></iframe>
15
+
16
+ <script>
17
+ const iframe = document.getElementById('oneApiFrame');
18
+
19
+ iframe.addEventListener('load', () => {
20
+ try {
21
+ // Access the inner document of the loaded website
22
+ const iframeDoc = iframe.contentDocument || iframe.contentWindow.document;
23
+
24
+ // Pull credentials from Hugging Face's secure variables
25
+ const username = window.huggingface?.variables?.ONEAPI_USERNAME || "your_default_username";
26
+ const password = window.huggingface?.variables?.ONEAPI_PASSWORD || "your_default_password";
27
+
28
+ // Target the input fields based on their placeholder text attributes
29
+ const userInput = iframeDoc.querySelector('input[placeholder*="Username"], input[placeholder*="Email"]');
30
+ const passInput = iframeDoc.querySelector('input[type="password"]');
31
+ const loginBtn = iframeDoc.querySelector('button, input[type="submit"]');
32
+
33
+ if (userInput && passInput && loginBtn) {
34
+ // Populate the values programmatically
35
+ userInput.value = username;
36
+ passInput.value = password;
37
+
38
+ // Trigger input events so the app recognizes the typed text
39
+ userInput.dispatchEvent(new Event('input', { bubbles: true }));
40
+ passInput.dispatchEvent(new Event('input', { bubbles: true }));
41
+
42
+ // Automatically submit the form
43
+ loginBtn.click();
44
+ }
45
+ } catch (error) {
46
+ console.error("Cross-Origin security block prevented automated input injection:", error);
47
+ }
48
+ });
49
+ </script>
50
+ </body>
51
+ </html>