Spaces:
Running
Running
Делаем скрипт Osnet форума вход и регистр потом после захода вверху текст Osnet и вкладка группы Osnet вкладка чата как в телеграмме, это общий чат без сокетов ажах сообщение на фласке - Initial Deployment
99b9605 verified Download index.html from Neogram129/osnet: direct link, hf CLI and curl.
- Browser
- Download file 18.4 kB
-
https://huggingface.co/spaces/Neogram129/osnet/resolve/main/index.html
- Command line
-
hf download hf://spaces/Neogram129/osnet/index.html
-
curl -L -o index.html https://huggingface.co/spaces/Neogram129/osnet/resolve/main/index.html
18.4 kB
| <html lang="ru"> | |
| <head> | |
| <meta charset="UTF-8"> | |
| <meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
| <title>Osnet Forum</title> | |
| <script src="https://cdn.tailwindcss.com"></script> | |
| <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css"> | |
| <style> | |
| .chat-message { | |
| animation: fadeIn 0.3s ease-in-out; | |
| } | |
| @keyframes fadeIn { | |
| from { opacity: 0; transform: translateY(10px); } | |
| to { opacity: 1; transform: translateY(0); } | |
| } | |
| .tab-content { | |
| display: none; | |
| } | |
| .tab-content.active { | |
| display: block; | |
| } | |
| .auth-form { | |
| max-width: 400px; | |
| margin: 0 auto; | |
| background: rgba(255, 255, 255, 0.1); | |
| backdrop-filter: blur(10px); | |
| border-radius: 15px; | |
| padding: 2rem; | |
| box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2); | |
| } | |
| .chat-container { | |
| height: calc(100vh - 180px); | |
| } | |
| .message-input:focus { | |
| outline: none; | |
| box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.5); | |
| } | |
| </style> | |
| </head> | |
| <body class="bg-gray-900 text-gray-100 min-h-screen"> | |
| <!-- Auth Screens --> | |
| <div id="auth-container" class="flex flex-col items-center justify-center min-h-screen p-4"> | |
| <!-- Login Form --> | |
| <div id="login-form" class="auth-form"> | |
| <div class="text-center mb-6"> | |
| <h1 class="text-3xl font-bold text-blue-400">Osnet</h1> | |
| <p class="text-gray-400 mt-2">Войдите в свой аккаунт</p> | |
| </div> | |
| <form id="loginForm" class="space-y-4"> | |
| <div> | |
| <label for="login-username" class="block text-sm font-medium text-gray-300 mb-1">Имя пользователя</label> | |
| <input type="text" id="login-username" required | |
| class="w-full px-4 py-2 bg-gray-800 border border-gray-700 rounded-lg focus:border-blue-500 focus:ring-1 focus:ring-blue-500"> | |
| </div> | |
| <div> | |
| <label for="login-password" class="block text-sm font-medium text-gray-300 mb-1">Пароль</label> | |
| <input type="password" id="login-password" required | |
| class="w-full px-4 py-2 bg-gray-800 border border-gray-700 rounded-lg focus:border-blue-500 focus:ring-1 focus:ring-blue-500"> | |
| </div> | |
| <button type="submit" class="w-full bg-blue-600 hover:bg-blue-700 text-white py-2 px-4 rounded-lg transition duration-200"> | |
| Войти | |
| </button> | |
| <div class="text-center text-sm text-gray-400"> | |
| Нет аккаунта? <button type="button" onclick="showRegister()" class="text-blue-400 hover:text-blue-300">Зарегистрироваться</button> | |
| </div> | |
| </form> | |
| </div> | |
| <!-- Register Form --> | |
| <div id="register-form" class="auth-form hidden"> | |
| <div class="text-center mb-6"> | |
| <h1 class="text-3xl font-bold text-blue-400">Osnet</h1> | |
| <p class="text-gray-400 mt-2">Создайте новый аккаунт</p> | |
| </div> | |
| <form id="registerForm" class="space-y-4"> | |
| <div> | |
| <label for="register-username" class="block text-sm font-medium text-gray-300 mb-1">Имя пользователя</label> | |
| <input type="text" id="register-username" required | |
| class="w-full px-4 py-2 bg-gray-800 border border-gray-700 rounded-lg focus:border-blue-500 focus:ring-1 focus:ring-blue-500"> | |
| </div> | |
| <div> | |
| <label for="register-email" class="block text-sm font-medium text-gray-300 mb-1">Email</label> | |
| <input type="email" id="register-email" required | |
| class="w-full px-4 py-2 bg-gray-800 border border-gray-700 rounded-lg focus:border-blue-500 focus:ring-1 focus:ring-blue-500"> | |
| </div> | |
| <div> | |
| <label for="register-password" class="block text-sm font-medium text-gray-300 mb-1">Пароль</label> | |
| <input type="password" id="register-password" required | |
| class="w-full px-4 py-2 bg-gray-800 border border-gray-700 rounded-lg focus:border-blue-500 focus:ring-1 focus:ring-blue-500"> | |
| </div> | |
| <div> | |
| <label for="register-confirm-password" class="block text-sm font-medium text-gray-300 mb-1">Подтвердите пароль</label> | |
| <input type="password" id="register-confirm-password" required | |
| class="w-full px-4 py-2 bg-gray-800 border border-gray-700 rounded-lg focus:border-blue-500 focus:ring-1 focus:ring-blue-500"> | |
| </div> | |
| <button type="submit" class="w-full bg-blue-600 hover:bg-blue-700 text-white py-2 px-4 rounded-lg transition duration-200"> | |
| Зарегистрироваться | |
| </button> | |
| <div class="text-center text-sm text-gray-400"> | |
| Уже есть аккаунт? <button type="button" onclick="showLogin()" class="text-blue-400 hover:text-blue-300">Войти</button> | |
| </div> | |
| </form> | |
| </div> | |
| </div> | |
| <!-- Main App (hidden until auth) --> | |
| <div id="app-container" class="hidden"> | |
| <!-- Header --> | |
| <header class="bg-gray-800 border-b border-gray-700 py-4 px-6 flex items-center justify-between sticky top-0 z-10"> | |
| <div class="flex items-center space-x-4"> | |
| <div class="text-2xl font-bold text-blue-400">Osnet</div> | |
| </div> | |
| <div class="flex items-center space-x-4"> | |
| <button id="logout-btn" class="text-gray-400 hover:text-white transition"> | |
| <i class="fas fa-sign-out-alt"></i> | |
| </button> | |
| </div> | |
| </header> | |
| <!-- Tabs --> | |
| <div class="bg-gray-800 border-b border-gray-700"> | |
| <div class="flex"> | |
| <button data-tab="groups" class="tab-btn py-4 px-6 text-center border-b-2 border-transparent hover:bg-gray-700 text-gray-400 hover:text-white font-medium transition flex-1"> | |
| <i class="fas fa-users mr-2"></i> Группы | |
| </button> | |
| <button data-tab="chat" class="tab-btn py-4 px-6 text-center border-b-2 border-blue-500 text-white font-medium transition flex-1"> | |
| <i class="fas fa-comments mr-2"></i> Чат | |
| </button> | |
| </div> | |
| </div> | |
| <!-- Tab Contents --> | |
| <div class="p-4"> | |
| <!-- Groups Tab --> | |
| <div id="groups-tab" class="tab-content"> | |
| <h2 class="text-xl font-semibold mb-4">Группы Osnet</h2> | |
| <div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-3 gap-4"> | |
| <div class="bg-gray-800 rounded-lg border border-gray-700 p-4 hover:bg-gray-700 transition cursor-pointer"> | |
| <h3 class="font-medium text-lg mb-2">Разработчики</h3> | |
| <p class="text-gray-400 text-sm">Обсуждение разработки и программирования</p> | |
| <div class="mt-3 text-xs text-gray-500">Участников: 124</div> | |
| </div> | |
| <div class="bg-gray-800 rounded-lg border border-gray-700 p-4 hover:bg-gray-700 transition cursor-pointer"> | |
| <h3 class="font-medium text-lg mb-2">Дизайн</h3> | |
| <p class="text-gray-400 text-sm">Графика, UI/UX и веб-дизайн</p> | |
| <div class="mt-3 text-xs text-gray-500">Участников: 89</div> | |
| </div> | |
| <div class="bg-gray-800 rounded-lg border border-gray-700 p-4 hover:bg-gray-700 transition cursor-pointer"> | |
| <h3 class="font-medium text-lg mb-2">Флейм</h3> | |
| <p class="text-gray-400 text-sm">Обсуждение любых тем</p> | |
| <div class="mt-3 text-xs text-gray-500">Участников: 256</div> | |
| </div> | |
| </div> | |
| </div> | |
| <!-- Chat Tab --> | |
| <div id="chat-tab" class="tab-content active"> | |
| <div class="chat-container overflow-y-auto mb-4 space-y-3" id="chat-messages"> | |
| <!-- Messages will be loaded here --> | |
| <div class="text-center py-10 text-gray-500"> | |
| <i class="fas fa-comments text-4xl mb-2"></i> | |
| <p>Начните общение в общем чате Osnet</p> | |
| </div> | |
| </div> | |
| <div class="flex items-center space-x-2"> | |
| <input type="text" id="message-input" placeholder="Напишите сообщение..." | |
| class="message-input flex-1 px-4 py-3 bg-gray-800 border border-gray-700 rounded-full focus:border-blue-500"> | |
| <button id="send-btn" class="bg-blue-600 hover:bg-blue-700 text-white p-3 rounded-full transition"> | |
| <i class="fas fa-paper-plane"></i> | |
| </button> | |
| </div> | |
| </div> | |
| </div> | |
| </div> | |
| <script> | |
| // Auth state | |
| let currentUser = null; | |
| // DOM elements | |
| const authContainer = document.getElementById('auth-container'); | |
| const appContainer = document.getElementById('app-container'); | |
| const loginForm = document.getElementById('login-form'); | |
| const registerForm = document.getElementById('register-form'); | |
| const chatMessages = document.getElementById('chat-messages'); | |
| const messageInput = document.getElementById('message-input'); | |
| const sendBtn = document.getElementById('send-btn'); | |
| const logoutBtn = document.getElementById('logout-btn'); | |
| const tabBtns = document.querySelectorAll('.tab-btn'); | |
| const tabContents = document.querySelectorAll('.tab-content'); | |
| // Mock database | |
| const users = []; | |
| const messages = []; | |
| // Initialize | |
| document.addEventListener('DOMContentLoaded', () => { | |
| // Check if user is already logged in (from localStorage) | |
| const savedUser = localStorage.getItem('osnet_user'); | |
| if (savedUser) { | |
| currentUser = JSON.parse(savedUser); | |
| showApp(); | |
| loadMessages(); | |
| } | |
| // Form submissions | |
| document.getElementById('loginForm').addEventListener('submit', handleLogin); | |
| document.getElementById('registerForm').addEventListener('submit', handleRegister); | |
| // Chat functionality | |
| sendBtn.addEventListener('click', sendMessage); | |
| messageInput.addEventListener('keypress', (e) => { | |
| if (e.key === 'Enter') sendMessage(); | |
| }); | |
| // Logout | |
| logoutBtn.addEventListener('click', handleLogout); | |
| // Tab switching | |
| tabBtns.forEach(btn => { | |
| btn.addEventListener('click', () => switchTab(btn.dataset.tab)); | |
| }); | |
| }); | |
| // Auth functions | |
| function showLogin() { | |
| loginForm.classList.remove('hidden'); | |
| registerForm.classList.add('hidden'); | |
| } | |
| function showRegister() { | |
| loginForm.classList.add('hidden'); | |
| registerForm.classList.remove('hidden'); | |
| } | |
| function handleLogin(e) { | |
| e.preventDefault(); | |
| const username = document.getElementById('login-username').value; | |
| const password = document.getElementById('login-password').value; | |
| // Mock authentication | |
| const user = users.find(u => u.username === username && u.password === password); | |
| if (user) { | |
| currentUser = user; | |
| localStorage.setItem('osnet_user', JSON.stringify(user)); | |
| showApp(); | |
| loadMessages(); | |
| } else { | |
| alert('Неверное имя пользователя или пароль'); | |
| } | |
| } | |
| function handleRegister(e) { | |
| e.preventDefault(); | |
| const username = document.getElementById('register-username').value; | |
| const email = document.getElementById('register-email').value; | |
| const password = document.getElementById('register-password').value; | |
| const confirmPassword = document.getElementById('register-confirm-password').value; | |
| if (password !== confirmPassword) { | |
| alert('Пароли не совпадают'); | |
| return; | |
| } | |
| if (users.some(u => u.username === username)) { | |
| alert('Имя пользователя уже занято'); | |
| return; | |
| } | |
| const newUser = { | |
| id: Date.now().toString(), | |
| username, | |
| email, | |
| password, | |
| joined: new Date().toISOString() | |
| }; | |
| users.push(newUser); | |
| currentUser = newUser; | |
| localStorage.setItem('osnet_user', JSON.stringify(newUser)); | |
| showApp(); | |
| loadMessages(); | |
| showLogin(); | |
| } | |
| function handleLogout() { | |
| currentUser = null; | |
| localStorage.removeItem('osnet_user'); | |
| showAuth(); | |
| chatMessages.innerHTML = ` | |
| <div class="text-center py-10 text-gray-500"> | |
| <i class="fas fa-comments text-4xl mb-2"></i> | |
| <p>Начните общение в общем чате Osnet</p> | |
| </div> | |
| `; | |
| } | |
| function showAuth() { | |
| authContainer.classList.remove('hidden'); | |
| appContainer.classList.add('hidden'); | |
| } | |
| function showApp() { | |
| authContainer.classList.add('hidden'); | |
| appContainer.classList.remove('hidden'); | |
| } | |
| // Chat functions | |
| function loadMessages() { | |
| // In a real app, this would fetch messages from the server | |
| if (messages.length === 0) return; | |
| chatMessages.innerHTML = ''; | |
| messages.forEach(msg => { | |
| addMessageToChat(msg); | |
| }); | |
| } | |
| function sendMessage() { | |
| const text = messageInput.value.trim(); | |
| if (!text || !currentUser) return; | |
| const newMessage = { | |
| id: Date.now().toString(), | |
| text, | |
| username: currentUser.username, | |
| timestamp: new Date().toISOString() | |
| }; | |
| // In a real app, this would send to the Flask backend | |
| messages.push(newMessage); | |
| addMessageToChat(newMessage); | |
| messageInput.value = ''; | |
| // Scroll to bottom | |
| chatMessages.scrollTop = chatMessages.scrollHeight; | |
| } | |
| function addMessageToChat(message) { | |
| const isCurrentUser = message.username === currentUser.username; | |
| const messageElement = document.createElement('div'); | |
| messageElement.className = `chat-message flex ${isCurrentUser ? 'justify-end' : 'justify-start'}`; | |
| messageElement.innerHTML = ` | |
| <div class="max-w-xs md:max-w-md lg:max-w-lg rounded-lg px-4 py-2 ${isCurrentUser ? 'bg-blue-600 text-white' : 'bg-gray-700'}"> | |
| ${!isCurrentUser ? `<div class="font-medium text-xs text-gray-300 mb-1">${message.username}</div>` : ''} | |
| <div class="text-sm">${message.text}</div> | |
| <div class="text-right mt-1 text-xs opacity-70">${formatTime(message.timestamp)}</div> | |
| </div> | |
| `; | |
| chatMessages.appendChild(messageElement); | |
| } | |
| function formatTime(timestamp) { | |
| const date = new Date(timestamp); | |
| return date.toLocaleTimeString([], { hour: '2-digit', minute: '2-digit' }); | |
| } | |
| // Tab functions | |
| function switchTab(tabName) { | |
| // Update active tab button | |
| tabBtns.forEach(btn => { | |
| if (btn.dataset.tab === tabName) { | |
| btn.classList.add('border-blue-500', 'text-white'); | |
| } else { | |
| btn.classList.remove('border-blue-500', 'text-white'); | |
| } | |
| }); | |
| // Show active tab content | |
| tabContents.forEach(content => { | |
| if (content.id === `${tabName}-tab`) { | |
| content.classList.add('active'); | |
| } else { | |
| content.classList.remove('active'); | |
| } | |
| }); | |
| } | |
| </script> | |
| <p style="border-radius: 8px; text-align: center; font-size: 12px; color: #fff; margin-top: 16px;position: fixed; left: 8px; bottom: 8px; z-index: 10; background: rgba(0, 0, 0, 0.8); padding: 4px 8px;">Made with <img src="https://enzostvs-deepsite.hf.space/logo.svg" alt="DeepSite Logo" style="width: 16px; height: 16px; vertical-align: middle;display:inline-block;margin-right:3px;filter:brightness(0) invert(1);"><a href="https://enzostvs-deepsite.hf.space" style="color: #fff;text-decoration: underline;" target="_blank" >DeepSite</a> - 🧬 <a href="https://enzostvs-deepsite.hf.space?remix=Neogram129/osnet" style="color: #fff;text-decoration: underline;" target="_blank" >Remix</a></p></body> | |
| </html> |