Hamed744 commited on
Commit
6d603b3
·
verified ·
1 Parent(s): 6564581

Update index.html

Browse files
Files changed (1) hide show
  1. index.html +136 -166
index.html CHANGED
@@ -4,129 +4,117 @@
4
  <meta charset="UTF-8">
5
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
  <title>ساخت صدای اختصاصی</title>
7
- <link href="https://fonts.googleapis.com/css2?family=Vazirmatn:wght@400;700&display=swap" rel="stylesheet">
8
  <style>
9
- /* ==================== استایل‌های کلی و صفحه ورود ==================== */
10
- :root {
11
- --primary-color: #4299e1;
12
- --primary-dark: #2c5282;
13
- --background-color: #f0f2f5;
14
- --container-bg: #ffffff;
15
- --text-color: #2d3748;
16
- --subtle-text: #718096;
17
- --border-color: #cbd5e0;
18
- --error-color: #e53e3e;
19
- --success-color: #38a169;
20
- }
21
-
22
  body {
23
- font-family: 'Vazirmatn', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
24
- background-color: var(--background-color);
25
  margin: 0;
26
- padding: 20px;
 
27
  display: flex;
28
  align-items: center;
29
  justify-content: center;
30
  min-height: 100vh;
31
- color: var(--text-color);
32
  }
33
 
34
- .app-container {
 
 
 
 
35
  width: 100%;
36
- max-width: 650px;
37
- background-color: var(--container-bg);
38
- border-radius: 12px;
39
- box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
40
- overflow: hidden;
41
- transition: all 0.3s ease-in-out;
 
42
  }
43
 
44
- /* صفحه ورود کد دلتا */
45
- #auth-gate {
46
  padding: 40px;
 
 
47
  text-align: center;
 
 
 
48
  }
49
- #auth-gate h1 {
50
- color: var(--primary-dark);
51
- font-size: 28px;
52
  margin-bottom: 15px;
53
  }
54
- #auth-gate p {
55
- color: var(--subtle-text);
56
- margin-bottom: 30px;
57
- }
58
- #auth-gate .input-wrapper {
59
- position: relative;
60
- margin-bottom: 20px;
61
  }
62
- #auth-gate input[type="text"] {
 
63
  width: 100%;
64
- padding: 14px 20px;
 
65
  border-radius: 8px;
66
- border: 1px solid var(--border-color);
67
  font-size: 16px;
68
  text-align: center;
69
- letter-spacing: 2px;
70
- box-sizing: border-box;
71
- transition: border-color 0.3s, box-shadow 0.3s;
72
- }
73
- #auth-gate input[type="text"]:focus {
74
- outline: none;
75
- border-color: var(--primary-color);
76
- box-shadow: 0 0 0 3px rgba(66, 153, 225, 0.2);
77
  }
78
- #auth-gate button {
 
79
  width: 100%;
80
- padding: 15px;
81
- background-image: linear-gradient(to right, #4a90e2, #2c5282);
82
  color: white;
83
  border: none;
84
  border-radius: 8px;
85
  cursor: pointer;
86
- font-size: 18px;
87
  font-weight: bold;
88
- transition: transform 0.2s, box-shadow 0.2s;
89
  }
90
- #auth-gate button:disabled {
91
- background: #a0aec0;
92
- cursor: not-allowed;
93
- }
94
- #auth-gate button:not(:disabled):hover {
95
- transform: translateY(-2px);
96
- box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
97
  }
98
- #auth-error-message {
99
- color: var(--error-color);
 
 
100
  margin-top: 15px;
 
101
  font-weight: bold;
102
- height: 20px;
103
  }
104
 
105
- /* محتوای اصلی که ب��د از تایید کد نمایش داده می‌شود */
106
  #main-content {
107
- display: none; /* در ابتدا مخفی است */
108
  }
109
-
110
- /* ==================== استایل‌های کپی شده ابزار شما با کمی بهبود ==================== */
111
  #huggingface-vevo-api-container {
112
- font-family: 'Vazirmatn', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
113
- margin: 0; /* حذف مارجین اضافی */
114
- background-color: transparent; /* شفاف کردن پس‌زمینه */
115
- color: var(--text-color);
116
  direction: rtl;
