mirror of
https://github.com/AlexxIT/go2rtc.git
synced 2026-04-22 23:57:20 +08:00
613 lines
17 KiB
HTML
613 lines
17 KiB
HTML
<!DOCTYPE html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
<title>Stream Info - go2rtc</title>
|
|
<link rel="preconnect" href="https://fonts.googleapis.com">
|
|
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
|
<link href="https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@400;500;700&family=Orbitron:wght@700;900&display=swap" rel="stylesheet">
|
|
<style>
|
|
:root {
|
|
--bg-primary: #0a0e14;
|
|
--bg-secondary: #151b24;
|
|
--bg-card: #1a2332;
|
|
--border-color: #2a3544;
|
|
--text-primary: #e6edf3;
|
|
--text-secondary: #8b949e;
|
|
--text-muted: #6e7681;
|
|
--accent-cyan: #00d9ff;
|
|
--accent-electric: #00ffff;
|
|
--accent-red: #ff4757;
|
|
--accent-green: #2ecc71;
|
|
--accent-yellow: #ffd93d;
|
|
--glow-cyan: 0 0 20px rgba(0, 217, 255, 0.3);
|
|
--glow-red: 0 0 20px rgba(255, 71, 87, 0.3);
|
|
--glow-green: 0 0 20px rgba(46, 204, 113, 0.3);
|
|
}
|
|
|
|
[data-theme="light"] {
|
|
--bg-primary: #f5f7fa;
|
|
--bg-secondary: #ffffff;
|
|
--bg-card: #ffffff;
|
|
--border-color: #e1e4e8;
|
|
--text-primary: #24292e;
|
|
--text-secondary: #586069;
|
|
--text-muted: #6a737d;
|
|
--accent-cyan: #0366d6;
|
|
--accent-electric: #005cc5;
|
|
--accent-red: #d73a49;
|
|
--accent-green: #28a745;
|
|
--accent-yellow: #ffd33d;
|
|
--glow-cyan: 0 0 10px rgba(3, 102, 214, 0.2);
|
|
--glow-red: 0 0 10px rgba(215, 58, 73, 0.2);
|
|
--glow-green: 0 0 10px rgba(40, 167, 69, 0.2);
|
|
}
|
|
|
|
* {
|
|
margin: 0;
|
|
padding: 0;
|
|
box-sizing: border-box;
|
|
}
|
|
|
|
body {
|
|
background: var(--bg-primary);
|
|
color: var(--text-primary);
|
|
font-family: 'JetBrains Mono', monospace;
|
|
font-size: 14px;
|
|
line-height: 1.6;
|
|
min-height: 100vh;
|
|
overflow-x: hidden;
|
|
}
|
|
|
|
body::before {
|
|
content: '';
|
|
position: fixed;
|
|
top: 0;
|
|
left: 0;
|
|
width: 100%;
|
|
height: 100%;
|
|
background: repeating-linear-gradient(
|
|
0deg,
|
|
rgba(0, 0, 0, 0.05) 0px,
|
|
rgba(0, 0, 0, 0.05) 1px,
|
|
transparent 1px,
|
|
transparent 2px
|
|
);
|
|
pointer-events: none;
|
|
z-index: 9999;
|
|
opacity: 0.3;
|
|
}
|
|
|
|
body::after {
|
|
content: '';
|
|
position: fixed;
|
|
top: -50%;
|
|
left: -50%;
|
|
width: 200%;
|
|
height: 200%;
|
|
background: radial-gradient(
|
|
circle at 50% 50%,
|
|
rgba(0, 217, 255, 0.03) 0%,
|
|
transparent 50%
|
|
);
|
|
animation: rotateGradient 20s linear infinite;
|
|
pointer-events: none;
|
|
z-index: 0;
|
|
}
|
|
|
|
@keyframes rotateGradient {
|
|
0% { transform: rotate(0deg); }
|
|
100% { transform: rotate(360deg); }
|
|
}
|
|
|
|
.container {
|
|
max-width: 1400px;
|
|
margin: 0 auto;
|
|
padding: 0 24px;
|
|
position: relative;
|
|
z-index: 1;
|
|
}
|
|
|
|
header {
|
|
background: var(--bg-secondary);
|
|
border-bottom: 2px solid var(--accent-cyan);
|
|
box-shadow: var(--glow-cyan);
|
|
position: sticky;
|
|
top: 0;
|
|
z-index: 100;
|
|
backdrop-filter: blur(10px);
|
|
}
|
|
|
|
nav {
|
|
display: flex;
|
|
align-items: center;
|
|
gap: 32px;
|
|
padding: 20px 0;
|
|
}
|
|
|
|
.logo {
|
|
font-family: 'Orbitron', sans-serif;
|
|
font-weight: 900;
|
|
font-size: 28px;
|
|
color: var(--accent-cyan);
|
|
text-shadow: var(--glow-cyan);
|
|
letter-spacing: 2px;
|
|
text-decoration: none;
|
|
position: relative;
|
|
animation: glitch 3s infinite;
|
|
}
|
|
|
|
@keyframes glitch {
|
|
0%, 90%, 100% { transform: translate(0); }
|
|
91% { transform: translate(-2px, 1px); }
|
|
92% { transform: translate(2px, -1px); }
|
|
93% { transform: translate(-1px, 2px); }
|
|
}
|
|
|
|
.nav-links {
|
|
display: flex;
|
|
gap: 24px;
|
|
align-items: center;
|
|
flex: 1;
|
|
}
|
|
|
|
.nav-link {
|
|
color: var(--text-secondary);
|
|
text-decoration: none;
|
|
font-weight: 500;
|
|
text-transform: uppercase;
|
|
font-size: 12px;
|
|
letter-spacing: 1px;
|
|
padding: 8px 16px;
|
|
border: 1px solid transparent;
|
|
border-radius: 4px;
|
|
position: relative;
|
|
overflow: hidden;
|
|
}
|
|
|
|
.nav-link::before {
|
|
content: '';
|
|
position: absolute;
|
|
top: 0;
|
|
left: -100%;
|
|
width: 100%;
|
|
height: 100%;
|
|
background: linear-gradient(90deg, transparent, var(--accent-cyan), transparent);
|
|
}
|
|
|
|
.nav-link:hover::before {
|
|
left: 100%;
|
|
}
|
|
|
|
.nav-link:hover,
|
|
.nav-link.active {
|
|
color: var(--accent-cyan);
|
|
border-color: var(--accent-cyan);
|
|
box-shadow: var(--glow-cyan);
|
|
}
|
|
|
|
.docs-link {
|
|
font-size: 11px;
|
|
padding: 4px 10px;
|
|
opacity: 0.6;
|
|
margin-left: auto;
|
|
}
|
|
|
|
.docs-link:hover {
|
|
opacity: 1;
|
|
}
|
|
|
|
.theme-toggle {
|
|
width: 48px;
|
|
height: 48px;
|
|
border: none;
|
|
border-radius: 6px;
|
|
background: var(--bg-card);
|
|
color: var(--accent-cyan);
|
|
cursor: pointer;
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: center;
|
|
font-size: 20px;
|
|
margin-left: auto;
|
|
}
|
|
|
|
.theme-toggle:hover {
|
|
background: var(--accent-cyan);
|
|
color: var(--bg-primary);
|
|
}
|
|
|
|
main {
|
|
padding: 40px 0;
|
|
}
|
|
|
|
.page-header {
|
|
margin-bottom: 32px;
|
|
}
|
|
|
|
.page-title {
|
|
font-family: 'Orbitron', sans-serif;
|
|
font-size: 32px;
|
|
color: var(--accent-cyan);
|
|
text-shadow: var(--glow-cyan);
|
|
margin-bottom: 8px;
|
|
}
|
|
|
|
.page-subtitle {
|
|
color: var(--text-secondary);
|
|
font-size: 14px;
|
|
}
|
|
|
|
.stream-name-display {
|
|
color: var(--accent-electric);
|
|
font-weight: 700;
|
|
}
|
|
|
|
.info-card {
|
|
background: var(--bg-card);
|
|
border: 1px solid var(--border-color);
|
|
border-radius: 8px;
|
|
padding: 24px;
|
|
margin-bottom: 24px;
|
|
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
|
|
}
|
|
|
|
.card-title {
|
|
font-size: 16px;
|
|
font-weight: 700;
|
|
color: var(--accent-cyan);
|
|
text-transform: uppercase;
|
|
letter-spacing: 1px;
|
|
margin-bottom: 16px;
|
|
padding-bottom: 12px;
|
|
border-bottom: 2px solid var(--border-color);
|
|
}
|
|
|
|
.json-viewer {
|
|
background: var(--bg-secondary);
|
|
border: 1px solid var(--border-color);
|
|
border-radius: 6px;
|
|
padding: 20px;
|
|
overflow-x: auto;
|
|
font-size: 13px;
|
|
}
|
|
|
|
.json-key {
|
|
color: var(--accent-cyan);
|
|
font-weight: 700;
|
|
}
|
|
|
|
.json-string {
|
|
color: var(--accent-green);
|
|
}
|
|
|
|
.json-number {
|
|
color: var(--accent-yellow);
|
|
}
|
|
|
|
.json-boolean {
|
|
color: var(--accent-electric);
|
|
font-weight: 700;
|
|
}
|
|
|
|
.json-null {
|
|
color: var(--text-muted);
|
|
font-style: italic;
|
|
}
|
|
|
|
.json-bracket {
|
|
color: var(--text-secondary);
|
|
}
|
|
|
|
.json-line {
|
|
margin: 4px 0;
|
|
}
|
|
|
|
.json-indent {
|
|
display: inline-block;
|
|
width: 20px;
|
|
}
|
|
|
|
.loading {
|
|
text-align: center;
|
|
padding: 60px 20px;
|
|
color: var(--text-secondary);
|
|
}
|
|
|
|
.loading-spinner {
|
|
display: inline-block;
|
|
width: 40px;
|
|
height: 40px;
|
|
border: 3px solid var(--border-color);
|
|
border-top-color: var(--accent-cyan);
|
|
border-radius: 50%;
|
|
animation: spin 1s linear infinite;
|
|
margin-bottom: 16px;
|
|
}
|
|
|
|
@keyframes spin {
|
|
to { transform: rotate(360deg); }
|
|
}
|
|
|
|
.error {
|
|
background: rgba(255, 71, 87, 0.1);
|
|
border: 1px solid var(--accent-red);
|
|
border-radius: 8px;
|
|
padding: 24px;
|
|
color: var(--accent-red);
|
|
text-align: center;
|
|
}
|
|
|
|
.error-title {
|
|
font-size: 18px;
|
|
font-weight: 700;
|
|
margin-bottom: 8px;
|
|
}
|
|
|
|
.back-link {
|
|
display: inline-flex;
|
|
align-items: center;
|
|
gap: 8px;
|
|
color: var(--accent-cyan);
|
|
text-decoration: none;
|
|
font-weight: 500;
|
|
padding: 8px 16px;
|
|
border: 1px solid var(--accent-cyan);
|
|
border-radius: 6px;
|
|
transition: all 0.3s;
|
|
margin-bottom: 24px;
|
|
}
|
|
|
|
.back-link:hover {
|
|
background: var(--accent-cyan);
|
|
color: var(--bg-primary);
|
|
box-shadow: var(--glow-cyan);
|
|
}
|
|
|
|
@media (max-width: 768px) {
|
|
nav {
|
|
gap: 16px;
|
|
padding: 12px 0;
|
|
flex-wrap: wrap;
|
|
}
|
|
|
|
.logo {
|
|
font-size: 20px;
|
|
flex-shrink: 0;
|
|
}
|
|
|
|
.nav-links {
|
|
order: 3;
|
|
flex: 1 1 100%;
|
|
gap: 8px;
|
|
overflow-x: auto;
|
|
overflow-y: hidden;
|
|
-webkit-overflow-scrolling: touch;
|
|
scrollbar-width: none;
|
|
padding-bottom: 4px;
|
|
}
|
|
|
|
.nav-links::-webkit-scrollbar {
|
|
display: none;
|
|
}
|
|
|
|
.nav-link {
|
|
flex-shrink: 0;
|
|
font-size: 11px;
|
|
padding: 6px 12px;
|
|
}
|
|
|
|
.docs-link {
|
|
order: 2;
|
|
margin-left: auto;
|
|
flex-shrink: 0;
|
|
}
|
|
|
|
.theme-toggle {
|
|
order: 1;
|
|
flex-shrink: 0;
|
|
}
|
|
|
|
.page-title {
|
|
font-size: 24px;
|
|
}
|
|
}
|
|
</style>
|
|
</head>
|
|
<body>
|
|
|
|
<header>
|
|
<div class="container">
|
|
<nav>
|
|
<a href="index.html" class="logo">GO2RTC</a>
|
|
<div class="nav-links">
|
|
<a href="index.html" class="nav-link">Streams</a>
|
|
<a href="add.html" class="nav-link">Add Stream</a>
|
|
<a href="config.html" class="nav-link">Config</a>
|
|
<a href="log.html" class="nav-link">Logs</a>
|
|
<a href="net.html" class="nav-link">Network</a>
|
|
</div>
|
|
<a href="https://github.com/AlexxIT/go2rtc" target="_blank" class="nav-link docs-link">docs</a>
|
|
<button class="theme-toggle" id="theme-toggle" aria-label="Toggle theme">
|
|
<span class="theme-icon">🌙</span>
|
|
</button>
|
|
</nav>
|
|
</div>
|
|
</header>
|
|
|
|
<main>
|
|
<div class="container">
|
|
<a href="index.html" class="back-link">← Back to Streams</a>
|
|
|
|
<div class="page-header">
|
|
<h1 class="page-title">Stream Information</h1>
|
|
<p class="page-subtitle">Detailed information for stream: <span class="stream-name-display" id="stream-name"></span></p>
|
|
</div>
|
|
|
|
<div id="content">
|
|
<div class="loading">
|
|
<div class="loading-spinner"></div>
|
|
<div>Loading stream information...</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</main>
|
|
|
|
<script>
|
|
// Theme management
|
|
function initTheme() {
|
|
const savedTheme = localStorage.getItem('theme');
|
|
const systemPrefersDark = window.matchMedia('(prefers-color-scheme: dark)').matches;
|
|
const theme = savedTheme || (systemPrefersDark ? 'dark' : 'light');
|
|
|
|
setTheme(theme);
|
|
|
|
window.matchMedia('(prefers-color-scheme: dark)').addEventListener('change', (e) => {
|
|
if (!localStorage.getItem('theme')) {
|
|
setTheme(e.matches ? 'dark' : 'light');
|
|
}
|
|
});
|
|
}
|
|
|
|
function setTheme(theme) {
|
|
const html = document.documentElement;
|
|
const themeIcon = document.querySelector('.theme-icon');
|
|
|
|
if (theme === 'light') {
|
|
html.setAttribute('data-theme', 'light');
|
|
if (themeIcon) themeIcon.textContent = '☀️';
|
|
} else {
|
|
html.removeAttribute('data-theme');
|
|
if (themeIcon) themeIcon.textContent = '🌙';
|
|
}
|
|
}
|
|
|
|
function toggleTheme() {
|
|
const html = document.documentElement;
|
|
const currentTheme = html.getAttribute('data-theme') === 'light' ? 'light' : 'dark';
|
|
const newTheme = currentTheme === 'light' ? 'dark' : 'light';
|
|
|
|
setTheme(newTheme);
|
|
localStorage.setItem('theme', newTheme);
|
|
}
|
|
|
|
initTheme();
|
|
document.getElementById('theme-toggle')?.addEventListener('click', toggleTheme);
|
|
|
|
// Get stream name from URL
|
|
const urlParams = new URLSearchParams(window.location.search);
|
|
const streamName = urlParams.get('src');
|
|
|
|
if (!streamName) {
|
|
document.getElementById('content').innerHTML = `
|
|
<div class="error">
|
|
<div class="error-title">Error</div>
|
|
<div>No stream name provided</div>
|
|
</div>
|
|
`;
|
|
} else {
|
|
document.getElementById('stream-name').textContent = decodeURIComponent(streamName);
|
|
|
|
// Fetch stream info
|
|
const url = new URL('api/streams', location.href);
|
|
url.searchParams.set('src', streamName);
|
|
|
|
fetch(url, {cache: 'no-cache'})
|
|
.then(r => {
|
|
if (!r.ok) throw new Error(`HTTP ${r.status}: ${r.statusText}`);
|
|
return r.json();
|
|
})
|
|
.then(data => {
|
|
displayInfo(data);
|
|
})
|
|
.catch(error => {
|
|
document.getElementById('content').innerHTML = `
|
|
<div class="error">
|
|
<div class="error-title">Failed to load stream information</div>
|
|
<div>${error.message}</div>
|
|
</div>
|
|
`;
|
|
});
|
|
}
|
|
|
|
function displayInfo(data) {
|
|
const content = document.getElementById('content');
|
|
|
|
let html = '<div class="info-card">';
|
|
html += '<div class="card-title">Stream Data</div>';
|
|
html += '<div class="json-viewer">';
|
|
html += formatJSON(data, 0);
|
|
html += '</div>';
|
|
html += '</div>';
|
|
|
|
content.innerHTML = html;
|
|
}
|
|
|
|
function formatJSON(obj, indent = 0) {
|
|
const indentStr = '<span class="json-indent"></span>'.repeat(indent);
|
|
let html = '';
|
|
|
|
if (obj === null) {
|
|
return `<span class="json-null">null</span>`;
|
|
}
|
|
|
|
if (typeof obj === 'string') {
|
|
return `<span class="json-string">"${escapeHtml(obj)}"</span>`;
|
|
}
|
|
|
|
if (typeof obj === 'number') {
|
|
return `<span class="json-number">${obj}</span>`;
|
|
}
|
|
|
|
if (typeof obj === 'boolean') {
|
|
return `<span class="json-boolean">${obj}</span>`;
|
|
}
|
|
|
|
if (Array.isArray(obj)) {
|
|
if (obj.length === 0) {
|
|
return '<span class="json-bracket">[]</span>';
|
|
}
|
|
|
|
html += '<span class="json-bracket">[</span>\n';
|
|
obj.forEach((item, i) => {
|
|
html += '<div class="json-line">' + indentStr + '<span class="json-indent"></span>';
|
|
html += formatJSON(item, indent + 1);
|
|
if (i < obj.length - 1) html += '<span class="json-bracket">,</span>';
|
|
html += '</div>';
|
|
});
|
|
html += '<div class="json-line">' + indentStr + '<span class="json-bracket">]</span></div>';
|
|
return html;
|
|
}
|
|
|
|
if (typeof obj === 'object') {
|
|
const keys = Object.keys(obj);
|
|
if (keys.length === 0) {
|
|
return '<span class="json-bracket">{}</span>';
|
|
}
|
|
|
|
html += '<span class="json-bracket">{</span>\n';
|
|
keys.forEach((key, i) => {
|
|
html += '<div class="json-line">' + indentStr + '<span class="json-indent"></span>';
|
|
html += `<span class="json-key">"${escapeHtml(key)}"</span>: `;
|
|
html += formatJSON(obj[key], indent + 1);
|
|
if (i < keys.length - 1) html += '<span class="json-bracket">,</span>';
|
|
html += '</div>';
|
|
});
|
|
html += '<div class="json-line">' + indentStr + '<span class="json-bracket">}</span></div>';
|
|
return html;
|
|
}
|
|
|
|
return String(obj);
|
|
}
|
|
|
|
function escapeHtml(text) {
|
|
const div = document.createElement('div');
|
|
div.textContent = text;
|
|
return div.innerHTML;
|
|
}
|
|
</script>
|
|
|
|
</body>
|
|
</html>
|