This commit is contained in:
chk
2026-06-07 10:49:56 +02:00
parent d3e45262ce
commit 8055c375fc
4 changed files with 173 additions and 156 deletions

11
.claude/launch.json Normal file
View File

@@ -0,0 +1,11 @@
{
"version": "0.0.1",
"configurations": [
{
"name": "webcam",
"runtimeExecutable": "node",
"runtimeArgs": ["server.js"],
"port": 8444
}
]
}

139
public/app.css Normal file
View File

@@ -0,0 +1,139 @@
/* ════════════════════════════════════════════════════════════════════════════
AppRobotWebcam gemeinsames Theme für Viewer (index.html) und Konfiguration
(config.html). Haus-Stil: helle Fläche, system-ui, weiche Karten mit Schatten,
dunkler Blur-Header. Video-/Bildflächen bleiben bewusst dunkel (Kontrast).
════════════════════════════════════════════════════════════════════════════ */
* { box-sizing: border-box; }
body {
margin: 0;
font-family: system-ui, sans-serif;
background: #f5f6f8;
color: #1c1e21;
}
/* ── Header ──────────────────────────────────────────────────────────────── */
header {
height: 48px;
display: flex;
align-items: center;
gap: 16px;
padding: 0 20px;
position: sticky; top: 0; z-index: 10;
color: #fff;
background: rgba(20, 22, 26, 0.85);
backdrop-filter: blur(6px);
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.35);
}
header .logo { font-weight: bold; letter-spacing: 0.03em; }
header .status { font-size: 0.85rem; color: rgba(255, 255, 255, 0.6); margin-right: auto; }
.ml-auto { margin-left: auto; }
/* Buttons / Links im Header */
.hbtn {
display: inline-flex; align-items: center; gap: 6px; white-space: nowrap;
background: transparent; border: none; color: #fff;
padding: 8px 12px; border-radius: 6px;
font: inherit; font-size: 0.9rem; cursor: pointer; text-decoration: none;
}
.hbtn:hover:not(:disabled) { background: rgba(255, 255, 255, 0.15); }
.hbtn:disabled { opacity: 0.4; cursor: default; }
.hbtn.primary { background: rgba(80, 180, 120, 0.30); }
.hbtn.primary:hover:not(:disabled) { background: rgba(80, 180, 120, 0.48); }
main { padding: 20px; }
/* ── Kamera-Grid (index.html) ────────────────────────────────────────────── */
#cameras {
display: grid;
grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
gap: 20px;
}
.cam-box {
position: relative;
background: #11131a; /* dunkle Karte für das Bild */
border-radius: 10px;
overflow: hidden;
box-shadow: 0 4px 10px rgba(0, 0, 0, 0.12);
}
/* Live-MJPEG bzw. Snapshot-Bild responsiv, dunkler Hintergrund */
.cam-img {
display: block; width: 100%; aspect-ratio: 4 / 3;
background: #11131a; object-fit: contain;
}
.cam-label {
position: absolute; top: 8px; left: 10px; z-index: 2;
background: rgba(0, 0, 0, 0.55); padding: 3px 9px; border-radius: 6px;
font-size: 0.75rem; color: #fff;
}
/* Health-Anzeige unten links */
.cam-info {
position: absolute; bottom: 8px; left: 10px; z-index: 2;
background: rgba(0, 0, 0, 0.6); padding: 3px 9px; border-radius: 6px;
font-size: 0.72rem; color: #d8d8d8;
}
.cam-info.ok { color: #7ee29a; }
.cam-info.warn { color: #ffc861; }
.cam-info.crit { color: #ff8080; }
/* Ein/Aus-Schalter + HD-Button (über dem Bild) */
.cam-toggle, .cam-hdtest {
position: absolute; top: 8px; z-index: 2;
background: rgba(0, 0, 0, 0.55); color: #fff;
border: 1px solid rgba(255, 255, 255, 0.18); border-radius: 6px;
font: inherit; cursor: pointer; backdrop-filter: blur(2px);
}
.cam-toggle { right: 10px; width: 30px; height: 26px; font-size: 0.72rem; }
.cam-hdtest { right: 48px; height: 26px; padding: 0 9px; font-size: 0.72rem; color: #8cf; }
.cam-toggle:hover { background: rgba(60, 60, 60, 0.85); }
.cam-hdtest:hover:not(:disabled) { background: rgba(40, 60, 90, 0.85); }
.cam-hdtest:disabled { opacity: 0.4; cursor: default; }
/* Snapshot-Modus: gross + fett über dem Einzelbild */
.single-pic-banner {
position: absolute; top: 0; left: 0; right: 0; z-index: 3;
text-align: center; padding: 8px 4px;
font-size: 1.1rem; font-weight: bold; letter-spacing: 0.06em; text-transform: uppercase;
color: #ffcf6b; background: rgba(0, 0, 0, 0.7);
}
/* ── Karte / Tabelle (config.html) ───────────────────────────────────────── */
.card {
background: #fff; border-radius: 10px; padding: 20px;
box-shadow: 0 4px 10px rgba(0, 0, 0, 0.08); max-width: 760px;
}
table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid #eceef1; }
th { color: #65676b; font-weight: 600; }
tr:last-child td { border-bottom: none; }
select {
font: inherit; padding: 6px 10px;
border: 1px solid #ccd0d5; border-radius: 6px; background: #fff; cursor: pointer;
}
.warn-badge { color: #e08500; cursor: help; }
.cur { color: #8a8d91; }
.actions { margin-top: 18px; display: flex; align-items: center; gap: 14px; }
.btn-primary {
background: #2e7d46; color: #fff; border: none; border-radius: 6px;
padding: 9px 18px; font: inherit; cursor: pointer;
}
.btn-primary:hover:not(:disabled) { background: #256e3c; }
.btn-primary:disabled { opacity: 0.5; cursor: default; }
#status { font-size: 0.85rem; color: #65676b; }
#status.ok { color: #2e7d46; }
#status.err { color: #c0392b; }
.hint {
margin-top: 18px; max-width: 760px;
font-size: 0.8rem; color: #8a8d91; line-height: 1.6;
}

View File

@@ -4,73 +4,32 @@
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>AppRobotWebcam · Konfiguration</title>
<style>
* { box-sizing: border-box; margin: 0; padding: 0; }
body { background: #0f0f0f; color: #e0e0e0; font-family: monospace; }
header {
display: flex; align-items: center; gap: 12px;
padding: 10px 16px; background: #1a1a1a; border-bottom: 1px solid #333;
}
h1 { font-size: 1rem; font-weight: normal; letter-spacing: 0.05em; }
a.back {
margin-left: auto; color: #8cf; text-decoration: none;
border: 1px solid #468; padding: 5px 12px; border-radius: 3px; font-size: 0.82rem;
}
a.back:hover { background: #1d2d3d; }
main { padding: 16px; max-width: 760px; }
table { width: 100%; border-collapse: collapse; font-size: 0.85rem; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid #2a2a2a; }
th { color: #888; font-weight: normal; }
select {
background: #1a1a1a; color: #e0e0e0; border: 1px solid #444;
padding: 4px 8px; font-family: monospace; font-size: 0.85rem; border-radius: 3px;
}
.warn-badge { color: #fb4; cursor: help; }
.cur { color: #777; }
.actions { margin-top: 16px; display: flex; align-items: center; gap: 14px; }
#saveBtn {
background: #2a4a2a; color: #8f8; border: 1px solid #4a8;
padding: 7px 16px; font-family: monospace; font-size: 0.85rem;
cursor: pointer; border-radius: 3px;
}
#saveBtn:hover:not(:disabled) { background: #3a6a3a; }
#saveBtn:disabled { opacity: 0.4; cursor: default; }
#status { font-size: 0.8rem; color: #888; }
#status.ok { color: #6d6; }
#status.err { color: #f66; }
.hint { margin-top: 18px; font-size: 0.75rem; color: #666; line-height: 1.6; }
</style>
<link rel="stylesheet" href="app.css">
</head>
<body>
<header>
<h1>AppRobotWebcam · Konfiguration</h1>
<a class="back" href="/">← zum Viewer</a>
<span class="logo">AppRobotWebcam · Konfiguration</span>
<a class="hbtn ml-auto" href="/">← zum Viewer</a>
</header>
<main>
<table>
<thead>
<tr><th>ID</th><th>Name</th><th>Live-Auflösung</th><th>aktuell</th></tr>
</thead>
<tbody id="rows"><tr><td colspan="4">lädt…</td></tr></tbody>
</table>
<div class="card">
<table>
<thead>
<tr><th>ID</th><th>Name</th><th>Live-Auflösung</th><th>aktuell</th></tr>
</thead>
<tbody id="rows"><tr><td colspan="4">lädt…</td></tr></tbody>
</table>
<div class="actions">
<button id="saveBtn" disabled>Speichern &amp; Anwenden</button>
<span id="status">lädt…</span>
<div class="actions">
<button id="saveBtn" class="btn-primary" disabled>Speichern &amp; Anwenden</button>
<span id="status">lädt…</span>
</div>
</div>
<p class="hint">
Auflösungs-Änderung ist sofort aktiv (laufende Streams frieren kurz ein).<br>
„Aus" bzw. Wiedereinschalten wirkt erst nach Neuladen des Viewers.<br>
„Aus" schaltet in den Snapshot-Modus: kein Video, alle 5 s ein Einzelbild im Viewer.<br>
⚠ C920 (cam2) braucht bei kleinen 4:3-Auflösungen überdurchschnittlich Bandbreite (siehe doc/12).
</p>
</main>

View File

@@ -4,111 +4,19 @@
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>AppRobotWebcam</title>
<style>
* { box-sizing: border-box; margin: 0; padding: 0; }
body { background: #0f0f0f; color: #e0e0e0; font-family: monospace; }
header {
display: flex; align-items: center; gap: 12px;
padding: 10px 16px; background: #1a1a1a; border-bottom: 1px solid #333;
}
h1 { font-size: 1rem; font-weight: normal; letter-spacing: 0.05em; }
#statusText { font-size: 0.8rem; color: #888; }
#snapAllBtn {
margin-left: auto;
background: #2a4a2a; color: #8f8; border: 1px solid #4a8;
padding: 5px 14px; font-family: monospace; font-size: 0.82rem;
cursor: pointer; border-radius: 3px; letter-spacing: 0.03em;
}
#snapAllBtn:hover:not(:disabled) { background: #3a6a3a; }
#snapAllBtn:disabled { opacity: 0.4; cursor: default; }
/* Config-Link rechts neben dem Snapshot-Button */
#configLink {
color: #8cf; text-decoration: none; border: 1px solid #468;
padding: 5px 12px; border-radius: 3px; font-size: 0.82rem; letter-spacing: 0.03em;
}
#configLink:hover { background: #1d2d3d; }
/* Überlast-Banner */
#notice {
display: none; align-items: center; gap: 10px;
background: #4a2a2a; color: #fbb; border-bottom: 1px solid #a55;
padding: 8px 16px; font-size: 0.82rem;
}
#notice button {
background: #2a2a2a; color: #fcc; border: 1px solid #a55;
padding: 3px 10px; font-family: monospace; cursor: pointer; border-radius: 3px;
}
#cameras { display: flex; flex-wrap: wrap; gap: 12px; padding: 12px; }
.cam-box { position: relative; background: #000; border: 1px solid #2a2a2a; min-width: 320px; }
/* Live-MJPEG (multipart/x-mixed-replace) nativ im <img> */
.cam-img { display: block; width: 640px; height: 480px; background: #111; object-fit: contain; }
.cam-label {
position: absolute; top: 5px; left: 8px; z-index: 2;
background: rgba(0,0,0,.65); padding: 2px 7px; border-radius: 3px;
font-size: 0.72rem; color: #ccc;
}
/* Health-Anzeige unten links: fps · drop% */
.cam-info {
position: absolute; bottom: 5px; left: 8px; z-index: 2;
background: rgba(0,0,0,.7); padding: 2px 7px; border-radius: 3px;
font-size: 0.7rem; color: #999;
}
.cam-info.ok { color: #6d6; }
.cam-info.warn { color: #fb4; }
.cam-info.crit { color: #f66; }
/* Ein/Aus-Schalter oben rechts */
.cam-toggle {
position: absolute; top: 5px; right: 8px; z-index: 2;
background: rgba(0,0,0,.65); color: #ccc; border: 1px solid #444;
width: 26px; height: 22px; font-size: 0.7rem;
cursor: pointer; border-radius: 3px;
}
.cam-toggle:hover { background: rgba(60,60,60,.85); }
/* Snapshot-only-Kamera: Platzhalter statt Live-Bild */
.cam-placeholder {
display: flex; align-items: center; justify-content: center;
color: #444; font-size: 0.82rem; letter-spacing: 0.04em;
}
/* Snapshot-Modus: gross+fett über dem Einzelbild */
.single-pic-banner {
position: absolute; top: 0; left: 0; right: 0; z-index: 3;
text-align: center; padding: 8px 4px;
font-size: 1.15rem; font-weight: bold; letter-spacing: 0.06em;
text-transform: uppercase;
color: #fc6; background: rgba(0,0,0,.72);
}
/* Hi-Res-Test-Button (Phase 1) links neben dem Ein/Aus-Schalter */
.cam-hdtest {
position: absolute; top: 5px; right: 40px; z-index: 2;
background: rgba(0,0,0,.65); color: #8cf; border: 1px solid #468;
height: 22px; padding: 0 7px; font-family: monospace; font-size: 0.7rem;
cursor: pointer; border-radius: 3px;
}
.cam-hdtest:hover:not(:disabled) { background: rgba(40,60,90,.85); }
.cam-hdtest:disabled { opacity: 0.4; cursor: default; }
</style>
<link rel="stylesheet" href="app.css">
</head>
<body>
<header>
<h1>AppRobotWebcam</h1>
<span id="statusText">Verbinde...</span>
<button id="snapAllBtn" disabled>⬇ Snapshot alle</button>
<a id="configLink" href="config.html" title="Kamera-Konfiguration">⚙ Config</a>
<span class="logo">📷 AppRobotWebcam</span>
<span class="status" id="statusText">Verbinde</span>
<button id="snapAllBtn" class="hbtn primary" disabled>⬇ Snapshot alle</button>
<a id="configLink" class="hbtn" href="config.html" title="Kamera-Konfiguration">⚙ Config</a>
</header>
<div id="notice"></div>
<div id="cameras"></div>
<main>
<div id="cameras"></div>
</main>
<script src="viewer.js" defer></script>
</body>