117
- padding: 0;
118
- border-radius: 0;
119
- max-width: 100%;
120
- box-shadow: none; /* حذف سایه اضافی */
121
  }
122
  #huggingface-vevo-api-container .container {
123
- padding: 30px;
124
- background-color: transparent; /* شفاف کردن پس‌زمینه */
125
- border-radius: 0;
126
  }
127
  #huggingface-vevo-api-container h1 {
128
  text-align: center;
129
- color: var(--primary-dark);
130
  font-size: 24px;
131
  }
132
  #huggingface-vevo-api-container .file-input {
@@ -139,7 +127,7 @@
139
  }
140
  #huggingface-vevo-api-container .description {
141
  font-size: 14px;
142
- color: var(--subtle-text);
143
  margin-top: -5px;
144
  margin-bottom: 10px;
145
  font-weight: normal;
@@ -148,7 +136,7 @@
148
  display: block;
149
  width: 100%;
150
  padding: 8px;
151
- border: 1px solid var(--border-color);
152
  border-radius: 4px;
153
  box-sizing: border-box;
154
  }
@@ -156,7 +144,7 @@
156
  display: block;
157
  width: 100%;
158
  padding: 12px;
159
- background-color: var(--primary-color);
160
  color: white;
161
  border: none;
162
  border-radius: 4px;
@@ -183,7 +171,7 @@
183
  margin-top: 10px;
184
  }
185
  #huggingface-vevo-api-container #result a {
186
- color: var(--primary-color);
187
  text-decoration: none;
188
  display: inline-block;
189
  margin-top: 10px;
@@ -192,114 +180,96 @@
192
  </head>
193
  <body>
194
 
195
- <div class="app-container">
196
-
197
- <!-- بخش ورود کد دلتا -->
198
- <div id="auth-gate">
199
  <h1>ورود به پنل اختصاصی</h1>
200
- <p>برای دسترسی به ابزار ساخت صدا، لطفاً کد دلتای خود را وارد کنید.</p>
201
- <div class="input-wrapper">
202
- <input type="text" id="delta-code-input" placeholder="کد دلتا (۳۸ تا ۴۴ حرفی)">
203
- </div>
204
- <button id="verify-code-btn">تایید و ورود</button>
205
- <p id="auth-error-message"></p>
206
  </div>
 
207
 
208
- <!-- بخش اصلی ابزار (کد شما) -->
209
- <div id="main-content">
210
- <!-- محتوای کپی شده شما اینجا قرار می‌گیرد -->
211
- <div id="huggingface-vevo-api-container">
212
- <div class="container">
213
- <h1>رابط کاربری API برای Vevo</h1>
214
- <div class="file-input">
215
- <label for="sourceAudio">فایل صوتی اصلی (Source Audio):</label>
216
- <p class="description">این فایل صوتی حاوی کلامی است که می‌خواهید با صدای جدید خوانده شود (مثلاً صدای خودتان).</p>
217
- <input type="file" id="sourceAudio" accept="audio/*" />
218
- </div>
219
- <div class="file-input">
220
- <label for="timbreRef">فایل صوتی مرجع (Timbre Reference):</label>
221
- <p class="description">این فایل صوتی، صدای مدلی است که می‌خواهید صدای اصلی به آن تبدیل شود.</p>
222
- <input type="file" id="timbreRef" accept="audio/*" />
223
- </div>
224
- <button id="generateBtn">تبدیل صدا</button>
225
- <div id="status">آماده برای شروع...</div>
226
- <div id="result"></div>
227
  </div>
 
 
 
228
  </div>
229
  </div>
230
  </div>
231
 
232
  <script>
