Initial commit: unified dashboard suite state with Khira and Image Manipulator 3-file setup
This commit is contained in:
@@ -0,0 +1,206 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Admin Panel - Host-It-Live Pro</title>
|
||||
<link href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0/css/all.min.css" rel="stylesheet">
|
||||
<style>
|
||||
:root {
|
||||
--bg-color: #0f0f13;
|
||||
--card-bg: #1a1a20;
|
||||
--accent: #7b2cbf;
|
||||
--accent-glow: #9d4edd;
|
||||
--text-main: #e0e0e0;
|
||||
--success: #06d6a0;
|
||||
--danger: #ef476f;
|
||||
}
|
||||
body {
|
||||
background: var(--bg-color);
|
||||
color: var(--text-main);
|
||||
font-family: 'Segoe UI', system-ui, sans-serif;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
padding: 40px;
|
||||
margin: 0;
|
||||
min-height: 100vh;
|
||||
}
|
||||
.container { width: 100%; max-width: 900px; }
|
||||
|
||||
/* Login */
|
||||
#loginPanel {
|
||||
max-width: 400px;
|
||||
margin: 100px auto;
|
||||
background: var(--card-bg);
|
||||
padding: 40px;
|
||||
border-radius: 12px;
|
||||
text-align: center;
|
||||
box-shadow: 0 0 30px rgba(123, 44, 191, 0.2);
|
||||
border: 1px solid rgba(123, 44, 191, 0.3);
|
||||
}
|
||||
input {
|
||||
width: 100%;
|
||||
padding: 12px;
|
||||
margin: 15px 0;
|
||||
background: rgba(0,0,0,0.3);
|
||||
border: 1px solid #333;
|
||||
color: white;
|
||||
border-radius: 6px;
|
||||
}
|
||||
button {
|
||||
width: 100%;
|
||||
padding: 12px;
|
||||
background: var(--accent);
|
||||
color: white;
|
||||
border: none;
|
||||
border-radius: 6px;
|
||||
cursor: pointer;
|
||||
font-weight: bold;
|
||||
transition: 0.2s;
|
||||
}
|
||||
button:hover { background: var(--accent-glow); transform: scale(1.02); }
|
||||
|
||||
/* Dashboard */
|
||||
#dashboard { display: none; width: 100%; animation: fadeIn 0.5s ease; }
|
||||
@keyframes fadeIn { from { opacity:0; transform:translateY(10px); } to { opacity:1; transform:translateY(0); } }
|
||||
|
||||
.header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 30px; }
|
||||
.stat-card {
|
||||
background: var(--card-bg);
|
||||
padding: 20px;
|
||||
border-radius: 10px;
|
||||
display: inline-block;
|
||||
width: 30%;
|
||||
margin-right: 2%;
|
||||
text-align: center;
|
||||
box-shadow: 0 4px 15px rgba(0,0,0,0.2);
|
||||
}
|
||||
.stat-value { font-size: 2rem; font-weight: bold; color: var(--accent-glow); }
|
||||
|
||||
table { width: 100%; border-collapse: collapse; margin-top: 20px; background: var(--card-bg); border-radius: 10px; overflow: hidden; }
|
||||
th, td { padding: 15px; text-align: left; border-bottom: 1px solid #333; }
|
||||
th { background: rgba(123, 44, 191, 0.2); text-transform: uppercase; font-size: 0.8rem; letter-spacing: 1px; }
|
||||
tr:hover { background: rgba(255,255,255,0.02); }
|
||||
.badge { padding: 4px 8px; border-radius: 12px; font-size: 0.75rem; font-weight: bold; }
|
||||
.bg-relay { background: rgba(6, 214, 160, 0.2); color: var(--success); }
|
||||
.bg-host { background: rgba(255, 209, 102, 0.2); color: #ffd166; }
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="container">
|
||||
<!-- Login -->
|
||||
<div id="loginPanel">
|
||||
<h2><i class="fas fa-user-shield"></i> Admin Access</h2>
|
||||
<input type="password" id="pwd" placeholder="Enter Password">
|
||||
<button onclick="login()">Login</button>
|
||||
<p id="errorMsg" style="color:var(--danger); display:none; margin-top:10px;">Invalid Password</p>
|
||||
</div>
|
||||
|
||||
<!-- Dashboard -->
|
||||
<div id="dashboard">
|
||||
<div class="header">
|
||||
<h1>Server Overview</h1>
|
||||
<button onclick="loadStats()" style="width:auto; padding:8px 20px;"><i class="fas fa-sync"></i> Refresh</button>
|
||||
</div>
|
||||
|
||||
<div style="margin-bottom: 30px;">
|
||||
<div class="stat-card">
|
||||
<div id="totalSessions" class="stat-value">0</div>
|
||||
<div>Active Sessions</div>
|
||||
</div>
|
||||
<div class="stat-card">
|
||||
<div id="totalReqs" class="stat-value">0</div>
|
||||
<div>Total Requests</div>
|
||||
</div>
|
||||
<div class="stat-card">
|
||||
<div id="totalBytes" class="stat-value">0 MB</div>
|
||||
<div>Data Transferred</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<table id="sessionTable">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>ID</th>
|
||||
<th>Mode</th>
|
||||
<th>Created</th>
|
||||
<th>IP / User Agent</th>
|
||||
<th>Traffic</th>
|
||||
<th>Tunnel / Path</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody></tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
let adminPwd = '';
|
||||
|
||||
async function login() {
|
||||
const pwd = document.getElementById('pwd').value;
|
||||
const res = await fetch('/admin_login', {
|
||||
method: 'POST',
|
||||
headers: {'Content-Type': 'application/json'},
|
||||
body: JSON.stringify({ password: pwd })
|
||||
});
|
||||
const data = await res.json();
|
||||
if(data.success) {
|
||||
adminPwd = pwd;
|
||||
document.getElementById('loginPanel').style.display = 'none';
|
||||
document.getElementById('dashboard').style.display = 'block';
|
||||
loadStats();
|
||||
setInterval(loadStats, 5000); // Auto refresh
|
||||
} else {
|
||||
document.getElementById('errorMsg').style.display = 'block';
|
||||
}
|
||||
}
|
||||
|
||||
async function loadStats() {
|
||||
const res = await fetch('/admin_stats', {
|
||||
method: 'POST',
|
||||
headers: {'Content-Type': 'application/json'},
|
||||
body: JSON.stringify({ password: adminPwd })
|
||||
});
|
||||
const data = await res.json();
|
||||
if(data.success) {
|
||||
// Update Cards
|
||||
document.getElementById('totalSessions').innerText = data.sessions.length;
|
||||
const reqs = data.sessions.reduce((a, b) => a + b.requests, 0);
|
||||
const bytes = data.sessions.reduce((a, b) => a + b.bytes, 0);
|
||||
document.getElementById('totalReqs').innerText = reqs;
|
||||
document.getElementById('totalBytes').innerText = (bytes / 1024 / 1024).toFixed(2) + " MB";
|
||||
|
||||
// Update Table
|
||||
const tbody = document.querySelector('#sessionTable tbody');
|
||||
tbody.innerHTML = '';
|
||||
data.sessions.forEach(s => {
|
||||
const row = document.createElement('tr');
|
||||
const modeClass = s.mode === 'Relay' ? 'bg-relay' : 'bg-host';
|
||||
const uaShort = s.ua.length > 30 ? s.ua.substring(0, 30) + '...' : s.ua;
|
||||
const tunnelHtml = s.tunnel_active ? `<div style="color:var(--success); font-weight:bold; font-size: 0.8rem; margin-bottom: 4px;"><i class="fas fa-globe"></i> ${s.tunnel_url}</div>` : `<div style="color:#666; font-size: 0.8rem; margin-bottom: 4px;"><i class="fas fa-globe"></i> Offline</div>`;
|
||||
row.innerHTML = `
|
||||
<td style="font-family:monospace; color:var(--accent-glow);">${s.id}</td>
|
||||
<td><span class="badge ${modeClass}">${s.mode}</span></td>
|
||||
<td>${s.created}</td>
|
||||
<td>
|
||||
<div style="font-weight:bold;">${s.ip}</div>
|
||||
<div style="font-size:0.8rem; color:#888;">${uaShort}</div>
|
||||
</td>
|
||||
<td>
|
||||
<div>${s.requests} reqs</div>
|
||||
<div style="font-size:0.8rem;">${(s.bytes/1024).toFixed(1)} KB</div>
|
||||
</td>
|
||||
<td style="font-size:0.85rem; max-width:250px; overflow:hidden; text-overflow:ellipsis;">
|
||||
${tunnelHtml}
|
||||
<div style="color:#aaa;">Path: ${s.path}</div>
|
||||
</td>
|
||||
`;
|
||||
tbody.appendChild(row);
|
||||
});
|
||||
}
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user