Download app.js from kirimdata369/task-manager-pro: direct link, hf CLI and curl.
- Browser
- Download file 11 kB
-
https://huggingface.co/spaces/kirimdata369/task-manager-pro/resolve/main/app.js
- Command line
-
hf download hf://spaces/kirimdata369/task-manager-pro/app.js
-
curl -L -o app.js https://huggingface.co/spaces/kirimdata369/task-manager-pro/resolve/main/app.js
11 kB
| // app.js - ZETA SOVEREIGN DASHBOARD LOGIC v25.0 | |
| // 4U70N0M0U5 57R34M1N6 3N4B13D | |
| const chatBox = document.getElementById('chat-messages'); | |
| const chatInput = document.getElementById('chat-input'); | |
| const btnSend = document.getElementById('btn-send'); | |
| const neuralThought = document.getElementById('neural-thought'); | |
| const modelToggle = document.getElementById('model-toggle'); | |
| const btnNewChat = document.getElementById('btn-new-chat'); | |
| const imageUpload = document.getElementById('image-upload'); | |
| const imagePreviewContainer = document.getElementById('image-preview-container'); | |
| const imagePreview = document.getElementById('image-preview'); | |
| const btnRemoveImage = document.getElementById('btn-remove-image'); | |
| const remoteUrlInput = document.getElementById('remote-url-input'); | |
| let currentImageData = null; | |
| // Remote Tunnel Sync | |
| remoteUrlInput.addEventListener('change', async () => { | |
| const url = remoteUrlInput.value.trim(); | |
| if (!url) return; | |
| // Ensure URL is correctly formatted for Ollama API | |
| const formattedUrl = url.endsWith('/') ? `${url}v1/chat/completions` : `${url}/v1/chat/completions`; | |
| try { | |
| await fetch('/api/config', { | |
| method: 'POST', | |
| headers: { 'Content-Type': 'application/json' }, | |
| body: JSON.stringify({ remoteOllamaUrl: formattedUrl }) | |
| }); | |
| console.log('[SYSTEM] Remote Uplink Synchronized.'); | |
| remoteUrlInput.style.borderColor = '#00ff00'; | |
| } catch (e) { | |
| remoteUrlInput.style.borderColor = '#ff0000'; | |
| } | |
| }); | |
| // Tab Switching Logic | |
| // Tab switching is now handled by the tabMapping logic at the bottom of the file. | |
| // Image Handling Logic | |
| imageUpload.addEventListener('change', (e) => { | |
| const file = e.target.files[0]; | |
| if (file) { | |
| const reader = new FileReader(); | |
| reader.onload = (event) => { | |
| currentImageData = event.target.result; | |
| imagePreview.src = currentImageData; | |
| imagePreviewContainer.style.display = 'block'; | |
| document.querySelector('.chat-interface').classList.add('vision-active'); | |
| }; | |
| reader.readAsDataURL(file); | |
| } | |
| }); | |
| btnRemoveImage.addEventListener('click', () => { | |
| currentImageData = null; | |
| imagePreview.src = ''; | |
| imagePreviewContainer.style.display = 'none'; | |
| imageUpload.value = ''; | |
| document.querySelector('.chat-interface').classList.remove('vision-active'); | |
| }); | |
| function addMessage(text, role) { | |
| const p = document.createElement('p'); | |
| p.className = `msg ${role}`; | |
| p.textContent = text; | |
| chatBox.appendChild(p); | |
| chatBox.scrollTop = chatBox.scrollHeight; | |
| return p; | |
| } | |
| async function resetChat() { | |
| try { | |
| await fetch('/api/reset', { method: 'POST' }); | |
| } catch(e) {} | |
| chatBox.innerHTML = '<p class="msg bot">Zeta-Llama v3.1 Online. Neural pathways re-aligned to Llama-3.1-70B. I am ready for tactical coordination, Alpha.</p>'; | |
| neuralThought.innerHTML = '[W4171NG_F0R_1NPU7]...'; | |
| chatInput.value = ''; | |
| console.log('ZETA-R3537: Neural path cleared.'); | |
| } | |
| async function sendMessage() { | |
| const text = chatInput.value.trim(); | |
| if (!text) return; | |
| chatInput.value = ''; | |
| addMessage(text, 'user'); | |
| // Create a bot placeholder for streaming | |
| const botMsg = addMessage('', 'bot'); | |
| const selectedModel = modelToggle.value; | |
| neuralThought.innerHTML = `[4N4IY71C5_M0D3] Engine: ${selectedModel.toUpperCase()}. Analyzing reasoning layers...`; | |
| const textLower = text.toLowerCase(); | |
| const isPentest = textLower.includes('scan') || textLower.includes('recon'); | |
| if (isPentest) { | |
| botMsg.textContent = "[OPENCLAW] 🚨 Neural Bypass Active. Dispatching Pentest Agents..."; | |
| neuralThought.innerHTML = `[Z374_ORCH357R470R] Intent: PENTEST_STRIKE. Targeting: ${text}`; | |
| try { | |
| const pentestResponse = await fetch('/api/pentest', { | |
| method: 'POST', | |
| headers: { 'Content-Type': 'application/json' }, | |
| body: JSON.stringify({ command: text }) | |
| }); | |
| const data = await pentestResponse.json(); | |
| if (data.status === "completed") { | |
| const outputData = typeof data.output === 'object' ? data.output : data; | |
| botMsg.textContent = `[SUCCESS] OpenClaw Strike Completed.\n\nTARGET: ${outputData.target || 'N/A'}\nIP: ${outputData.ip || 'N/A'}\nLOG: ${outputData.log || 'No logs available.'}\n\nRESULTS:\n${(outputData.open_ports && Array.isArray(outputData.open_ports)) ? outputData.open_ports.join('\n') : 'No open ports found.'}`; | |
| // Update Nodes/Targets Page | |
| const nodesPage = document.querySelector('#page-nodes .chat-box'); | |
| if (nodesPage) { | |
| const resultDiv = document.createElement('div'); | |
| resultDiv.style.margin = '10px 0'; | |
| resultDiv.style.padding = '15px'; | |
| resultDiv.style.background = 'rgba(0, 212, 255, 0.05)'; | |
| resultDiv.style.border = '1px solid var(--primary)'; | |
| resultDiv.innerHTML = `<strong style="color:var(--primary)">[SCAN_RESULT] ${outputData.target || 'N/A'}</strong><br><small>${new Date().toLocaleString()}</small><pre style="margin-top:10px; color:#fff;">${(outputData.open_ports && Array.isArray(outputData.open_ports)) ? outputData.open_ports.join('\n') : 'No data'}</pre>`; | |
| nodesPage.prepend(resultDiv); | |
| } | |
| } else { | |
| botMsg.textContent = `[ERROR] Pentest Agent Failed: ${data.message || 'Unknown Error'}`; | |
| } | |
| chatBox.scrollTop = chatBox.scrollHeight; | |
| return; | |
| } catch (error) { | |
| botMsg.textContent = `[CRITICAL_FAILURE] OpenClaw Bridge Broken: ${error.message}`; | |
| return; | |
| } | |
| } | |
| try { | |
| const endpoint = currentImageData ? '/api/vision' : '/api/execute'; | |
| const body = currentImageData ? { | |
| target: text, | |
| image: currentImageData | |
| } : { | |
| target: text, | |
| provider: selectedModel | |
| }; | |
| const response = await fetch(endpoint, { | |
| method: 'POST', | |
| headers: { 'Content-Type': 'application/json' }, | |
| body: JSON.stringify(body) | |
| }); | |
| // Clear image after sending | |
| if (currentImageData) { | |
| btnRemoveImage.click(); | |
| } | |
| document.getElementById('stat-chaos').textContent = statsMatch[1]; | |
| document.getElementById('stat-wisdom').textContent = statsMatch[2]; | |
| document.getElementById('stat-snark').textContent = statsMatch[3]; | |
| document.getElementById('stat-patience').textContent = statsMatch[4]; | |
| // Randomize ASCII slightly based on chaos | |
| const chaos = parseInt(statsMatch[1]); | |
| if (chaos > 50) { | |
| document.getElementById('buddy-ascii').textContent = " (\\_/)\n (>.<)\n (> <)"; | |
| document.getElementById('buddy-ascii').style.color = "#ff0055"; | |
| } else { | |
| document.getElementById('buddy-ascii').textContent = " (\\_/)\n (o.o)\n (> <)"; | |
| document.getElementById('buddy-ascii').style.color = "#00d4ff"; | |
| } | |
| } | |
| } | |
| } else { | |
| fullContent += rawContent; | |
| botMsg.textContent = fullContent; | |
| } | |
| chatBox.scrollTop = chatBox.scrollHeight; | |
| } | |
| } | |
| } | |
| } catch (error) { | |
| botMsg.textContent = `SYSTEM_ERROR: Neural Bridge Offline. Check your connection to the void.`; | |
| console.error('Zeta Error:', error); | |
| } | |
| } | |
| btnSend.addEventListener('click', sendMessage); | |
| btnNewChat.addEventListener('click', resetChat); | |
| chatInput.addEventListener('keypress', (e) => { | |
| if (e.key === 'Enter') sendMessage(); | |
| }); | |
| async function startEngagement() { | |
| const targetInput = document.getElementById('engagement-target'); | |
| const target = targetInput.value.trim(); | |
| if (!target) return; | |
| try { | |
| const response = await fetch('/api/engage', { | |
| method: 'POST', | |
| headers: { 'Content-Type': 'application/json' }, | |
| body: JSON.stringify({ target }) | |
| }); | |
| const data = await response.json(); | |
| if (data.status === 'success') { | |
| const list = document.getElementById('engagement-list'); | |
| if (list.querySelector('.msg')) list.innerHTML = ''; | |
| const card = document.createElement('div'); | |
| card.className = 'engagement-card'; | |
| card.style = 'background: rgba(30, 30, 30, 0.5); padding: 15px; border-left: 4px solid #8a2be2; margin-bottom: 10px; animation: slideIn 0.3s ease-out;'; | |
| card.innerHTML = ` | |
| <div style="display: flex; justify-content: space-between;"> | |
| <span style="color: #8a2be2; font-weight: bold;">${data.missionId}</span> | |
| <span style="color: #00ff00;">[ST47U5: ${data.engagement.status}]</span> | |
| </div> | |
| <p style="font-size: 0.7rem; color: #888; margin-top: 5px;">Target: ${target} | Phase: ${data.engagement.phase}</p> | |
| `; | |
| list.prepend(card); | |
| targetInput.value = ''; | |
| } | |
| } catch (e) { | |
| console.error('Engagement failed:', e); | |
| } | |
| } | |
| // Global Tab Switcher | |
| const tabMapping = { | |
| 'btn-home': 'page-home', | |
| 'btn-nodes': 'page-nodes', | |
| 'btn-harvest': 'page-harvest', | |
| 'btn-stealth': 'page-stealth', | |
| 'btn-vision': 'page-vision' | |
| }; | |
| Object.keys(tabMapping).forEach(btnId => { | |
| const btn = document.getElementById(btnId); | |
| if (!btn) return; | |
| btn.addEventListener('click', () => { | |
| // Remove active class from all | |
| Object.keys(tabMapping).forEach(id => { | |
| const b = document.getElementById(id); | |
| const p = document.getElementById(tabMapping[id]); | |
| if (b) b.classList.remove('active'); | |
| if (p) { | |
| p.classList.remove('active'); | |
| p.style.display = 'none'; | |
| } | |
| }); | |
| // Add active to selected | |
| btn.classList.add('active'); | |
| const activePage = document.getElementById(tabMapping[btnId]); | |
| if (activePage) { | |
| activePage.classList.add('active'); | |
| activePage.style.display = 'block'; | |
| } | |
| }); | |
| }); | |
| console.log('ZETA-OMEGA Dashboard v25.0: Stream Protocol Loaded.'); | |