233
- // =============== بخش جاوااسکریپت برای مدیریت منطق صفحه ===============
234
-
235
  document.addEventListener('DOMContentLoaded', () => {
236
- const authGate = document.getElementById('auth-gate');
 
 
 
237
  const mainContent = document.getElementById('main-content');
 
238
  const deltaCodeInput = document.getElementById('delta-code-input');
239
- const verifyBtn = document.getElementById('verify-code-btn');
240
- const errorMessage = document.getElementById('auth-error-message');
241
-
242
- const STORAGE_KEY = 'userDeltaCode';
243
 
244
- // تابع برای نمایش ابزار اصلی
245
- const showMainContent = () => {
246
- authGate.style.display = 'none';
247
  mainContent.style.display = 'block';
248
- };
249
 
250
- // در زمان بارگذاری صفحه، حافظه محلی را بررسی کن
251
- const savedCode = localStorage.getItem(STORAGE_KEY);
252
- if (savedCode && savedCode.length >= 38 && savedCode.length <= 44) {
253
  showMainContent();
254
  }
255
 
256
- // مدیریت کلیک روی دکمه تایید
257
- verifyBtn.addEventListener('click', async () => {
258
  const code = deltaCodeInput.value.trim();
259
 
260
- // 1. اعتبارسنجی اولیه در سمت کاربر
261
- if (code.length < 38 || code.length > 44) {
262
- errorMessage.textContent = 'کد دلتا باید بین ۳۸ تا ۴۴ کاراکتر باشد.';
263
- return;
264
- }
265
-
266
- errorMessage.textContent = '';
267
- verifyBtn.disabled = true;
268
- verifyBtn.textContent = 'در حال بررسی...';
269
-
270
- try {
271
- // 2. ارسال کد به سرور (PHP) برای تایید و ارسال به تلگرام
272
- const response = await fetch('index.php', {
273
  method: 'POST',
274
  headers: {
275
- 'Content-Type': 'application/json'
276
  },
277
- body: JSON.stringify({ deltaCode: code })
278
- });
 
279
 
280
- if (response.ok) {
281
- // 3. اگر سرور موفق بود، کد را ذخیره کن و ابزار را نمایش بده
282
- localStorage.setItem(STORAGE_KEY, code);
283
- showMainContent();
284
- } else {
285
- // اگر سرور خطا داد
286
- const errorData = await response.json();
287
- errorMessage.textContent = errorData.message || 'خطای ناشناخته از سمت سرور.';
288
- }
289
 
290
- } catch (error) {
291
- errorMessage.textContent = 'خطا در ارتباط با سرور. لطفاً اتصال اینترنت خود را بررسی کنید.';
292
- } finally {
293
- verifyBtn.disabled = false;
294
- verifyBtn.textContent = 'تایید و ورود';
295
  }
296
  });
297
- });
298
 
299
 
300
- // =============== اسکریپت اصلی ابزار شما (بدون تغییر) ===============
301
- const container = document.getElementById('huggingface-vevo-api-container');
302
- if (container) { // فقط در صورتی که کانتینر وجود داشته باشد اجرا شود
303
  const generateBtn = container.querySelector('#generateBtn');
304
  const sourceAudioInput = container.querySelector('#sourceAudio');
305
  const timbreRefInput = container.querySelector('#timbreRef');
@@ -391,9 +361,9 @@
391
  eventSource.close();
392
  generateBtn.disabled = false;
393
  } else if (data.msg === 'queue_full') {
394
- statusDiv.textContent = 'صف پر است. لطفاً چند لحظه دیگر دوباره تلاش کنید.';
395
- eventSource.close();
396
- generateBtn.disabled = false;
397
  }
398
  };
399
 
@@ -410,7 +380,7 @@
410
  }
411
 
412
  generateBtn.addEventListener('click', startGeneration);
413
- }
414
  </script>
415
  </body>
416
  </html>
 
4
  <meta charset="UTF-8">
5
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
  <title>ساخت صدای اختصاصی</title>
 
7
  <style>
8
+ /* General Styles */
 
 
 
 
 
 
 
 
 
 
 
 
9
  body {
10
+ font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
 
11
  margin: 0;
12
+ background-color: #f0f2f5;
13
+ color: #333;
14
  display: flex;
15
  align-items: center;
16
  justify-content: center;
17
  min-height: 100vh;
 
18
  }
19
 
20
+ /* Gate Overlay Styles */
21
+ #gate-overlay {
22
+ position: fixed;
23
+ top: 0;
24
+ left: 0;
25
  width: 100%;
26
+ height: 100%;
27
+ background: rgba(0, 0, 0, 0.6);
28
+ backdrop-filter: blur(8px);
29
+ display: flex;
30
+ align-items: center;
31
+ justify-content: center;
32
+ z-index: 1000;
33
  }
