Dooratre commited on
Commit
48f2e42
·
verified ·
1 Parent(s): 0e0a1e3

Update index.html

Browse files
Files changed (1) hide show
  1. index.html +147 -19
index.html CHANGED
@@ -1,19 +1,147 @@
1
- <!doctype html>
2
- <html>
3
- <head>
4
- <meta charset="utf-8" />
5
- <meta name="viewport" content="width=device-width" />
6
- <title>My static Space</title>
7
- <link rel="stylesheet" href="style.css" />
8
- </head>
9
- <body>
10
- <div class="card">
11
- <h1>Welcome to your static Space!</h1>
12
- <p>You can modify this app directly by editing <i>index.html</i> in the Files and versions tab.</p>
13
- <p>
14
- Also don't forget to check the
15
- <a href="https://huggingface.co/docs/hub/spaces" target="_blank">Spaces documentation</a>.
16
- </p>
17
- </div>
18
- </body>
19
- </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.0">
6
+ <title>API Signup Form</title>
7
+ <style>
8
+ body {
9
+ font-family: Arial, sans-serif;
10
+ margin: 20px;
11
+ padding: 0;
12
+ background-color: #f4f4f9;
13
+ }
14
+ .container {
15
+ max-width: 600px;
16
+ margin: 0 auto;
17
+ background: #fff;
18
+ padding: 20px;
19
+ border-radius: 8px;
20
+ box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
21
+ }
22
+ h1 {
23
+ text-align: center;
24
+ color: #333;
25
+ }
26
+ .form-group {
27
+ margin-bottom: 15px;
28
+ }
29
+ label {
30
+ display: block;
31
+ margin-bottom: 5px;
32
+ font-weight: bold;
33
+ }
34
+ input[type="text"],
35
+ input[type="email"],
36
+ input[type="password"] {
37
+ width: 100%;
38
+ padding: 10px;
39
+ border: 1px solid #ccc;
40
+ border-radius: 4px;
41
+ }
42
+ button {
43
+ display: block;
44
+ width: 100%;
45
+ padding: 10px;
46
+ background-color: #007bff;
47
+ color: #fff;
48
+ border: none;
49
+ border-radius: 4px;
50
+ cursor: pointer;
51
+ font-size: 16px;
52
+ }
53
+ button:hover {
54
+ background-color: #0056b3;
55
+ }
56
+ .response-box {
57
+ margin-top: 20px;
58
+ padding: 15px;
59
+ background-color: #f9f9f9;
60
+ border: 1px solid #ddd;
61
+ border-radius: 4px;
62
+ white-space: pre-wrap;
63
+ word-wrap: break-word;
64
+ }
65
+ </style>
66
+ </head>
67
+ <body>
68
+ <div class="container">
69
+ <h1>Signup Form</h1>
70
+ <form id="signupForm">
71
+ <div class="form-group">
72
+ <label for="username">Username:</label>
73
+ <input type="text" id="username" name="username" required>
74
+ </div>
75
+ <div class="form-group">
76
+ <label for="email">Email:</label>
77
+ <input type="email" id="email" name="email" required>
78
+ </div>
79
+ <div class="form-group">
80
+ <label for="password">Password:</label>
81
+ <input type="password" id="password" name="password" required>
82
+ </div>
83
+ <div class="form-group">
84
+ <label for="send_confirmation_code">Send Confirmation Code:</label>
85
+ <input type="checkbox" id="send_confirmation_code" name="send_confirmation_code" checked>
86
+ </div>
87
+ <button type="submit">Submit</button>
88
+ </form>
89
+ <div class="response-box" id="responseBox">
90
+ <!-- Response will be displayed here -->
91
+ </div>
92
+ </div>
93
+
94
+ <script>
95
+ document.getElementById('signupForm').addEventListener('submit', async function (e) {
96
+ e.preventDefault(); // Prevent default form submission
97
+
98
+ // Get form data
99
+ const formData = {
100
+ username: document.getElementById('username').value,
101
+ email: document.getElementById('email').value,
102
+ password: document.getElementById('password').value,
103
+ send_confirmation_code: document.getElementById('send_confirmation_code').checked,
104
+ p102xyzname: "" // Static value as per the original code
105
+ };
106
+
107
+ // API URL
108
+ const url = "https://api.puter.com/signup";
109
+
110
+ // Headers
111
+ const headers = {
112
+ "Accept-Language": "en-US,en;q=0.9",
113
+ "X-Requested-With": "XMLHttpRequest",
114
+ "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/134.0.0.0 Safari/537.36",
115
+ "Accept": "*/*",
116
+ "Content-Type": "application/json",
117
+ "Origin": "https://puter.com",
118
+ "Referer": "https://puter.com/",
119
+ "Connection": "keep-alive"
120
+ };
121
+
122
+ try {
123
+ // Make the POST request
124
+ const response = await fetch(url, {
125
+ method: 'POST',
126
+ headers: headers,
127
+ body: JSON.stringify(formData)
128
+ });
129
+
130
+ // Check if the response is OK (status code 200-299)
131
+ if (!response.ok) {
132
+ throw new Error(`HTTP error! Status: ${response.status}`);
133
+ }
134
+
135
+ // Parse the response as JSON
136
+ const jsonResponse = await response.json();
137
+
138
+ // Display the JSON response in the box
139
+ document.getElementById('responseBox').textContent = `Status Code: ${response.status}\nResponse: ${JSON.stringify(jsonResponse, null, 2)}`;
140
+ } catch (error) {
141
+ // Handle errors and display them in the response box
142
+ document.getElementById('responseBox').textContent = `Error: ${error.message}`;
143
+ }
144
+ });
145
+ </script>
146
+ </body>
147
+ </html>