UNPKG

shell-mirror

Version:

Access your Mac shell from any device securely. Perfect for mobile coding with Claude Code CLI, Gemini CLI, and any shell tool.

153 lines (139 loc) 5.12 kB
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Shell Mirror - Auth Test</title> <style> body { font-family: Arial, sans-serif; max-width: 800px; margin: 0 auto; padding: 20px; background: #f5f5f5; } .container { background: white; padding: 30px; border-radius: 10px; box-shadow: 0 2px 10px rgba(0,0,0,0.1); } .status { padding: 15px; margin: 10px 0; border-radius: 5px; } .success { background: #d4edda; color: #155724; } .error { background: #f8d7da; color: #721c24; } .info { background: #d1ecf1; color: #0c5460; } .btn { background: #4285F4; color: white; padding: 12px 24px; border: none; border-radius: 5px; cursor: pointer; font-size: 16px; margin: 10px 5px; } .btn:hover { background: #3367d6; } pre { background: #f8f9fa; padding: 15px; border-radius: 5px; overflow-x: auto; } </style> </head> <body> <div class="container"> <h1>Shell Mirror - Authentication Test</h1> <div id="auth-status" class="status info"> Checking authentication status... </div> <div id="actions"> <button class="btn" onclick="checkAuth()">Check Auth Status</button> <button class="btn" onclick="login()">Login with Google</button> <button class="btn" onclick="checkAgents()">Check Mac Agents</button> <button class="btn" onclick="logout()">Logout</button> </div> <div id="results"></div> </div> <script> let authData = null; async function checkAuth() { const statusDiv = document.getElementById('auth-status'); statusDiv.textContent = 'Checking authentication...'; statusDiv.className = 'status info'; try { const response = await fetch('/php-backend/api/auth-status.php', { credentials: 'include' }); const data = await response.json(); if (data.success && data.data && data.data.authenticated) { authData = data.data; statusDiv.innerHTML = ` <strong>✅ Authenticated</strong><br> User: ${authData.user.name} (${authData.user.email})<br> Login time: ${authData.user.login_time} `; statusDiv.className = 'status success'; } else { authData = null; statusDiv.innerHTML = '<strong>❌ Not authenticated</strong>'; statusDiv.className = 'status error'; } addResult('Auth Status', data); } catch (error) { statusDiv.innerHTML = `<strong>❌ Error:</strong> ${error.message}`; statusDiv.className = 'status error'; addResult('Auth Status Error', error); } } function login() { window.location.href = '/php-backend/api/auth-login.php'; } async function checkAgents() { if (!authData) { alert('Please authenticate first'); return; } try { const response = await fetch('/php-backend/api/agents-list.php', { credentials: 'include' }); const data = await response.json(); addResult('Mac Agents', data); } catch (error) { addResult('Mac Agents Error', error); } } async function logout() { try { const response = await fetch('/php-backend/api/auth-logout.php', { credentials: 'include' }); const data = await response.json(); addResult('Logout', data); authData = null; checkAuth(); } catch (error) { addResult('Logout Error', error); } } function addResult(title, data) { const resultsDiv = document.getElementById('results'); const resultDiv = document.createElement('div'); resultDiv.innerHTML = ` <h3>${title}</h3> <pre>${JSON.stringify(data, null, 2)}</pre> `; resultsDiv.appendChild(resultDiv); } // Check auth on page load document.addEventListener('DOMContentLoaded', checkAuth); </script> </body> </html>