mirror of
https://github.com/samsonjs/vibetunnel.git
synced 2026-04-26 15:07:39 +00:00
- Add polished main window UI with dashboard access and status checking - Fix Unix socket server initialization to handle async runtime properly - Serve web assets from the server for browser dashboard access - Add server status monitoring and real-time updates - Improve error handling and user feedback
266 lines
No EOL
8.1 KiB
HTML
266 lines
No EOL
8.1 KiB
HTML
<!DOCTYPE html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
<title>VibeTunnel</title>
|
|
<style>
|
|
:root {
|
|
--bg-color: #1c1c1e;
|
|
--text-primary: #f5f5f7;
|
|
--text-secondary: #98989d;
|
|
--accent-color: #0a84ff;
|
|
--accent-hover: #409cff;
|
|
--border-color: rgba(255, 255, 255, 0.1);
|
|
}
|
|
|
|
@media (prefers-color-scheme: light) {
|
|
:root {
|
|
--bg-color: #ffffff;
|
|
--text-primary: #1d1d1f;
|
|
--text-secondary: #86868b;
|
|
--accent-color: #007aff;
|
|
--accent-hover: #0051d5;
|
|
--border-color: rgba(0, 0, 0, 0.1);
|
|
}
|
|
}
|
|
|
|
* {
|
|
margin: 0;
|
|
padding: 0;
|
|
box-sizing: border-box;
|
|
}
|
|
|
|
body {
|
|
font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Segoe UI', system-ui, sans-serif;
|
|
background-color: var(--bg-color);
|
|
color: var(--text-primary);
|
|
height: 100vh;
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: center;
|
|
}
|
|
|
|
.container {
|
|
text-align: center;
|
|
max-width: 600px;
|
|
padding: 40px;
|
|
}
|
|
|
|
.app-icon {
|
|
width: 128px;
|
|
height: 128px;
|
|
margin-bottom: 30px;
|
|
filter: drop-shadow(0 10px 20px rgba(0, 0, 0, 0.3));
|
|
border-radius: 27.6%;
|
|
}
|
|
|
|
h1 {
|
|
font-size: 32px;
|
|
font-weight: 600;
|
|
margin-bottom: 16px;
|
|
letter-spacing: -0.5px;
|
|
}
|
|
|
|
.subtitle {
|
|
font-size: 18px;
|
|
color: var(--text-secondary);
|
|
margin-bottom: 40px;
|
|
line-height: 1.5;
|
|
}
|
|
|
|
.status {
|
|
font-size: 14px;
|
|
color: var(--text-secondary);
|
|
margin-bottom: 30px;
|
|
padding: 12px 20px;
|
|
background-color: rgba(255, 255, 255, 0.05);
|
|
border-radius: 8px;
|
|
display: inline-block;
|
|
}
|
|
|
|
.button-group {
|
|
display: flex;
|
|
gap: 16px;
|
|
justify-content: center;
|
|
flex-wrap: wrap;
|
|
}
|
|
|
|
.button {
|
|
padding: 12px 24px;
|
|
background-color: var(--accent-color);
|
|
color: white;
|
|
border: none;
|
|
border-radius: 8px;
|
|
font-size: 16px;
|
|
font-weight: 500;
|
|
cursor: pointer;
|
|
transition: all 0.2s ease;
|
|
text-decoration: none;
|
|
display: inline-block;
|
|
}
|
|
|
|
.button:hover {
|
|
background-color: var(--accent-hover);
|
|
transform: translateY(-1px);
|
|
box-shadow: 0 4px 12px rgba(0, 132, 255, 0.3);
|
|
}
|
|
|
|
.button:active {
|
|
transform: translateY(0);
|
|
}
|
|
|
|
.secondary-button {
|
|
background-color: transparent;
|
|
color: var(--accent-color);
|
|
border: 1px solid var(--accent-color);
|
|
}
|
|
|
|
.secondary-button:hover {
|
|
background-color: var(--accent-color);
|
|
color: white;
|
|
}
|
|
|
|
.info {
|
|
margin-top: 40px;
|
|
font-size: 14px;
|
|
color: var(--text-secondary);
|
|
line-height: 1.6;
|
|
}
|
|
|
|
.info-item {
|
|
margin-bottom: 8px;
|
|
}
|
|
|
|
.loading {
|
|
display: none;
|
|
}
|
|
|
|
@keyframes spin {
|
|
to { transform: rotate(360deg); }
|
|
}
|
|
|
|
.spinner {
|
|
width: 20px;
|
|
height: 20px;
|
|
border: 2px solid rgba(255, 255, 255, 0.3);
|
|
border-top-color: white;
|
|
border-radius: 50%;
|
|
animation: spin 0.8s linear infinite;
|
|
display: inline-block;
|
|
margin-right: 8px;
|
|
}
|
|
</style>
|
|
</head>
|
|
<body>
|
|
<div class="container">
|
|
<img src="icon.png" alt="VibeTunnel" class="app-icon">
|
|
<h1>VibeTunnel</h1>
|
|
<p class="subtitle">Turn any browser into your terminal. Command your agents on the go.</p>
|
|
|
|
<div class="status" id="status">
|
|
<span class="loading" id="loadingSpinner"><span class="spinner"></span></span>
|
|
<span id="statusText">Checking server status...</span>
|
|
</div>
|
|
|
|
<div class="button-group">
|
|
<button class="button" onclick="openDashboard()">Open Dashboard</button>
|
|
<button class="button secondary-button" onclick="openSettings()">Settings</button>
|
|
<button class="button secondary-button" onclick="showWelcome()">Welcome Guide</button>
|
|
</div>
|
|
|
|
<div class="info">
|
|
<div class="info-item">💡 VibeTunnel runs in your system tray</div>
|
|
<div class="info-item">🖱️ Click the tray icon to access quick actions</div>
|
|
<div class="info-item">⌨️ Use the <code>vt</code> command to create terminal sessions</div>
|
|
</div>
|
|
</div>
|
|
|
|
<script>
|
|
// Add error handling for Tauri API
|
|
let tauriApi = null;
|
|
try {
|
|
if (window.__TAURI__) {
|
|
tauriApi = window.__TAURI__;
|
|
console.log('Tauri API loaded successfully');
|
|
} else {
|
|
console.error('Tauri API not available');
|
|
}
|
|
} catch (error) {
|
|
console.error('Error loading Tauri API:', error);
|
|
}
|
|
|
|
const invoke = tauriApi?.tauri?.invoke || (() => Promise.reject('Tauri not available'));
|
|
const open = tauriApi?.shell?.open || (() => Promise.reject('Tauri shell not available'));
|
|
|
|
async function checkServerStatus() {
|
|
const statusEl = document.getElementById('statusText');
|
|
const spinner = document.getElementById('loadingSpinner');
|
|
|
|
try {
|
|
spinner.style.display = 'inline-block';
|
|
const status = await invoke('get_server_status');
|
|
|
|
if (status.running) {
|
|
statusEl.textContent = `Server running on port ${status.port}`;
|
|
statusEl.style.color = '#32d74b';
|
|
} else {
|
|
statusEl.textContent = 'Server not running';
|
|
statusEl.style.color = '#ff453a';
|
|
}
|
|
} catch (error) {
|
|
statusEl.textContent = 'Unable to check server status';
|
|
statusEl.style.color = '#ff453a';
|
|
} finally {
|
|
spinner.style.display = 'none';
|
|
}
|
|
}
|
|
|
|
async function openDashboard() {
|
|
try {
|
|
const status = await invoke('get_server_status');
|
|
if (status.running) {
|
|
await open(status.url);
|
|
} else {
|
|
alert('Server is not running. Please start the server from the tray menu.');
|
|
}
|
|
} catch (error) {
|
|
console.error('Failed to open dashboard:', error);
|
|
alert('Failed to open dashboard. Please check the server status.');
|
|
}
|
|
}
|
|
|
|
async function openSettings() {
|
|
try {
|
|
await invoke('open_settings_window');
|
|
} catch (error) {
|
|
console.error('Failed to open settings:', error);
|
|
}
|
|
}
|
|
|
|
async function showWelcome() {
|
|
try {
|
|
await invoke('show_welcome_window');
|
|
} catch (error) {
|
|
console.error('Failed to show welcome:', error);
|
|
}
|
|
}
|
|
|
|
// Check server status on load
|
|
window.addEventListener('DOMContentLoaded', () => {
|
|
console.log('VibeTunnel main window loaded');
|
|
checkServerStatus();
|
|
// Refresh status every 5 seconds
|
|
setInterval(checkServerStatus, 5000);
|
|
});
|
|
|
|
// Listen for server status updates
|
|
if (tauriApi?.event) {
|
|
tauriApi.event.listen('server:restarted', (event) => {
|
|
console.log('Server restarted event received:', event);
|
|
checkServerStatus();
|
|
});
|
|
}
|
|
</script>
|
|
</body>
|
|
</html> |