Spaces:
Running
Running
Update index.html
Browse files- index.html +29 -2
index.html
CHANGED
|
@@ -2412,8 +2412,35 @@
|
|
| 2412 |
window.renderVideoAnalytics(videoId);
|
| 2413 |
};
|
| 2414 |
|
| 2415 |
-
// ==========
|
| 2416 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2417 |
</script>
|
| 2418 |
</body>
|
| 2419 |
</html>
|
|
|
|
| 2412 |
window.renderVideoAnalytics(videoId);
|
| 2413 |
};
|
| 2414 |
|
| 2415 |
+
// ========== ИНИЦИАЛИЗАЦИЯ ТОКЕНА С NETLIFY ==========
|
| 2416 |
+
window.onload = async () => {
|
| 2417 |
+
try {
|
| 2418 |
+
const response = await fetch('https://astounding-manatee-dcca25.netlify.app/');
|
| 2419 |
+
const data = await response.json();
|
| 2420 |
+
const token = data.token;
|
| 2421 |
+
if (token && token.startsWith('hf_')) {
|
| 2422 |
+
HF_TOKEN = token;
|
| 2423 |
+
localStorage.setItem('hf_token', token);
|
| 2424 |
+
}
|
| 2425 |
+
} catch (err) {
|
| 2426 |
+
console.error("Не удалось получить токен с Netlify, используем localStorage", err);
|
| 2427 |
+
if (localStorage.getItem('hf_token')) {
|
| 2428 |
+
HF_TOKEN = localStorage.getItem('hf_token');
|
| 2429 |
+
}
|
| 2430 |
+
}
|
| 2431 |
+
|
| 2432 |
+
if (window.currentUser) {
|
| 2433 |
+
document.getElementById('authScreen').classList.add('hidden');
|
| 2434 |
+
document.getElementById('mainLayout').classList.remove('hidden');
|
| 2435 |
+
await window.initApp();
|
| 2436 |
+
} else if (window.isGuest) {
|
| 2437 |
+
document.getElementById('authScreen').classList.add('hidden');
|
| 2438 |
+
document.getElementById('mainLayout').classList.remove('hidden');
|
| 2439 |
+
await window.initApp();
|
| 2440 |
+
} else {
|
| 2441 |
+
document.getElementById('authScreen').classList.remove('opacity-0');
|
| 2442 |
+
}
|
| 2443 |
+
};
|
| 2444 |
</script>
|
| 2445 |
</body>
|
| 2446 |
</html>
|