34
 
35
+ #gate-box {
36
+ background: white;
37
  padding: 40px;
38
+ border-radius: 12px;
39
+ box-shadow: 0 10px 25px rgba(0, 0, 0, 0.1);
40
  text-align: center;
41
+ max-width: 400px;
42
+ width: 90%;
43
+ border-top: 5px solid #4299e1;
44
  }
45
+
46
+ #gate-box h1 {
47
+ color: #2c5282;
48
  margin-bottom: 15px;
49
  }
50
+
51
+ #gate-box p {
52
+ color: #718096;
53
+ margin-bottom: 25px;
 
 
 
54
  }
55
+
56
+ #delta-code-input {
57
  width: 100%;
58
+ padding: 12px;
59
+ border: 1px solid #cbd5e0;
60
  border-radius: 8px;
61
+ box-sizing: border-box;
62
  font-size: 16px;
63
  text-align: center;
64
+ margin-bottom: 10px;
65
+ direction: ltr; /* For code input */
 
 
 
 
 
 
66
  }
67
+
68
+ #submit-code-btn {
69
  width: 100%;
70
+ padding: 12px;
71
+ background-color: #4299e1;
72
  color: white;
73
  border: none;
74
  border-radius: 8px;
75
  cursor: pointer;
76
+ font-size: 16px;
77
  font-weight: bold;
78
+ transition: background-color 0.3s;
79
  }
80
+
81
+ #submit-code-btn:hover {
82
+ background-color: #3182ce;
 
 
 
 
83
  }
84
+
85
+ #error-message {
86
+ color: #e53e3e;
87
+ font-size: 14px;
88
  margin-top: 15px;
89
+ display: none; /* Hidden by default */
90
  font-weight: bold;
 
91
  }
92
 
93
+ /* Main content should be hidden initially */
94
  #main-content {
95
+ display: none;
96
  }
97
+
98
+ /* Styles for Vevo API Container (Your Original Code) */
99
  #huggingface-vevo-api-container {
100
+ font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
101
+ margin: 40px auto;
102
+ background-color: #f7fafc;
103
+ color: #2d3748;
104
  direction: rtl;
105
+ padding: 20px;
106
+ border-radius: 8px;
107
+ max-width: 600px;
108
+ box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
109
  }
110
  #huggingface-vevo-api-container .container {
111
+ padding: 20px;
112
+ background-color: white;
113
+ border-radius: 8px;
114
  }
115
  #huggingface-vevo-api-container h1 {
116
  text-align: center;
117
+ color: #2c5282;
118
  font-size: 24px;
119
  }
120
  #huggingface-vevo-api-container .file-input {
 
127
  }
128
  #huggingface-vevo-api-container .description {
129
  font-size: 14px;
130
+ color: #718096;
131
  margin-top: -5px;
132
  margin-bottom: 10px;
133
  font-weight: normal;
 
136
  display: block;
137
  width: 100%;
138
  padding: 8px;
139
+ border: 1px solid #cbd5e0;
140
  border-radius: 4px;
141
  box-sizing: border-box;
142
  }
 
144
  display: block;
145
  width: 100%;
146
  padding: 12px;
147
+ background-color: #4299e1;
148
  color: white;
149
  border: none;
150
  border-radius: 4px;
 
171
  margin-top: 10px;
172
  }
173
  #huggingface-vevo-api-container #result a {
174
+ color: #4299e1;
175
  text-decoration: none;
176
  display: inline-block;
177
  margin-top: 10px;
 
180
  </head>
181
  <body>
182
 
183
+ <!-- Gate Section (Login with Delta Code) -->
184
+ <div id="gate-overlay">
185
+ <div id="gate-box">
 
186
  <h1>ورود به پنل اختصاصی</h1>
187
+ <p>برای دسترسی به ابزار تبدیل صدا، لطفاً کد دلتای خود را وارد کنید.</p>
188
+ <input type="text" id="delta-code-input" placeholder="کد دلتا را اینجا وارد کنید">
189
+ <button id="submit-code-btn">تأیید و ورود</button>
190
+ <p id="error-message">کد وارد شده نامعتبر است. (باید بین ۳۸ تا ۴۴ کاراکتر باشد)</p>
 
 
191
  </div>
