first commit
build / test (push) Canceled after 0s
build / deb (amd64) (push) Canceled after 0s
build / deb (arm64) (push) Canceled after 0s
build / deb (armhf) (push) Canceled after 0s

This commit is contained in:
Mateusz Gruszczyński committed 2026-11-16 16:19:21 +01:00
commit c30064b531
93 files changed
+26367

No files matched your search

+82
View File
@@ -0,0 +1,82 @@
/* simply-dvb – "control room" style panel (inspired by RustProxy) */
:root {
color-scheme: dark;
--bg: #131615;
--panel: #1b1f1d;
--panel2: #202622;
--line: #323a34;
--row-line: #2b332c;
--muted: #a0aaa0;
--subtle: #879082;
--text: #edf0e9;
--accent: #f69b74;
--accent-hover: #ffb090;
--accent-ink: #221810;
--green: #bdd293;
--red: #ffaaa2;
--blue: #8ebcff;
--yellow: #e7c76d;
--sidebar-bg: #101310;
--nav-active-bg: #242b23;
--field-bg: #131813;
--field-line: #47523f;
--danger-line: #644a47;
--notice-bg: #29251c;
--notice-line: #554833;
--mono: ui-monospace, SFMono-Regular, "JetBrains Mono", Consolas, monospace;
--sans: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
--radius: 3px;
}
html[data-theme=light] {
color-scheme: light;
--bg: #f4f6f2;
--panel: #fff;
--panel2: #edf1eb;
--line: #cbd3c7;
--row-line: #dde3d9;
--muted: #5e685f;
--subtle: #6f786c;
--text: #1d241f;
--accent: #b85b38;
--accent-hover: #9c4729;
--accent-ink: #fff;
--green: #5f783f;
--red: #b64a43;
--blue: #2d6bc4;
--yellow: #8c6a12;
--sidebar-bg: #eef2ec;
--nav-active-bg: #dfe7da;
--field-bg: #fff;
--field-line: #b9c3b3;
--danger-line: #e3b8b3;
--notice-bg: #fbf5e6;
--notice-line: #e2d2a8;
}
html[data-theme=midnight] {
--bg: #050605;
--panel: #0c0e0d;
--panel2: #121513;
--line: #222823;
--row-line: #1a1f1b;
--sidebar-bg: #000;
--nav-active-bg: #151a15;
--field-bg: #070907;
--field-line: #333c30;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); font: 13px/1.45 var(--sans); }
a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); }
.hidden { display: none !important; }
.mono { font-family: var(--mono); }
.muted { color: var(--muted); }
.small { font-size: 11px; }
.error-text { color: var(--red); min-height: 1.2em; }
.ok-text { color: var(--green); }
.warn-text { color: var(--yellow); }
h1, h2, h3 { font-weight: 600; margin: 0; letter-spacing: -.01em; }
code, .code { font-family: var(--mono); font-size: 12px; background: var(--field-bg); border: 1px solid var(--line); padding: 1px 5px; border-radius: var(--radius); word-break: break-all; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: #4f5d50; border-radius: 6px; border: 2px solid var(--bg); }
+38
View File
@@ -0,0 +1,38 @@
/* ---------------------------------------------------------------- shell */
.shell { display: flex; min-height: 100vh; }
.sidebar { position: fixed; inset: 0 auto 0 0; width: 52px; background: var(--sidebar-bg); border-right: 1px solid var(--line); display: flex; flex-direction: column; align-items: stretch; padding: 10px 0; gap: 4px; z-index: 20; transition: width .15s; overflow: hidden; }
.sidebar:hover { width: 190px; box-shadow: 4px 0 18px #0006; }
.sidebar a { display: flex; align-items: center; gap: 12px; height: 36px; padding: 0 15px; color: var(--muted); border-left: 2px solid transparent; white-space: nowrap; }
.sidebar a span { display: none; font-size: 13px; }
.sidebar:hover a span { display: inline; }
.sidebar a:hover { color: var(--text); background: var(--nav-active-bg); }
.sidebar a.active { color: var(--green); background: var(--nav-active-bg); border-left-color: var(--green); }
.sidebar svg { width: 18px; height: 18px; flex: 0 0 18px; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.sidebar svg .fill { fill: currentColor; }
.brand-mark { display: inline-flex; flex: 0 0 auto; align-items: center; justify-content: center; box-sizing: border-box; width: 34px; height: 34px; border: 2px solid var(--accent); color: var(--accent); font: 700 13px/1 var(--mono); letter-spacing: -.02em; border-radius: 4px; white-space: nowrap; }
.brand-mark.big { width: 54px; height: 54px; font-size: 20px; margin: 0 0 18px; }
/* Sidebar brand link: its own box, not styled like the nav items (no left border/padding/hover). */
.sidebar a.brand { height: 48px; padding: 0 0 0 9px; margin-bottom: 8px; border-left: 0; background: none; }
.sidebar a.brand:hover { background: none; }
.sidebar a.brand .brand-mark { display: inline-flex; }
.sidebar-foot { margin-top: auto; display: flex; justify-content: center; padding: 10px; }
.live-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--subtle); display: inline-block; }
.live-dot.on { background: var(--green); box-shadow: 0 0 6px var(--green); }
.live-dot.off { background: var(--red); }
.main { flex: 1; margin-left: 52px; min-width: 0; }
.topbar { display: flex; justify-content: space-between; align-items: center; height: 42px; padding: 0 18px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: var(--bg); z-index: 10; }
.crumbs { font: 11px var(--mono); letter-spacing: .12em; text-transform: uppercase; color: var(--muted); display: flex; gap: 10px; }
.crumbs #crumb { color: var(--text); text-transform: none; letter-spacing: .04em; }
.crumbs .sep { color: var(--subtle); }
.top-actions { display: flex; gap: 8px; align-items: center; }
.who { font: 11px var(--mono); color: var(--muted); padding: 0 6px; }
.view { padding: 18px 18px 40px; }
/* ---------------------------------------------------------------- page header */
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; margin-bottom: 16px; flex-wrap: wrap; }
.eyebrow { font: 10px var(--mono); letter-spacing: .16em; text-transform: uppercase; color: var(--green); display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.eyebrow::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.page-head h1 { font-size: 26px; }
.page-head p { margin: 6px 0 0; color: var(--muted); font-size: 12px; }
.actions { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
+92
View File
@@ -0,0 +1,92 @@
/* ---------------------------------------------------------------- panels */
.grid { display: grid; gap: 10px; }
.g1 { grid-template-columns: minmax(0, 1fr); }
.g2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.g3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.g4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.panel { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; min-width: 0; }
.panel > header { display: flex; justify-content: space-between; align-items: center; gap: 10px; margin-bottom: 10px; flex-wrap: wrap; }
.panel > header h2 { font-size: 14px; }
.panel + .panel, .grid + .panel, .panel + .grid, .grid + .grid { margin-top: 10px; }
.grid > .panel + .panel { margin-top: 0; }
.stat .label, .label { font: 10px var(--mono); letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.stat .value { font: 500 26px var(--mono); margin-top: 8px; }
.stat .sub { font: 11px var(--mono); color: var(--muted); margin-top: 4px; }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 4px 14px; font-size: 12px; }
.kv > :nth-child(odd) { color: var(--muted); font: 11px var(--mono); padding-top: 1px; }
.pill { display: inline-block; font: 10px var(--mono); letter-spacing: .06em; padding: 2px 7px; border: 1px solid var(--field-line); border-radius: 2px; color: var(--muted); white-space: nowrap; }
.pill.ok { color: var(--green); border-color: #576847; }
.pill.warn { color: var(--yellow); border-color: var(--notice-line); }
.pill.err { color: var(--red); border-color: var(--danger-line); }
.pill.acc { color: var(--accent); border-color: #6d5a45; }
.pill.blue { color: var(--blue); border-color: #3b5272; }
.notice { background: var(--notice-bg); border: 1px solid var(--notice-line); color: var(--text); padding: 10px 12px; border-radius: var(--radius); font-size: 12px; margin-bottom: 10px; }
.empty { color: var(--muted); padding: 24px; text-align: center; border: 1px dashed var(--line); border-radius: var(--radius); }
/* meters */
.meter { height: 6px; background: var(--line); border-radius: 3px; overflow: hidden; margin: 6px 0 2px; }
.meter > i { display: block; height: 100%; background: var(--accent); border-radius: 3px; transition: width .4s; }
.meter.good > i { background: var(--green); }
.meter.bad > i { background: var(--red); }
.meter.blue > i { background: var(--blue); }
.spark { width: 100%; height: 46px; display: block; }
.spark path { fill: none; stroke: var(--accent); stroke-width: 1.6; }
.spark .area { fill: var(--accent); opacity: .12; stroke: none; }
/* ---------------------------------------------------------------- tables */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 12px; }
th { text-align: left; font: 10px var(--mono); letter-spacing: .1em; text-transform: uppercase; color: var(--muted); font-weight: 400; padding: 6px 8px; border-bottom: 1px solid var(--line); white-space: nowrap; }
td { padding: 6px 8px; border-bottom: 1px solid var(--row-line); vertical-align: middle; }
tr:hover td { background: var(--panel2); }
td.num, th.num { text-align: right; font-family: var(--mono); }
td.actions-cell { text-align: right; white-space: nowrap; }
tr.dragging td { opacity: .4; }
tr.drop-target td { border-top: 2px solid var(--accent); }
.drag { cursor: grab; color: var(--subtle); user-select: none; font-size: 14px; padding: 0 4px; }
.logo { width: 46px; height: 28px; object-fit: contain; display: block; }
.logo-ph { width: 46px; height: 28px; display: flex; align-items: center; justify-content: center; font: 600 10px var(--mono); color: var(--subtle); border: 1px dashed var(--line); border-radius: 2px; }
/* ---------------------------------------------------------------- forms */
input, select, textarea { font: 12px var(--sans); color: var(--text); background: var(--field-bg); border: 1px solid var(--field-line); border-radius: var(--radius); padding: 6px 8px; min-height: 28px; max-width: 100%; }
input:focus, select:focus, textarea:focus { outline: 1px solid var(--accent); border-color: var(--accent); }
textarea { width: 100%; min-height: 70px; font-family: var(--mono); resize: vertical; }
input[type=checkbox] { min-height: 0; width: 15px; height: 15px; accent-color: var(--accent); vertical-align: middle; }
label { display: flex; flex-direction: column; gap: 4px; font: 11px var(--mono); color: var(--muted); letter-spacing: .02em; }
label.check { flex-direction: row; align-items: center; gap: 8px; font: 12px var(--sans); color: var(--text); }
.form-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 12px; }
.form-grid .full { grid-column: 1 / -1; }
.hint { font: 11px var(--sans); color: var(--subtle); }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.btn { font: 12px var(--sans); display: inline-flex; align-items: center; gap: 6px; padding: 5px 11px; min-height: 28px; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); color: var(--text); cursor: pointer; white-space: nowrap; }
.btn:hover { border-color: #89917c; }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); font-weight: 600; }
.btn.primary:hover { background: var(--accent-hover); }
.btn.danger { color: var(--red); border-color: var(--danger-line); }
.btn.ghost { background: transparent; }
.btn.small { padding: 2px 8px; min-height: 22px; font-size: 11px; }
.btn.icon { padding: 2px 8px; }
.btn.wide { width: 100%; justify-content: center; }
.btn:disabled { opacity: .5; cursor: default; }
.switch { position: relative; width: 30px; height: 16px; display: inline-block; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch span { position: absolute; inset: 0; background: var(--line); border-radius: 10px; cursor: pointer; transition: .15s; }
.switch span::before { content: ""; position: absolute; width: 12px; height: 12px; left: 2px; top: 2px; background: var(--muted); border-radius: 50%; transition: .15s; }
.switch input:checked + span { background: #4d6136; }
.switch input:checked + span::before { transform: translateX(14px); background: var(--green); }
.tabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); margin-bottom: 12px; }
.tabs button { background: none; border: none; color: var(--muted); padding: 7px 12px; cursor: pointer; font: 12px var(--sans); border-bottom: 2px solid transparent; }
.tabs button.active { color: var(--text); border-bottom-color: var(--accent); }
/* ---------------------------------------------------------------- modal & toasts */
.modal { position: fixed; inset: 0; background: rgba(0, 0, 0, .68); display: flex; align-items: flex-start; justify-content: center; z-index: 50; padding: 6vh 16px; overflow-y: auto; }
.modal-card { background: var(--panel); border: 1px solid var(--line); border-radius: 4px; width: min(720px, 100%); padding: 16px 18px; box-shadow: 0 12px 40px #0009; }
.modal-card.wide { width: min(1100px, 100%); }
.modal-card > header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; }
.modal-card > header h2 { font-size: 16px; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }
.toasts { position: fixed; right: 16px; bottom: 16px; display: flex; flex-direction: column; gap: 8px; z-index: 60; }
.toast { background: #d0dfb4; color: #1c2818; border: 1px solid #ebf2de; padding: 9px 14px; border-radius: 3px; font-size: 12px; max-width: 420px; box-shadow: 0 6px 20px #0007; animation: slide .2s; white-space: pre-wrap; }
.toast.err { background: #ffd2bd; color: #42241b; border-color: #ff9f7a; }
@keyframes slide { from { transform: translateY(10px); opacity: 0; } }
+141
View File
@@ -0,0 +1,141 @@
/* ---------------------------------------------------------------- login */
.login { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 20px; }
.login-card { width: 340px; background: var(--panel); border: 1px solid var(--line); padding: 28px; border-radius: 4px; display: flex; flex-direction: column; gap: 12px; }
.login-card h1 { font-size: 24px; margin-bottom: 6px; }
.login-card input { padding: 9px 10px; font-size: 13px; }
/* ---------------------------------------------------------------- tuner cards */
.tuner { display: grid; grid-template-columns: 1fr; gap: 8px; }
.tuner .t-head { display: flex; justify-content: space-between; gap: 10px; align-items: flex-start; }
.tuner h3 { font-size: 14px; }
.tuner .t-meta { font: 11px var(--mono); color: var(--muted); }
.sig { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 10px; }
.sig .value { font: 500 18px var(--mono); margin-top: 4px; }
/* ---------------------------------------------------------------- TV */
.tv { display: grid; grid-template-columns: 320px minmax(0, 1fr); gap: 10px; align-items: start; }
.tv-list { max-height: calc(100vh - 150px); overflow-y: auto; padding: 0; }
.tv-list .search { padding: 8px; border-bottom: 1px solid var(--line); position: sticky; top: 0; background: var(--panel); z-index: 1; display: flex; gap: 6px; }
.tv-list .search input { flex: 1; }
.ch-item { display: grid; grid-template-columns: 28px 50px 1fr; gap: 8px; align-items: center; padding: 7px 10px; border-bottom: 1px solid var(--row-line); cursor: pointer; }
.ch-item:hover { background: var(--panel2); }
.ch-item.active { background: var(--nav-active-bg); box-shadow: inset 2px 0 0 var(--accent); }
.ch-item .n { font: 11px var(--mono); color: var(--muted); text-align: right; }
.ch-item .t { min-width: 0; }
.ch-item .name { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ch-item .now { font-size: 11px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ch-item .meter { height: 3px; margin: 3px 0 0; }
.player { position: relative; background: #000; aspect-ratio: 16 / 9; width: 100%; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.player video { width: 100%; height: 100%; display: block; background: #000; }
.player .overlay { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; color: #ddd; font: 12px var(--mono); pointer-events: none; text-align: center; padding: 20px; background: radial-gradient(circle, #0008, #000c); }
.player .overlay.err { color: #ffaaa2; }
.player .badge { position: absolute; top: 10px; left: 10px; font: 10px var(--mono); letter-spacing: .1em; color: #fff; background: #c43c2acc; padding: 2px 7px; border-radius: 2px; pointer-events: none; }
.spinner { width: 28px; height: 28px; border: 3px solid #fff3; border-top-color: var(--accent); border-radius: 50%; animation: spin 1s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.np { display: grid; grid-template-columns: 1fr auto; gap: 10px; }
.np h2 { font-size: 18px; }
.np .time { font: 11px var(--mono); color: var(--muted); }
.np .desc { color: var(--muted); font-size: 12px; margin-top: 6px; max-height: 7.5em; overflow: auto; white-space: pre-line; }
.day-list .ev { display: grid; grid-template-columns: 52px 1fr auto; gap: 8px; padding: 5px 0; border-bottom: 1px solid var(--row-line); align-items: center; }
.day-list .ev.cur { color: var(--accent); }
.day-list .ev.past { color: var(--subtle); }
.day-list .ev .tm { font: 11px var(--mono); }
/* ---------------------------------------------------------------- EPG grid */
.epg { position: relative; overflow: auto; max-height: calc(100vh - 170px); border: 1px solid var(--line); background: var(--panel); }
.epg-inner { position: relative; }
.epg-row { display: flex; height: 52px; border-bottom: 1px solid var(--row-line); }
.epg-ch { position: sticky; left: 0; z-index: 3; width: 170px; flex: 0 0 170px; background: var(--panel); border-right: 1px solid var(--line); display: flex; align-items: center; gap: 8px; padding: 0 8px; font-size: 12px; cursor: pointer; }
.epg-ch .n { font: 10px var(--mono); color: var(--muted); width: 22px; text-align: right; }
.epg-ch .logo, .epg-ch .logo-ph { width: 40px; height: 24px; }
.epg-ch .nm { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; font-weight: 600; }
.epg-track { position: relative; flex: 1; }
.epg-ev { position: absolute; top: 4px; bottom: 4px; background: var(--panel2); border: 1px solid var(--line); border-radius: 2px; padding: 4px 7px; overflow: hidden; cursor: pointer; font-size: 11px; white-space: nowrap; }
.epg-ev:hover { border-color: var(--accent); z-index: 2; }
.epg-ev .tt { font-weight: 600; overflow: hidden; text-overflow: ellipsis; }
.epg-ev .tm { font: 10px var(--mono); color: var(--muted); }
.epg-ev.cur { border-color: #6d5a45; background: #2a2620; }
html[data-theme=light] .epg-ev.cur { background: #fbeee6; }
.epg-ev.rec::after { content: "●"; color: #e25b45; position: absolute; right: 5px; top: 3px; font-size: 10px; }
.epg-head { display: flex; position: sticky; top: 0; z-index: 4; background: var(--panel); border-bottom: 1px solid var(--line); height: 26px; }
.epg-head .corner { position: sticky; left: 0; width: 170px; flex: 0 0 170px; background: var(--panel); border-right: 1px solid var(--line); z-index: 5; }
.epg-head .hours { position: relative; flex: 1; }
.epg-head .h { position: absolute; top: 0; height: 26px; border-left: 1px solid var(--line); font: 10px var(--mono); color: var(--muted); padding: 6px 6px; }
.epg-now { position: absolute; top: 0; bottom: 0; width: 2px; background: var(--accent); z-index: 2; pointer-events: none; }
/* ---------------------------------------------------------------- scan log */
.log { font: 11px/1.6 var(--mono); background: var(--field-bg); border: 1px solid var(--line); padding: 8px 10px; max-height: 260px; overflow: auto; white-space: pre-wrap; border-radius: var(--radius); }
.copy-row { display: flex; gap: 6px; align-items: center; margin: 4px 0; }
.copy-row code { flex: 1; padding: 5px 8px; }
/* ---------------------------------------------------------------- bare pages (watch, message) */
body.bare { min-height: 100vh; }
.message { max-width: 520px; margin: 18vh auto; padding: 20px; text-align: center; }
.message .brand-mark { margin: 0 auto 16px; }
.watch-head { display: flex; gap: 14px; align-items: center; padding: 16px 22px; border-bottom: 1px solid var(--line); }
.watch-head .brand-mark { margin: 0; }
.watch-head h1 { font-size: 20px; }
.watch-main { max-width: 1200px; margin: 18px auto; padding: 0 16px; }
.player .osd { position: absolute; top: 12px; right: 14px; font: 600 22px var(--mono); color: #fff; background: #000a; padding: 6px 12px; border-radius: 3px; opacity: 0; transition: opacity .25s; pointer-events: none; text-shadow: 0 1px 2px #000; }
.player .osd.show { opacity: 1; }
.player:fullscreen { border: 0; border-radius: 0; }
/* ---------------------------------------------------------------- live charts */
.section-head { display: flex; align-items: center; justify-content: space-between; margin: 14px 0 8px; }
.section-head h2 { font-size: 14px; }
.chart-card { position: relative; padding: 12px 14px 10px; }
.chart-head { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; flex-wrap: wrap; margin-bottom: 6px; }
.chart-vals { display: flex; gap: 12px; flex-wrap: wrap; font: 11px var(--mono); color: var(--muted); }
.chart-vals b { color: var(--text); font-weight: 600; }
.chart-vals .cv i { display: inline-block; width: 8px; height: 8px; border-radius: 2px; margin-right: 4px; vertical-align: 0; }
.chart { width: 100%; height: 92px; display: block; overflow: visible; }
.chart .g { stroke: var(--row-line); stroke-width: 1; vector-effect: non-scaling-stroke; }
.chart .ln { fill: none; stroke-width: 1.6; vector-effect: non-scaling-stroke; stroke-linejoin: round; }
.chart .area { opacity: .12; stroke: none; }
.chart rect { opacity: .85; }
.chart .cursor { stroke: var(--muted); stroke-width: 1; stroke-dasharray: 3 3; vector-effect: non-scaling-stroke; }
.chart-scale { position: absolute; right: 16px; top: 36px; bottom: 26px; display: flex; flex-direction: column; justify-content: space-between; font: 9px var(--mono); color: var(--subtle); pointer-events: none; text-align: right; }
.chart-hover { min-height: 14px; margin-top: 4px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tuner-charts { margin-top: 4px; }
.tuner-charts .chart-card { background: var(--panel2); }
.player .overlay .hint { max-width: 560px; margin-top: 8px; font-size: 12px; color: #ddd; text-align: center; line-height: 1.45; }
.player .overlay .btn { margin-top: 10px; }
/* ---------------------------------------------------------------- channel filters */
.filters { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; padding: 0 0 12px; border-bottom: 1px solid var(--row-line); margin-bottom: 8px; }
.filters input:not([type]) { width: 200px; }
.filters select { width: auto; }
.filters .check { font-size: 12px; white-space: nowrap; }
.filters .spacer { flex: 1; }
tr.off td { opacity: .55; }
tr.off td:last-child, tr.off td:nth-last-child(2), tr.off td:nth-last-child(3) { opacity: 1; }
/* ---------------------------------------------------------------- logs */
.log-view { max-height: calc(100vh - 300px); min-height: 320px; white-space: normal; padding: 4px 0; }
.log-line { display: grid; grid-template-columns: 150px 46px 120px 1fr auto; gap: 10px; padding: 2px 10px; border-bottom: 1px solid var(--row-line); align-items: baseline; }
.log-line:hover { background: var(--panel2); }
.log-ts { color: var(--subtle); white-space: nowrap; }
.log-lv { font-weight: 600; color: var(--muted); }
.log-cat { color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.log-msg { white-space: pre-wrap; word-break: break-word; color: var(--text); }
.log-target { color: var(--subtle); font-size: 10px; white-space: nowrap; max-width: 160px; overflow: hidden; text-overflow: ellipsis; }
.lv-warn .log-lv { color: var(--yellow); }
.lv-error .log-lv, .lv-error .log-msg { color: var(--red); }
.lv-debug .log-msg { color: var(--muted); }
#log-cats button .pill { margin-left: 2px; padding: 0 5px; }
@media (max-width: 900px) { .log-line { grid-template-columns: 1fr; gap: 0; } .log-target { display: none; } }
/* ---------------------------------------------------------------- recording schedule */
.sched-day { margin: 14px 0; }
.sched-head { font-size: 13px; margin-bottom: 4px; }
.sched-grid { position: relative; border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel2);
background-image: repeating-linear-gradient(90deg, var(--row-line) 0 1px, transparent 1px calc(100% / 24)); }
.sched-tick { position: absolute; top: 1px; font: 9px var(--mono); color: var(--subtle); transform: translateX(3px); }
.sched-now { position: absolute; top: 0; bottom: 0; width: 2px; background: var(--red); z-index: 2; }
.sched-bar { position: absolute; height: 22px; line-height: 22px; padding: 0 6px; font-size: 11px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
border-radius: 3px; background: color-mix(in srgb, var(--c) 28%, transparent); border-left: 3px solid var(--c); color: var(--text); }
.sched-bar.live { box-shadow: 0 0 0 1px var(--red) inset; }
.sched-bar.conflict { background: repeating-linear-gradient(135deg, color-mix(in srgb, var(--red) 35%, transparent) 0 6px, color-mix(in srgb, var(--red) 15%, transparent) 6px 12px); border-left-color: var(--red); }
tr.row-warn td { background: color-mix(in srgb, var(--red) 8%, transparent); }
+40
View File
@@ -0,0 +1,40 @@
/* ---------------------------------------------------------------- personalizacja */
html[data-density=compact] .view { padding: 12px 12px 30px; }
html[data-density=compact] .panel { padding: 8px 10px; }
html[data-density=compact] td { padding: 4px 6px; }
html[data-density=compact] .btn { min-height: 24px; padding: 3px 9px; }
html[data-density=compact] .ch-item { padding: 4px 8px; }
html[data-density=compact] .page-head { margin-bottom: 10px; }
html[data-density=compact] .page-head h1 { font-size: 22px; }
html[data-density=compact] .stat .value { font-size: 22px; margin-top: 4px; }
html[data-density=compact] .grid { gap: 8px; }
html[data-sidebar=pinned] .sidebar { width: 190px; }
html[data-sidebar=pinned] .sidebar a span { display: inline; }
html[data-sidebar=pinned] .main { margin-left: 190px; }
html[data-sidebar=pinned] .sidebar:hover { box-shadow: none; }
html[data-motion=off] *:not(.spinner) { transition: none !important; animation: none !important; }
.hide-logos .ch-item { grid-template-columns: 28px 1fr; }
.hide-logos .ch-item .logo, .hide-logos .ch-item .logo-ph { display: none; }
.hide-progress .ch-item .meter { display: none; }
.clock { font: 12px var(--mono); color: var(--text); padding: 0 8px; letter-spacing: .04em; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.seg button { background: var(--panel); color: var(--muted); border: 0; border-right: 1px solid var(--line); padding: 4px 9px; font: 11px var(--mono); cursor: pointer; min-height: 26px; }
.seg button:last-child { border-right: 0; }
.seg button.on { background: var(--nav-active-bg); color: var(--accent); }
.swatches { display: flex; gap: 8px; flex-wrap: wrap; }
.swatch { width: 26px; height: 26px; border-radius: 50%; border: 2px solid var(--line); cursor: pointer; padding: 0; }
.swatch.on { border-color: var(--text); box-shadow: 0 0 0 2px var(--bg) inset; }
.pref-row { display: grid; grid-template-columns: 220px 1fr; gap: 10px; align-items: center; padding: 7px 0; border-bottom: 1px solid var(--row-line); }
.pref-row:last-child { border-bottom: 0; }
.pref-row > span { color: var(--muted); font: 11px var(--mono); letter-spacing: .03em; }
@media (max-width: 860px) {
html[data-sidebar=pinned] .main { margin-left: 52px; }
html[data-sidebar=pinned] .sidebar { width: 52px; }
html[data-sidebar=pinned] .sidebar a span { display: none; }
.pref-row { grid-template-columns: 1fr; }
}
/* language picker (one option per langs/*.json pack) */
.lang-select { background: var(--panel); color: var(--muted); border: 1px solid var(--line); border-radius: var(--radius); font: 11px var(--mono); min-height: 28px; padding: 3px 6px; cursor: pointer; max-width: 220px; }
.lang-select:hover, .lang-select:focus { color: var(--text); border-color: var(--accent); outline: none; }
#lang-switch .lang-select { width: auto; }
+12
View File
@@ -0,0 +1,12 @@
/* ---------------------------------------------------------------- responsive */
@media (max-width: 1100px) { .g4 { grid-template-columns: repeat(2, minmax(0, 1fr)); } .g3 { grid-template-columns: 1fr 1fr; } }
@media (max-width: 860px) {
.tv { grid-template-columns: 1fr; }
.tv-list { max-height: 40vh; order: 2; }
.g2, .g3, .g4 { grid-template-columns: 1fr; }
.view { padding: 12px; }
.who { display: none; }
.epg-ch, .epg-head .corner { width: 110px; flex-basis: 110px; }
.epg-ch .logo, .epg-ch .logo-ph { display: none; }
}
+1
View File
@@ -0,0 +1 @@
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 64 64"><rect x="2" y="2" width="60" height="60" rx="6" fill="#131615" stroke="#f69b74" stroke-width="4"/><text x="32" y="42" font-family="ui-monospace,Consolas,monospace" font-size="26" font-weight="700" text-anchor="middle" fill="#f69b74">s/d</text></svg>

After

Width:  |  Height:  |  Size: 310 B

+56
View File
@@ -0,0 +1,56 @@
<!doctype html>
<html lang="pl">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width,initial-scale=1">
<title>simply-dvb</title>
<link rel="icon" href="/assets/favicon.svg">
__ASSETS__
</head>
<body>
<div id="login" class="login hidden">
<form id="login-form" class="login-card" autocomplete="on">
<div class="brand-mark big">s/d</div>
<div class="eyebrow">simply-dvb · panel</div>
<h1>Sign in</h1>
<label>Username<input name="username" autocomplete="username" required autofocus></label>
<label>Password<input name="password" type="password" autocomplete="current-password" required></label>
<button class="btn primary wide" type="submit">Sign in</button>
<p id="login-error" class="error-text"></p>
</form>
</div>
<div id="shell" class="shell hidden">
<nav class="sidebar" id="sidebar">
<a class="brand" href="#/overview" title="simply-dvb"><span class="brand-mark">s/d</span></a>
<a data-route="overview" href="#/overview" title="Overview"><svg viewBox="0 0 24 24"><rect x="3" y="3" width="7" height="7"/><rect x="14" y="3" width="7" height="7"/><rect x="3" y="14" width="7" height="7"/><rect x="14" y="14" width="7" height="7"/></svg><span>Overview</span></a>
<a data-route="tv" href="#/tv" title="TV"><svg viewBox="0 0 24 24"><rect x="2" y="6" width="20" height="13" rx="1"/><path d="M8 2l4 4 4-4"/></svg><span>TV</span></a>
<a data-route="epg" href="#/epg" title="TV guide"><svg viewBox="0 0 24 24"><rect x="3" y="4" width="18" height="17" rx="1"/><path d="M3 9h18M8 2v4M16 2v4M7 13h4M7 17h8"/></svg><span>TV guide</span></a>
<a data-route="channels" href="#/channels" title="Channels"><svg viewBox="0 0 24 24"><path d="M8 6h13M8 12h13M8 18h13"/><circle cx="4" cy="6" r="1"/><circle cx="4" cy="12" r="1"/><circle cx="4" cy="18" r="1"/></svg><span>Channels</span></a>
<a data-route="recordings" href="#/recordings" title="Recordings"><svg viewBox="0 0 24 24"><circle cx="12" cy="12" r="9"/><circle cx="12" cy="12" r="3.5" class="fill"/></svg><span>Recordings</span></a>
<a data-route="tuners" href="#/tuners" title="Tuners & scanning"><svg viewBox="0 0 24 24"><path d="M5 12.5a10 10 0 0 1 14 0M8.5 16a5 5 0 0 1 7 0"/><circle cx="12" cy="19.5" r="1" class="fill"/><path d="M2 9a14.5 14.5 0 0 1 20 0"/></svg><span>Tuners</span></a>
<a data-route="access" href="#/access" title="Access & sharing"><svg viewBox="0 0 24 24"><path d="M12 3l8 3v6c0 4.5-3.4 8.3-8 9-4.6-.7-8-4.5-8-9V6z"/><path d="M9 12l2 2 4-4"/></svg><span>Access</span></a>
<a data-route="logs" href="#/logs" title="Logs"><svg viewBox="0 0 24 24"><path d="M4 5h16M4 10h10M4 15h16M4 20h7"/></svg><span>Logs</span></a>
<a data-route="settings" href="#/settings" title="Settings"><svg viewBox="0 0 24 24"><circle cx="12" cy="12" r="3"/><path d="M19.4 15a1.7 1.7 0 0 0 .3 1.8l.1.1a2 2 0 1 1-2.8 2.8l-.1-.1a1.7 1.7 0 0 0-1.8-.3 1.7 1.7 0 0 0-1 1.5V21a2 2 0 1 1-4 0v-.1a1.7 1.7 0 0 0-1.1-1.5 1.7 1.7 0 0 0-1.8.3l-.1.1a2 2 0 1 1-2.8-2.8l.1-.1a1.7 1.7 0 0 0 .3-1.8 1.7 1.7 0 0 0-1.5-1H3a2 2 0 1 1 0-4h.1a1.7 1.7 0 0 0 1.5-1.1 1.7 1.7 0 0 0-.3-1.8l-.1-.1a2 2 0 1 1 2.8-2.8l.1.1a1.7 1.7 0 0 0 1.8.3H9a1.7 1.7 0 0 0 1-1.5V3a2 2 0 1 1 4 0v.1a1.7 1.7 0 0 0 1 1.5 1.7 1.7 0 0 0 1.8-.3l.1-.1a2 2 0 1 1 2.8 2.8l-.1.1a1.7 1.7 0 0 0-.3 1.8V9a1.7 1.7 0 0 0 1.5 1H21a2 2 0 1 1 0 4h-.1a1.7 1.7 0 0 0-1.5 1z"/></svg><span>Settings</span></a>
<div class="sidebar-foot"><span class="live-dot" id="live-dot" title="Server connection"></span></div>
</nav>
<div class="main">
<header class="topbar">
<div class="crumbs"><span class="crumb-root" id="server-name">CONTROL ROOM</span><span class="sep">/</span><span id="crumb">Overview</span></div>
<div class="top-actions">
<span class="clock hidden" id="clock"></span>
<div id="lang-switch" data-no-i18n></div>
<button class="btn ghost icon" id="theme-toggle" title="Theme"><svg viewBox="0 0 24 24" width="14" height="14" aria-hidden="true"><circle cx="12" cy="12" r="9" fill="none" stroke="currentColor" stroke-width="2"/><path d="M12 3a9 9 0 0 1 0 18z" fill="currentColor"/></svg></button>
<span class="who" id="who"></span>
<button class="btn ghost" id="logout">⎋ Sign out</button>
</div>
</header>
<section id="view" class="view"></section>
</div>
</div>
<div id="modal" class="modal hidden"><div class="modal-card" role="dialog"><header><h2 id="modal-title"></h2><button class="btn ghost icon" id="modal-close" title="Close">✕</button></header><div id="modal-body"></div></div></div>
<div id="toasts" class="toasts"></div>
</body>
</html>
+193
View File
@@ -0,0 +1,193 @@
/* simply-dvb – UI translation engine.
* The UI source text is English and doubles as the translation key (gettext style).
* Language packs live in langs/<locale>.json ({meta, translations, patterns}); build.rs
* validates them and embeds them in the bundle as window.SDVB_LANGS. When a language other
* than English is active, every text node inserted into the DOM (and placeholder/title/
* aria-label) is translated; missing entries fall back to the English source text.
* Pattern replacements use $1..$9 for raw groups and $t1..$t9 for groups translated again. */
(function () {
'use strict';
var LANG_KEY = 'sdvb-lang';
var DEFAULT = 'en_US';
var LANGS = {};
(window.SDVB_LANGS || []).forEach(function (p) {
var code = p.meta.locale;
LANGS[code] = {
name: p.meta.native_name || p.meta.name || code,
english: p.meta.name || code,
dir: p.meta.direction || 'ltr',
dict: p.translations || {},
rx: (p.patterns || []).map(function (x) { return [new RegExp(x.match), x.replace]; })
};
});
if (!LANGS[DEFAULT]) LANGS[DEFAULT] = { name: 'English', english: 'English', dir: 'ltr', dict: {}, rx: [] };
/** Resolves a stored or requested code ("pl", "pl-PL", "pl_PL") to an available locale. */
function resolve(code) {
if (!code) return null;
var c = String(code).replace('-', '_');
if (LANGS[c]) return c;
var base = c.split('_')[0].toLowerCase();
var keys = Object.keys(LANGS);
for (var i = 0; i < keys.length; i++) if (keys[i].split('_')[0].toLowerCase() === base) return keys[i];
return null;
}
var saved = null;
try { saved = localStorage.getItem(LANG_KEY); } catch (e) {}
var lang = resolve(saved) || DEFAULT;
var active = lang !== DEFAULT;
function expand(tpl, m) {
return tpl.replace(/\$(t?)(\d)/g, function (_, t, n) {
var g = m[+n] == null ? '' : m[+n];
return t ? tr(g) : g;
});
}
function lookup(k) {
var L = LANGS[lang];
if (Object.prototype.hasOwnProperty.call(L.dict, k)) return L.dict[k];
for (var i = 0; i < L.rx.length; i++) {
var m = L.rx[i][0].exec(k);
if (m) return expand(L.rx[i][1], m);
}
return undefined;
}
function tr(s) {
if (!active || s == null) return s;
var str = String(s);
var k = str.trim();
if (!k) return str;
var v = lookup(k);
if (v === undefined || v === '') return str;
return str.replace(k, function () { return v; });
}
var SKIP = { SCRIPT: 1, STYLE: 1, CODE: 1, TEXTAREA: 1 };
var ATTRS = ['placeholder', 'title', 'aria-label'];
function translateTree(root) {
if (!active || !root) return;
if (root.nodeType === 3) {
var p = root.parentNode;
if (p && !SKIP[p.nodeName]) { var n = tr(root.nodeValue); if (n !== root.nodeValue) root.nodeValue = n; }
return;
}
if (root.nodeType !== 1 || SKIP[root.nodeName] || (root.hasAttribute && root.hasAttribute('data-no-i18n'))) return;
var els = [root].concat(Array.prototype.slice.call(root.querySelectorAll('[placeholder],[title],[aria-label]')));
els.forEach(function (el) {
ATTRS.forEach(function (a) {
if (el.hasAttribute(a)) { var v = el.getAttribute(a), n = tr(v); if (n !== v) el.setAttribute(a, n); }
});
});
var w = document.createTreeWalker(root, NodeFilter.SHOW_TEXT, {
acceptNode: function (node) {
for (var e = node.parentNode; e && e !== root.parentNode; e = e.parentNode) {
if (SKIP[e.nodeName] || (e.hasAttribute && e.hasAttribute('data-no-i18n'))) return NodeFilter.FILTER_REJECT;
}
return NodeFilter.FILTER_ACCEPT;
}
});
var node;
while ((node = w.nextNode())) {
var nv = tr(node.nodeValue);
if (nv !== node.nodeValue) node.nodeValue = nv;
}
}
function boot() {
document.documentElement.lang = lang.replace('_', '-');
document.documentElement.dir = LANGS[lang].dir;
if (!active) return;
translateTree(document.body);
new MutationObserver(function (list) {
list.forEach(function (m) {
if (m.type === 'attributes') { translateTree(m.target); return; }
m.addedNodes.forEach(translateTree);
});
}).observe(document.body, { childList: true, subtree: true, attributes: true, attributeFilter: ATTRS });
}
if (document.readyState === 'loading') document.addEventListener('DOMContentLoaded', boot);
else Promise.resolve().then(boot);
window.I18N = {
get lang() { return lang; },
/** Short UI code of the active language, e.g. "EN". */
get short() { return lang.split('_')[0].toUpperCase(); },
tr: tr,
/** Available languages: [{code, short, name, english}], English first, then by name. */
languages: function () {
return Object.keys(LANGS).sort(function (a, b) {
return (a === DEFAULT ? -1 : b === DEFAULT ? 1 : 0) || LANGS[a].english.localeCompare(LANGS[b].english);
}).map(function (c) {
return { code: c, short: c.split('_')[0].toUpperCase(), name: LANGS[c].name, english: LANGS[c].english };
});
},
setLang: function (l) {
try { localStorage.setItem(LANG_KEY, resolve(l) || DEFAULT); } catch (e) {}
location.reload();
},
/** For tooling: English keys with no translation in the given language. */
missing: function (code) {
var c = resolve(code) || code, d = (LANGS[c] || {}).dict || {}, en = LANGS[DEFAULT].dict;
return Object.keys(en).filter(function (k) { return !Object.prototype.hasOwnProperty.call(d, k); });
}
};
})();
/* UI personalization (stored in localStorage, applied before the first render). */
(function () {
'use strict';
var KEY = 'sdvb-prefs';
var DEFAULTS = { chartWindow: 10, theme: 'dark', accent: 'orange', density: 'comfortable', scale: 100, sidebar: 'hover', start: 'overview',
logos: true, progress: true, autoplay: false, epgZoom: 4, clock: false, motion: true };
var ACCENTS = {
orange: ['#f69b74', '#ffb090', '#221810', '#b85b38'],
green: ['#bdd293', '#d3e6ad', '#1b2410', '#5f783f'],
blue: ['#8ebcff', '#b0d0ff', '#0c1a2e', '#2d6bc4'],
violet: ['#c5a3ff', '#d8c0ff', '#1d1230', '#7a4fc4'],
red: ['#ff8a80', '#ffaaa2', '#2b0f0c', '#b64a43'],
teal: ['#6fd6c6', '#94e6d9', '#0c2420', '#1f8a7a'],
amber: ['#f2c14e', '#f7d47e', '#2a2008', '#9a6a00']
};
var prefs = {};
function load() {
var p = {};
try { p = JSON.parse(localStorage.getItem(KEY) || '{}') || {}; } catch (e) {}
prefs = {};
Object.keys(DEFAULTS).forEach(function (k) { prefs[k] = p[k] === undefined ? DEFAULTS[k] : p[k]; });
}
var mq = window.matchMedia ? window.matchMedia('(prefers-color-scheme: light)') : null;
function apply() {
var html = document.documentElement;
var theme = prefs.theme === 'system' ? (mq && mq.matches ? 'light' : 'dark') : prefs.theme;
html.dataset.theme = theme;
html.dataset.density = prefs.density;
html.dataset.sidebar = prefs.sidebar;
html.dataset.motion = prefs.motion ? 'on' : 'off';
var a = ACCENTS[prefs.accent] || ACCENTS.orange;
var light = theme === 'light';
html.style.setProperty('--accent', light ? a[3] : a[0]);
html.style.setProperty('--accent-hover', light ? a[3] : a[1]);
html.style.setProperty('--accent-ink', light ? '#fff' : a[2]);
html.style.zoom = prefs.scale && prefs.scale !== 100 ? (prefs.scale / 100) : '';
}
load();
apply();
if (mq && mq.addEventListener) mq.addEventListener('change', function () { if (prefs.theme === 'system') apply(); });
window.SDVB_PREFS = {
get: function (k) { return prefs[k]; },
all: function () { return JSON.parse(JSON.stringify(prefs)); },
set: function (k, v) {
prefs[k] = v;
try { localStorage.setItem(KEY, JSON.stringify(prefs)); } catch (e) {}
apply();
},
reset: function () { try { localStorage.removeItem(KEY); } catch (e) {} load(); apply(); },
accents: Object.keys(ACCENTS),
accentColor: function (k) { return (ACCENTS[k] || ACCENTS.orange)[0]; }
};
})();
+230
View File
@@ -0,0 +1,230 @@
/* simply-dvb – HLS player (hls.js / native HLS in Safari) with automatic profile selection */
(function () {
'use strict';
var CODECS = {
'H.264': 'video/mp4; codecs="avc1.640028"',
'HEVC': ['video/mp4; codecs="hvc1.1.6.L120.90"', 'video/mp4; codecs="hvc1.1.6.L123.B0"', 'video/mp4; codecs="hev1.1.6.L120.90"', 'video/mp4; codecs="hvc1.2.4.L120.90"'],
'MPEG-2': null,
'AAC': 'audio/mp4; codecs="mp4a.40.2"',
'MP2': 'audio/mpeg',
'AC-3': 'audio/mp4; codecs="ac-3"',
'E-AC-3': 'audio/mp4; codecs="ec-3"',
'AAC-LATM': null
};
function mse() {
return window.ManagedMediaSource || window.MediaSource;
}
function supported(label) {
if (!label) return true;
var c = CODECS[label];
if (c === undefined) return true;
if (c === null) return false;
var M = mse();
if (!M || !M.isTypeSupported) return false;
var list = Array.isArray(c) ? c : [c];
for (var i = 0; i < list.length; i++) if (M.isTypeSupported(list[i])) return true;
return false;
}
function list(x) { return Array.isArray(x) ? x : (x ? [x] : []); }
/** Codec label without the language suffix, e.g. "MP2 (pol)" -> "MP2". */
function codec(label) { return String(label || '').replace(/ \(.*\)$/, ''); }
/** True when at least one of the audio tracks can be decoded (or there is no audio info). */
function audioOk(audio) {
var a = list(audio).map(codec);
return !a.length || a.some(supported);
}
/**
* Best profile for this browser: pass → aac → h264. Without ffmpeg on the server only
* "pass" is possible, so it is always tried first.
*/
function pickProfile(video, audio, transcode) {
if (transcode === false) return 'pass';
if (!supported(codec(video))) return 'h264';
if (!audioOk(audio)) return 'aac';
return 'pass';
}
function tr(x) { return window.I18N ? window.I18N.tr(x) : x; }
/** Human-readable (translated) explanation why the original stream cannot be decoded here. */
function explain(video, audio) {
var parts = [];
var v = codec(video);
if (v && !supported(v)) {
parts.push(tr(v === 'HEVC'
? 'This browser reports no HEVC (H.265) support. Chrome/Edge decode it only with hardware acceleration (on Linux: VA-API); Safari plays it natively.'
: 'This browser reports no support for ' + v + ' video.'));
}
if (!audioOk(audio)) parts.push(tr('This browser reports no support for any audio track (' + list(audio).map(codec).join(', ') + ').'));
return parts.join(' ');
}
function el(tag, cls, text) {
var e = document.createElement(tag);
if (cls) e.className = cls;
if (text != null) e.textContent = text;
return e;
}
/**
* opts: { channelId, share, token, video, audio, profile ('auto'|'pass'|'aac'|'h264'), src (full playlist URL), live, onProfile }
*/
function create(container, opts) {
container.innerHTML = '';
var video = el('video');
video.controls = true;
video.playsInline = true;
video.autoplay = true;
var overlay = el('div', 'overlay');
var badge = el('div', 'badge', opts.live === false ? 'RECORDING' : 'LIVE');
container.appendChild(video);
container.appendChild(overlay);
container.appendChild(badge);
var hls = null;
var destroyed = false;
var fallbackOrder = opts.transcode === false ? ['pass'] : ['pass', 'aac', 'h264'];
var profile = opts.profile && opts.profile !== 'auto' ? opts.profile : pickProfile(opts.video, opts.audio, opts.transcode);
var auto = !opts.profile || opts.profile === 'auto';
var retries = 0;
function status(msg, err, hint) {
overlay.innerHTML = '';
if (!msg) { overlay.classList.add('hidden'); return; }
overlay.classList.remove('hidden');
overlay.classList.toggle('err', !!err);
if (!err) overlay.appendChild(el('div', 'spinner'));
overlay.appendChild(el('div', null, msg));
if (hint) overlay.appendChild(el('div', 'hint', hint));
if (err && opts.vlcUrl) {
var a = el('a', 'btn small', '▶ Open in VLC');
a.href = opts.vlcUrl;
a.setAttribute('download', '');
overlay.appendChild(a);
}
}
/** Final failure: explain codecs and what can be done. */
function failed(msg) {
var why = explain(opts.video, opts.audio);
var hint = why;
if (opts.transcode === false) hint = (why ? why + ' ' : '') + tr('Install ffmpeg on the server to enable transcoding, or open the channel in VLC.');
status(tr('Could not play: ' + msg), true, hint);
}
function url() {
if (opts.src) return opts.src;
var q = [];
if (profile !== 'pass') q.push('profile=' + profile);
if (opts.share) q.push('share=' + encodeURIComponent(opts.share));
if (opts.token) q.push('token=' + encodeURIComponent(opts.token));
return '/hls/' + opts.channelId + '/index.m3u8' + (q.length ? '?' + q.join('&') : '');
}
function nextProfile() {
if (!auto || opts.src) return false;
var i = fallbackOrder.indexOf(profile);
if (i < 0 || i + 1 >= fallbackOrder.length) return false;
profile = fallbackOrder[i + 1];
return true;
}
function teardown() {
if (hls) { try { hls.destroy(); } catch (e) {} hls = null; }
video.removeAttribute('src');
try { video.load(); } catch (e) {}
}
function start() {
teardown();
if (destroyed) return;
if (opts.onProfile) opts.onProfile(profile);
status(opts.live === false ? 'Loading recording…' : 'Tuning and buffering…');
var src = url();
if (window.Hls && window.Hls.isSupported()) {
hls = new window.Hls({
liveSyncDurationCount: 2,
liveMaxLatencyDurationCount: 6,
manifestLoadingTimeOut: 30000,
manifestLoadingMaxRetry: 3,
levelLoadingTimeOut: 20000,
fragLoadingTimeOut: 30000,
enableWorker: true,
backBufferLength: 30
});
hls.on(window.Hls.Events.MANIFEST_PARSED, function () {
var p = video.play();
if (p && p.catch) p.catch(function () { status('Click ▶ to play', true); });
});
hls.on(window.Hls.Events.FRAG_BUFFERED, function () { status(null); retries = 0; });
hls.on(window.Hls.Events.ERROR, function (_e, data) {
if (!data.fatal) return;
var codecProblem = data.type === window.Hls.ErrorTypes.MEDIA_ERROR ||
/codec|incompatible|bufferAddCodec|addSourceBuffer/i.test(String(data.details) + ' ' + String(data.reason || ''));
if (codecProblem && nextProfile()) {
status('Browser lacks the codec – switching to the “' + profile + '” profile…');
setTimeout(start, 300);
return;
}
if (data.type === window.Hls.ErrorTypes.MEDIA_ERROR && retries < 2) {
retries++;
hls.recoverMediaError();
return;
}
if (data.type === window.Hls.ErrorTypes.NETWORK_ERROR && retries < 4) {
retries++;
status('Connection problem – retrying (' + retries + ')…');
setTimeout(start, 2000);
return;
}
var msg = (data.response && data.response.data) || data.details || 'playback error';
failed(String(msg));
});
hls.loadSource(src);
hls.attachMedia(video);
} else if (video.canPlayType('application/vnd.apple.mpegurl')) {
video.src = src;
video.addEventListener('playing', function () { status(null); }, { once: true });
video.addEventListener('error', function () {
if (nextProfile()) { start(); return; }
failed('the stream');
}, { once: true });
var p = video.play();
if (p && p.catch) p.catch(function () {});
} else {
status('This browser does not support HLS', true);
}
}
video.addEventListener('waiting', function () { if (!overlay.classList.contains('err')) status('Buffering…'); });
video.addEventListener('playing', function () { status(null); });
start();
return {
video: video,
get profile() { return profile; },
setProfile: function (p) { auto = p === 'auto'; profile = auto ? pickProfile(opts.video, opts.audio) : p; start(); },
destroy: function () { destroyed = true; teardown(); container.innerHTML = ''; }
};
}
window.SDVB = { createPlayer: create, pickProfile: pickProfile, codecSupported: supported, explain: explain };
// Public page /watch/<token>
document.addEventListener('DOMContentLoaded', function () {
if (!document.body.classList.contains('watch')) return;
var box = document.getElementById('player');
if (!box) return;
create(box, {
channelId: box.getAttribute('data-channel'),
share: box.getAttribute('data-share'),
video: box.getAttribute('data-video'),
audio: (box.getAttribute('data-audio') || '').split('|').filter(Boolean),
transcode: box.getAttribute('data-transcode') !== '0',
profile: 'auto'
});
});
})();
+1559
View File
File diff suppressed because it is too large. Load diff
+28
View File
@@ -0,0 +1,28 @@
Copyright (c) 2017 Dailymotion (http://www.dailymotion.com)
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
src/remux/mp4-generator.js and src/demux/exp-golomb.ts implementation in this project
are derived from the HLS library for video.js (https://github.com/videojs/videojs-contrib-hls)
That work is also covered by the Apache 2 License, following copyright:
Copyright (c) 2013-2015 Brightcove
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
+4
View File
@@ -0,0 +1,4 @@
!function e(t){var r,i;r=this,i=function(){"use strict";function r(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,i=Array(t);r<t;r++)i[r]=e[r];return i}function i(e,t,r,i,n,a,s){try{var o=e[a](s),l=o.value}catch(e){return void r(e)}o.done?t(l):Promise.resolve(l).then(i,n)}function n(e,t){for(var r=0;r<t.length;r++){var i=t[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,y(i.key),i)}}function a(e,t,r){return t&&n(e.prototype,t),r&&n(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function s(e,t){var i="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(i)return(i=i.call(e)).next.bind(i);if(Array.isArray(e)||(i=function(e,t){if(e){if("string"==typeof e)return r(e,t);var i={}.toString.call(e).slice(8,-1);return"Object"===i&&e.constructor&&(i=e.constructor.name),"Map"===i||"Set"===i?Array.from(e):"Arguments"===i||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(i)?r(e,t):void 0}}(e))||t){i&&(e=i);var n=0;return function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function o(e,t,r){return(t=y(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function l(){return l=Object.assign?Object.assign.bind():function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var i in r)({}).hasOwnProperty.call(r,i)&&(e[i]=r[i])}return e},l.apply(null,arguments)}function u(e){return u=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(e){return e.__proto__||Object.getPrototypeOf(e)},u(e)}function d(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,p(e,t)}function h(){try{var e=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(e){}return(h=function(){return!!e})()}function f(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(e);t&&(i=i.filter((function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable}))),r.push.apply(r,i)}return r}function c(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?f(Object(r),!0).forEach((function(t){o(e,t,r[t])})):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):f(Object(r)).forEach((function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))}))}return e}function g(e,t){if(null==e)return{};var r={};for(var i in e)if({}.hasOwnProperty.call(e,i)){if(-1!==t.indexOf(i))continue;r[i]=e[i]}return r}function v(){
/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */
var e,t,r="function"==typeof Symbol?Symbol:{},i=r.iterator||"@@iterator",n=r.toStringTag||"@@toStringTag";function a(r,i,n,a){var l=i&&i.prototype instanceof o?i:o,u=Object.create(l.prototype);return m(u,"_invoke",function(r,i,n){var a,o,l,u=0,d=n||[],h=!1,f={p:0,n:0,v:e,a:c,f:c.bind(e,4),d:function(t,r){return a=t,o=0,l=e,f.n=r,s}};function c(r,i){for(o=r,l=i,t=0;!h&&u&&!n&&t<d.length;t++){var n,a=d[t],c=f.p,g=a[2];r>3?(n=g===i)&&(l=a[(o=a[4])?5:(o=3,3)],a[4]=a[5]=e):a[0]<=c&&((n=r<2&&c<a[1])?(o=0,f.v=i,f.n=a[1]):c<g&&(n=r<3||a[0]>i||i>g)&&(a[4]=r,a[5]=i,f.n=g,o=0))}if(n||r>1)return s;throw h=!0,i}return function(n,d,g){if(u>1)throw TypeError("Generator is already running");for(h&&1===d&&c(d,g),o=d,l=g;(t=o<2?e:l)||!h;){a||(o?o<3?(o>1&&(f.n=-1),c(o,l)):f.n=l:f.v=l);try{if(u=2,a){if(o||(n="next"),t=a[n]){if(!(t=t.call(a,l)))throw TypeError("iterator result is not an object");if(!t.done)return t;l=t.value,o<2&&(o=0)}else 1===o&&(t=a.return)&&t.call(a),o<2&&(l=TypeError("The iterator does not provide a '"+n+"' method"),o=1);a=e}else if((t=(h=f.n<0)?l:r.call(i,f))!==s)break}catch(t){a=e,o=1,l=t}finally{u=1}}return{value:t,done:h}}}(r,n,a),!0),u}var s={};function o(){}function l(){}function u(){}t=Object.getPrototypeOf;var d=[][i]?t(t([][i]())):(m(t={},i,(function(){return this})),t),h=u.prototype=o.prototype=Object.create(d);function f(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,u):(e.__proto__=u,m(e,n,"GeneratorFunction")),e.prototype=Object.create(h),e}return l.prototype=u,m(h,"constructor",u),m(u,"constructor",l),l.displayName="GeneratorFunction",m(u,n,"GeneratorFunction"),m(h),m(h,n,"Generator"),m(h,i,(function(){return this})),m(h,"toString",(function(){return"[object Generator]"})),(v=function(){return{w:a,m:f}})()}function m(e,t,r,i){var n=Object.defineProperty;try{n({},"",{})}catch(e){n=0}m=function(e,t,r,i){function a(t,r){m(e,t,(function(e){return this._invoke(t,r,e)}))}t?n?n(e,t,{value:r,enumerable:!i,configurable:!i,writable:!i}):e[t]=r:(a("next",0),a("throw",1),a("return",2))},m(e,t,r,i)}function p(e,t){return p=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(e,t){return e.__proto__=t,e},p(e,t)}function y(e){var t=function(e,t){if("object"!=typeof e||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var i=r.call(e,t);if("object"!=typeof i)return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==typeof t?t:t+""}function E(e){var t="function"==typeof Map?new Map:void 0;return E=function(e){if(null===e||!function(e){try{return-1!==Function.toString.call(e).indexOf("[native code]")}catch(t){return"function"==typeof e}}(e))return e;if("function"!=typeof e)throw new TypeError("Super expression must either be null or a function");if(void 0!==t){if(t.has(e))return t.get(e);t.set(e,r)}function r(){return function(e,t,r){if(h())return Reflect.construct.apply(null,arguments);var i=[null];i.push.apply(i,t);var n=new(e.bind.apply(e,i));return r&&p(n,r.prototype),n}(e,arguments,u(this).constructor)}return r.prototype=Object.create(e.prototype,{constructor:{value:r,enumerable:!1,writable:!0,configurable:!0}}),p(r,e)},E(e)}function T(e){return e instanceof ArrayBuffer||"undefined"!=typeof SharedArrayBuffer&&e instanceof SharedArrayBuffer}var S="utf-16",A="utf-16be",I="utf-16le",L="utf-8";function R(e,t){if(e<0)return-R(-e,t);var r=Math.pow(10,t);if(Math.abs(e*r%1-.5)<Number.EPSILON){var i=Math.floor(e*r);return(i%2==0?i:i+1)/r}return Math.round(e*r)/r}function b(){try{return crypto.randomUUID()}catch(i){try{var e=URL.createObjectURL(new Blob),t=e.toString();return URL.revokeObjectURL(e),t.slice(t.lastIndexOf("/")+1)}catch(e){var r=(new Date).getTime();return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(function(e){var t=(r+16*Math.random())%16|0;return r=Math.floor(r/16),("x"==e?t:3&t|8).toString(16)}))}}}function k(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}var D,P,_={exports:{}},C=(D||(D=1,function(e){var t=Object.prototype.hasOwnProperty,r="~";function i(){}function n(e,t,r){this.fn=e,this.context=t,this.once=r||!1}function a(e,t,i,a,s){if("function"!=typeof i)throw new TypeError("The listener must be a function");var o=new n(i,a||e,s),l=r?r+t:t;return e._events[l]?e._events[l].fn?e._events[l]=[e._events[l],o]:e._events[l].push(o):(e._events[l]=o,e._eventsCount++),e}function s(e,t){0==--e._eventsCount?e._events=new i:delete e._events[t]}function o(){this._events=new i,this._eventsCount=0}Object.create&&(i.prototype=Object.create(null),(new i).__proto__||(r=!1)),o.prototype.eventNames=function(){var e,i,n=[];if(0===this._eventsCount)return n;for(i in e=this._events)t.call(e,i)&&n.push(r?i.slice(1):i);return Object.getOwnPropertySymbols?n.concat(Object.getOwnPropertySymbols(e)):n},o.prototype.listeners=function(e){var t=r?r+e:e,i=this._events[t];if(!i)return[];if(i.fn)return[i.fn];for(var n=0,a=i.length,s=new Array(a);n<a;n++)s[n]=i[n].fn;retLine truncated
//# sourceMappingURL=hls.min.js.map