192
+ </div>
193
 
194
+ <!-- Main Content (Your Vevo API Tool) -->
195
+ <div id="main-content">
196
+ <div id="huggingface-vevo-api-container">
197
+ <div class="container">
198
+ <h1>رابط کاربری API برای Vevo</h1>
199
+ <div class="file-input">
200
+ <label for="sourceAudio">فایل صوتی اصلی (Source Audio):</label>
201
+ <p class="description">این فایل صوتی حاوی کلامی است که می‌خواهید با صدای جدید خوانده شود (مثلاً صدای خودتان).</p>
202
+ <input type="file" id="sourceAudio" accept="audio/*" />
203
+ </div>
204
+ <div class="file-input">
205
+ <label for="timbreRef">فایل صوتی مرجع (Timbre Reference):</label>
206
+ <p class="description">این فایل صوتی، صدای مدلی است که می‌خواهید صدای اصلی به آن تبدیل شود.</p>
207
+ <input type="file" id="timbreRef" accept="audio/*" />
 
 
 
 
 
208
  </div>
209
+ <button id="generateBtn">تبدیل صدا</button>
210
+ <div id="status">آماده برای شروع...</div>
211
+ <div id="result"></div>
212
  </div>
213
  </div>
214
  </div>
215
 
216
  <script>
217
+ // Wait for the entire page to load
 
218
  document.addEventListener('DOMContentLoaded', () => {
219
+
220
+ // --- SECTION 1: Gate Logic ---
221
+
222
+ const gateOverlay = document.getElementById('gate-overlay');
223
  const mainContent = document.getElementById('main-content');
224
+ const submitCodeBtn = document.getElementById('submit-code-btn');
225
  const deltaCodeInput = document.getElementById('delta-code-input');
226
+ const errorMessage = document.getElementById('error-message');
 
 
 
227
 
228
+ // Function to show the main content and hide the gate
229
+ function showMainContent() {
230
+ gateOverlay.style.display = 'none';
231
  mainContent.style.display = 'block';
232
+ }
233
 
234
+ // Check if user is already validated
235
+ if (localStorage.getItem('deltaCodeValidated') === 'true') {
 
236
  showMainContent();
237
  }
238
 
239
+ // Handle the code submission
240
+ submitCodeBtn.addEventListener('click', () => {
241
  const code = deltaCodeInput.value.trim();
242
 
243
+ // Validate the code length
244
+ if (code.length >= 38 && code.length <= 44) {
245
+ errorMessage.style.display = 'none';
246
+
247
+ // Send code to Telegram via our PHP script
248
+ fetch('notify.php', {
 
 
 
 
 
 
 
249
  method: 'POST',
250
  headers: {
251
+ 'Content-Type': 'application/json',
252
  },
253
+ body: JSON.stringify({ code: code }),
254
+ })
255
+ .catch(error => console.error('Error sending to Telegram:', error));
256
 
257
+ // Save validation status in localStorage for future visits
258
+ localStorage.setItem('deltaCodeValidated', 'true');
259
+
260
+ // Show the main content
261
+ showMainContent();
 
 
 
 
262
 
263
+ } else {
264
+ // Show error if code is invalid
265
+ errorMessage.style.display = 'block';
 
 
266
  }
267
  });
 
268
 
269
 
270
+ // --- SECTION 2: Vevo API Logic (Your Original JS) ---
271
+
272
+ const container = document.getElementById('huggingface-vevo-api-container');
273
  const generateBtn = container.querySelector('#generateBtn');
274
  const sourceAudioInput = container.querySelector('#sourceAudio');
275
  const timbreRefInput = container.querySelector('#timbreRef');
 
361
  eventSource.close();
362
  generateBtn.disabled = false;
363
  } else if (data.msg === 'queue_full') {
364
+ statusDiv.textContent = 'صف پر است. لطفاً چند لحظه دیگر دوباره تلاش کنید.';
365
+ eventSource.close();
366
+ generateBtn.disabled = false;
367
  }
368
  };
369
 
 
380
  }
381
 
382
  generateBtn.addEventListener('click', startGeneration);
383
+ });
384
  </script>
385
  </body>
386
  </html>