Update Studio auto-dismiss to avoid synthetic clicks and add relay log charts.
Prefer location.assign for endscreen leave, and ship hub analytics/charts plus host deploy helpers. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
parent
0317349eed
commit
ff70c9f5f6
@ -5,7 +5,9 @@
|
||||
"ExtensionInstallBlocklist": [],
|
||||
"DownloadRestrictions": 0,
|
||||
"AllowFileSelectionDialogs": true,
|
||||
"URLAllowlist": ["file:///home/neko/Downloads/*"],
|
||||
"URLAllowlist": [
|
||||
"file:///home/neko/Downloads/*"
|
||||
],
|
||||
"DefaultCookiesSetting": 1,
|
||||
"RestoreOnStartup": 1,
|
||||
"AutoplayAllowed": true,
|
||||
@ -13,8 +15,14 @@
|
||||
"DefaultNotificationsSetting": 1,
|
||||
"VideoCaptureAllowed": true,
|
||||
"AudioCaptureAllowed": true,
|
||||
"VideoCaptureAllowedUrls": ["https://*.google.com/*", "https://*.youtube.com/*"],
|
||||
"AudioCaptureAllowedUrls": ["https://*.google.com/*", "https://*.youtube.com/*"],
|
||||
"VideoCaptureAllowedUrls": [
|
||||
"https://*.google.com/*",
|
||||
"https://*.youtube.com/*"
|
||||
],
|
||||
"AudioCaptureAllowedUrls": [
|
||||
"https://*.google.com/*",
|
||||
"https://*.youtube.com/*"
|
||||
],
|
||||
"DeveloperToolsAvailability": 1,
|
||||
"DefaultGeolocationSetting": 1,
|
||||
"3rdparty": {
|
||||
@ -22,7 +30,7 @@
|
||||
"dhdgffkkebhmkfjojejmpbldmpobfkfo": {
|
||||
"jsonImport": [
|
||||
{
|
||||
"hash": "1:3d96725f5c1273d7468c1d6007817449b2356c7a47f8dfd096e297ca65f348dd",
|
||||
"hash": "1:b75c2df29e515233fce1ca146ab62fff6bcbbaa20f5d5a8c16aa8f8993b77b15",
|
||||
"url": "http://127.0.0.1:18080/tampermonkey-provisioning.json",
|
||||
"haltOnError": false,
|
||||
"installAsSystemScripts": false
|
||||
|
||||
File diff suppressed because one or more lines are too long
@ -1,12 +1,11 @@
|
||||
// ==UserScript==
|
||||
// @name YouTube Studio Auto Dismiss
|
||||
// @namespace http://tampermonkey.net/
|
||||
// @version 1.1
|
||||
// @description 每5秒自动检测并点击 YouTube Studio 直播页面的 Dismiss 按钮,支持延迟加载
|
||||
// @version 2.2.0
|
||||
// @description 直播结束 endscreen 自动离开:读 a#dismiss-link 并 location.assign,避免 MouseEvent 风控
|
||||
// @author You
|
||||
// @match https://studio.youtube.com/channel/*/livestreaming
|
||||
// @match https://studio.youtube.com/video/*/livestreaming
|
||||
// @match https://studio.youtube.com/*/livestreaming
|
||||
// @match https://studio.youtube.com/*
|
||||
// @run-at document-idle
|
||||
// @license MIT
|
||||
// @grant none
|
||||
// @downloadURL https://update.greasyfork.org/scripts/557378/YouTube%20Studio%20Auto%20Dismiss.user.js
|
||||
@ -16,57 +15,217 @@
|
||||
(function () {
|
||||
"use strict";
|
||||
|
||||
function triggerClick(el) {
|
||||
if (!el) return;
|
||||
const evt = new MouseEvent("click", {
|
||||
view: window,
|
||||
bubbles: true,
|
||||
cancelable: true,
|
||||
});
|
||||
el.dispatchEvent(evt);
|
||||
console.log("Dismiss 按钮已点击:", el, "父元素:", el.parentElement);
|
||||
// 不要用 <script> 注入:Studio CSP 常会静默拦截,导致“脚本装了但不跑”。
|
||||
// @grant none 下直接跑即可操作 DOM / location。
|
||||
|
||||
if (window.__ytStudioAutoDismissV22__) return;
|
||||
window.__ytStudioAutoDismissV22__ = true;
|
||||
|
||||
const COOLDOWN_MS = 8000;
|
||||
const HUMAN_DELAY_MIN = 400;
|
||||
const HUMAN_DELAY_MAX = 1200;
|
||||
const POLL_MS = 1500;
|
||||
|
||||
let busy = false;
|
||||
let lastAt = 0;
|
||||
let lastHrefTried = "";
|
||||
|
||||
function log() {
|
||||
try {
|
||||
console.log.apply(console, ["[YT Auto Dismiss]"].concat([].slice.call(arguments)));
|
||||
} catch (_) {}
|
||||
}
|
||||
|
||||
function findDismiss(root = document) {
|
||||
const allElements = root.querySelectorAll("button");
|
||||
for (const el of allElements) {
|
||||
try {
|
||||
const text = el.innerText ? el.innerText.trim() : "";
|
||||
if (text === "Dismiss" && isElementVisible(el)) {
|
||||
console.log("找到 Dismiss 按钮:", el);
|
||||
return el;
|
||||
}
|
||||
function rand(min, max) {
|
||||
return min + Math.floor(Math.random() * (max - min + 1));
|
||||
}
|
||||
|
||||
if (el.shadowRoot) {
|
||||
const shadowBtn = findDismiss(el.shadowRoot);
|
||||
if (shadowBtn) return shadowBtn;
|
||||
}
|
||||
} catch (error) {
|
||||
console.log("检查元素时出错:", error);
|
||||
}
|
||||
function sleep(ms) {
|
||||
return new Promise(function (resolve) {
|
||||
setTimeout(resolve, ms);
|
||||
});
|
||||
}
|
||||
|
||||
function visible(el) {
|
||||
if (!el || !el.getBoundingClientRect) return false;
|
||||
var s = window.getComputedStyle(el);
|
||||
if (s.display === "none" || s.visibility === "hidden" || Number(s.opacity) === 0) return false;
|
||||
var r = el.getBoundingClientRect();
|
||||
return r.width > 1 && r.height > 1;
|
||||
}
|
||||
|
||||
function queryDeep(selector, root) {
|
||||
root = root || document;
|
||||
try {
|
||||
var hit = root.querySelector(selector);
|
||||
if (hit) return hit;
|
||||
} catch (_) {}
|
||||
var nodes = [];
|
||||
try {
|
||||
nodes = root.querySelectorAll("*");
|
||||
} catch (_) {
|
||||
return null;
|
||||
}
|
||||
for (var i = 0; i < nodes.length; i++) {
|
||||
var el = nodes[i];
|
||||
if (!el.shadowRoot) continue;
|
||||
var nested = queryDeep(selector, el.shadowRoot);
|
||||
if (nested) return nested;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
function isElementVisible(el) {
|
||||
const style = window.getComputedStyle(el);
|
||||
return style.display !== "none" && style.visibility !== "hidden" && el.offsetParent !== null;
|
||||
function findEndscreen() {
|
||||
return (
|
||||
queryDeep("ytls-stream-endscreen-renderer") ||
|
||||
(function () {
|
||||
var box = queryDeep("#endscreen-container");
|
||||
return box && box.closest ? box.closest("ytls-stream-endscreen-renderer") : null;
|
||||
})()
|
||||
);
|
||||
}
|
||||
|
||||
function checkAndClick() {
|
||||
const btn = findDismiss();
|
||||
if (btn) {
|
||||
triggerClick(btn);
|
||||
} else {
|
||||
console.log("未找到 Dismiss 按钮或按钮不可见");
|
||||
function findDismissTarget() {
|
||||
var host = findEndscreen();
|
||||
if (!host || !visible(host)) return null;
|
||||
|
||||
var link =
|
||||
host.querySelector("a#dismiss-link") ||
|
||||
host.querySelector("#dismiss-link") ||
|
||||
host.querySelector("#completion-buttons a[href]") ||
|
||||
null;
|
||||
|
||||
var btn =
|
||||
host.querySelector("#dismiss-button button") ||
|
||||
host.querySelector("ytcp-button#dismiss-button") ||
|
||||
host.querySelector("#dismiss-button") ||
|
||||
null;
|
||||
|
||||
if (!link && !btn) return null;
|
||||
if (link && !visible(link) && btn && !visible(btn)) return null;
|
||||
return { host: host, link: link, btn: btn };
|
||||
}
|
||||
|
||||
function resolveHref(link) {
|
||||
if (!link) return "";
|
||||
var raw = link.href || link.getAttribute("href") || "";
|
||||
if (!raw) return "";
|
||||
try {
|
||||
return new URL(raw, location.origin).href;
|
||||
} catch (_) {
|
||||
return raw;
|
||||
}
|
||||
}
|
||||
|
||||
if (document.readyState === "complete") {
|
||||
checkAndClick();
|
||||
} else {
|
||||
window.addEventListener("load", checkAndClick, { once: true });
|
||||
function hideEndscreen(host) {
|
||||
try {
|
||||
host.setAttribute("hidden", "");
|
||||
host.style.setProperty("display", "none", "important");
|
||||
if (host.remove) host.remove();
|
||||
return true;
|
||||
} catch (_) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
setInterval(checkAndClick, 5000);
|
||||
async function dismissOnce(reason) {
|
||||
if (busy) return false;
|
||||
if (Date.now() - lastAt < COOLDOWN_MS) return false;
|
||||
|
||||
var target = findDismissTarget();
|
||||
if (!target) return false;
|
||||
|
||||
var href = resolveHref(target.link);
|
||||
if (href && href === lastHrefTried && Date.now() - lastAt < COOLDOWN_MS) return false;
|
||||
|
||||
busy = true;
|
||||
lastAt = Date.now();
|
||||
lastHrefTried = href || lastHrefTried;
|
||||
|
||||
try {
|
||||
log(reason || "found endscreen", {
|
||||
href: href,
|
||||
path: location.pathname,
|
||||
});
|
||||
await sleep(rand(HUMAN_DELAY_MIN, HUMAN_DELAY_MAX));
|
||||
if (!findDismissTarget()) {
|
||||
log("endscreen disappeared before action");
|
||||
return false;
|
||||
}
|
||||
|
||||
// 1) 首选:按原生 <a id="dismiss-link"> 导航(无合成 click)
|
||||
if (href) {
|
||||
try {
|
||||
var url = new URL(href);
|
||||
if (url.origin === location.origin) {
|
||||
log("location.assign", url.href);
|
||||
location.assign(url.href);
|
||||
return true;
|
||||
}
|
||||
} catch (err) {
|
||||
log("assign failed", String(err));
|
||||
}
|
||||
}
|
||||
|
||||
// 2) 摘掉 endscreen
|
||||
if (hideEndscreen(target.host)) {
|
||||
await sleep(300);
|
||||
if (!findDismissTarget()) {
|
||||
log("removed endscreen node");
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
// 3) 兜底原生 click(仅限 endscreen 内按钮)
|
||||
var clickEl =
|
||||
(target.btn && target.btn.querySelector && target.btn.querySelector("button")) ||
|
||||
target.btn ||
|
||||
target.link;
|
||||
if (clickEl && clickEl.click) {
|
||||
log("native click fallback");
|
||||
HTMLElement.prototype.click.call(clickEl);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
} finally {
|
||||
busy = false;
|
||||
}
|
||||
}
|
||||
|
||||
function tick(reason) {
|
||||
dismissOnce(reason).catch(function (err) {
|
||||
log("error", String(err));
|
||||
});
|
||||
}
|
||||
|
||||
var observer = new MutationObserver(function () {
|
||||
clearTimeout(tick._t);
|
||||
tick._t = setTimeout(function () {
|
||||
tick("mutation");
|
||||
}, 200);
|
||||
});
|
||||
|
||||
try {
|
||||
observer.observe(document.documentElement, {
|
||||
childList: true,
|
||||
subtree: true,
|
||||
attributes: true,
|
||||
attributeFilter: ["style", "class", "hidden", "href"],
|
||||
});
|
||||
} catch (_) {}
|
||||
|
||||
// SPA:从 dashboard 进直播页时 userscript 不一定重跑,靠轮询兜底
|
||||
setInterval(function () {
|
||||
tick("poll");
|
||||
}, POLL_MS);
|
||||
|
||||
window.addEventListener("yt-navigate-finish", function () {
|
||||
tick("yt-navigate-finish");
|
||||
});
|
||||
window.addEventListener("popstate", function () {
|
||||
tick("popstate");
|
||||
});
|
||||
|
||||
log("installed", location.href);
|
||||
tick("boot");
|
||||
})();
|
||||
|
||||
@ -119,33 +119,44 @@ def set_youtube_pro_channels(channels: list[dict[str, Any]]) -> None:
|
||||
|
||||
|
||||
def merge_youtube_pro_channels(channels: list[dict[str, Any]]) -> list[dict[str, Any]]:
|
||||
"""Merge browser-synced channel rows without letting stale tabs clobber keys/URLs."""
|
||||
"""Merge browser-synced channel rows without letting stale tabs clobber keys/URLs.
|
||||
|
||||
Existing server order is preserved so channel cards do not reshuffle when a
|
||||
stale tab posts a differently ordered list.
|
||||
"""
|
||||
incoming = normalize_youtube_pro_channels(channels)
|
||||
existing = get_youtube_pro_channels()
|
||||
existing_by_pm2 = {channel_pm2_name(row): row for row in existing if isinstance(row, dict)}
|
||||
existing_by_id = {str(row.get("id", "")).strip(): row for row in existing if isinstance(row, dict)}
|
||||
incoming_by_pm2 = {channel_pm2_name(row): row for row in incoming if isinstance(row, dict)}
|
||||
incoming_by_id = {str(row.get("id", "")).strip(): row for row in incoming if isinstance(row, dict)}
|
||||
|
||||
merged: list[dict[str, Any]] = []
|
||||
seen_pm2: set[str] = set()
|
||||
seen_ids: set[str] = set()
|
||||
for row in incoming:
|
||||
pm2 = channel_pm2_name(row)
|
||||
cid = str(row.get("id", "")).strip()
|
||||
current = existing_by_pm2.get(pm2) or existing_by_id.get(cid)
|
||||
if current:
|
||||
next_row = {**row, **current}
|
||||
merged.append(next_row)
|
||||
else:
|
||||
merged.append(dict(row))
|
||||
seen_pm2.add(pm2)
|
||||
if cid:
|
||||
seen_ids.add(cid)
|
||||
|
||||
for row in existing:
|
||||
pm2 = channel_pm2_name(row)
|
||||
cid = str(row.get("id", "")).strip()
|
||||
if pm2 and pm2 not in seen_pm2 and cid not in seen_ids:
|
||||
remote = incoming_by_pm2.get(pm2) or incoming_by_id.get(cid)
|
||||
if remote:
|
||||
# Existing wins for overlapping fields (keeps keys/URLs from server).
|
||||
merged.append({**remote, **row})
|
||||
else:
|
||||
merged.append(dict(row))
|
||||
if pm2:
|
||||
seen_pm2.add(pm2)
|
||||
if cid:
|
||||
seen_ids.add(cid)
|
||||
|
||||
for row in incoming:
|
||||
pm2 = channel_pm2_name(row)
|
||||
cid = str(row.get("id", "")).strip()
|
||||
if (pm2 and pm2 in seen_pm2) or (cid and cid in seen_ids):
|
||||
continue
|
||||
merged.append(dict(row))
|
||||
if pm2:
|
||||
seen_pm2.add(pm2)
|
||||
if cid:
|
||||
seen_ids.add(cid)
|
||||
|
||||
merged = normalize_youtube_pro_channels(merged)
|
||||
set_youtube_pro_channels(merged)
|
||||
|
||||
@ -54,6 +54,7 @@ from src.youtube_relay_log import (
|
||||
get_relay_session,
|
||||
import_relay_sessions_for_process,
|
||||
list_relay_sessions,
|
||||
summarize_relay_sessions,
|
||||
)
|
||||
|
||||
router = APIRouter(prefix="/hub", tags=["无人直播系统"])
|
||||
@ -564,6 +565,26 @@ async def hub_youtube_relay_sessions(
|
||||
)
|
||||
|
||||
|
||||
@router.get("/youtube/relay/sessions/stats")
|
||||
async def hub_youtube_relay_sessions_stats(
|
||||
process: str = "",
|
||||
q: str = "",
|
||||
date_from: str = "",
|
||||
date_to: str = "",
|
||||
status: str = "",
|
||||
top_anchors: int = 20,
|
||||
) -> dict[str, Any]:
|
||||
return await asyncio.to_thread(
|
||||
summarize_relay_sessions,
|
||||
process=process,
|
||||
q=q,
|
||||
date_from=date_from,
|
||||
date_to=date_to,
|
||||
status=status,
|
||||
top_anchors=top_anchors,
|
||||
)
|
||||
|
||||
|
||||
@router.get("/youtube/relay/sessions/{session_id}")
|
||||
async def hub_youtube_relay_session_detail(session_id: str) -> dict[str, Any]:
|
||||
session = await asyncio.to_thread(get_relay_session, session_id)
|
||||
|
||||
@ -657,6 +657,341 @@ def list_relay_sessions(
|
||||
conn.close()
|
||||
|
||||
|
||||
def _relay_filter_clause(
|
||||
*,
|
||||
process: str = "",
|
||||
q: str = "",
|
||||
date_from: str = "",
|
||||
date_to: str = "",
|
||||
status: str = "",
|
||||
) -> tuple[str, list[Any]]:
|
||||
clauses: list[str] = []
|
||||
params: list[Any] = []
|
||||
if process:
|
||||
clauses.append("process = ?")
|
||||
params.append(_normalize_process(process))
|
||||
if status == "active":
|
||||
clauses.append("ended_at IS NULL")
|
||||
elif status == "ended":
|
||||
clauses.append("ended_at IS NOT NULL")
|
||||
if date_from:
|
||||
clauses.append("push_date >= ?")
|
||||
params.append(date_from.strip())
|
||||
if date_to:
|
||||
clauses.append("push_date <= ?")
|
||||
params.append(date_to.strip())
|
||||
if q.strip():
|
||||
like = f"%{q.strip()}%"
|
||||
clauses.append(
|
||||
"(anchor_name LIKE ? OR source_url LIKE ? OR source_room_id LIKE ? OR stream_title LIKE ? OR channel_name LIKE ?)"
|
||||
)
|
||||
params.extend([like, like, like, like, like])
|
||||
where = "WHERE " + " AND ".join(clauses) if clauses else ""
|
||||
return where, params
|
||||
|
||||
|
||||
def _session_effective_duration(row: dict[str, Any], now: float) -> float:
|
||||
started = float(row.get("started_at") or 0)
|
||||
ended = row.get("ended_at")
|
||||
stored = float(row.get("duration_seconds") or 0)
|
||||
if ended:
|
||||
return max(0.0, float(ended) - started) if started else max(0.0, stored)
|
||||
if stored > 0:
|
||||
return stored
|
||||
if started > 0:
|
||||
return max(0.0, now - started)
|
||||
return 0.0
|
||||
|
||||
|
||||
def summarize_relay_sessions(
|
||||
*,
|
||||
process: str = "",
|
||||
q: str = "",
|
||||
date_from: str = "",
|
||||
date_to: str = "",
|
||||
status: str = "",
|
||||
top_anchors: int = 20,
|
||||
db_path: Path | None = None,
|
||||
) -> dict[str, Any]:
|
||||
"""Aggregate relay sessions for charting: frequency, time-of-day, weekday, duration."""
|
||||
where, params = _relay_filter_clause(
|
||||
process=process,
|
||||
q=q,
|
||||
date_from=date_from,
|
||||
date_to=date_to,
|
||||
status=status,
|
||||
)
|
||||
now = time.time()
|
||||
conn = _connect_relay(db_path)
|
||||
try:
|
||||
rows = conn.execute(
|
||||
f"SELECT * FROM {_RELAY_SESSIONS_TABLE} {where} ORDER BY started_at ASC",
|
||||
params,
|
||||
).fetchall()
|
||||
finally:
|
||||
conn.close()
|
||||
|
||||
sessions = [_row_to_session(row) for row in rows]
|
||||
by_hour_starts = [0] * 24
|
||||
by_hour_minutes = [0.0] * 24
|
||||
by_weekday_starts = [0] * 7 # Mon=0
|
||||
by_weekday_minutes = [0.0] * 7
|
||||
heatmap_starts = [[0 for _ in range(24)] for _ in range(7)]
|
||||
heatmap_minutes = [[0.0 for _ in range(24)] for _ in range(7)]
|
||||
by_date: dict[str, dict[str, Any]] = {}
|
||||
by_anchor: dict[str, dict[str, Any]] = {}
|
||||
duration_values: list[float] = []
|
||||
duration_buckets = {
|
||||
"<15m": 0,
|
||||
"15-60m": 0,
|
||||
"1-3h": 0,
|
||||
"3-6h": 0,
|
||||
"6-12h": 0,
|
||||
">=12h": 0,
|
||||
}
|
||||
active_count = 0
|
||||
total_duration = 0.0
|
||||
|
||||
for session in sessions:
|
||||
started = float(session.get("started_at") or 0)
|
||||
if started <= 0:
|
||||
continue
|
||||
duration = _session_effective_duration(session, now)
|
||||
total_duration += duration
|
||||
duration_values.append(duration)
|
||||
if not session.get("ended_at"):
|
||||
active_count += 1
|
||||
|
||||
if duration < 15 * 60:
|
||||
duration_buckets["<15m"] += 1
|
||||
elif duration < 60 * 60:
|
||||
duration_buckets["15-60m"] += 1
|
||||
elif duration < 3 * 3600:
|
||||
duration_buckets["1-3h"] += 1
|
||||
elif duration < 6 * 3600:
|
||||
duration_buckets["3-6h"] += 1
|
||||
elif duration < 12 * 3600:
|
||||
duration_buckets["6-12h"] += 1
|
||||
else:
|
||||
duration_buckets[">=12h"] += 1
|
||||
|
||||
try:
|
||||
start_dt = datetime.fromtimestamp(started)
|
||||
except (OSError, ValueError, OverflowError):
|
||||
continue
|
||||
hour = start_dt.hour
|
||||
weekday = start_dt.weekday()
|
||||
push_date = (session.get("push_date") or start_dt.strftime("%Y-%m-%d")).strip()
|
||||
by_hour_starts[hour] += 1
|
||||
by_weekday_starts[weekday] += 1
|
||||
heatmap_starts[weekday][hour] += 1
|
||||
|
||||
# Occupancy: distribute duration across hours the session covers.
|
||||
cursor = started
|
||||
end_ts = float(session.get("ended_at") or (started + duration))
|
||||
if end_ts < cursor:
|
||||
end_ts = cursor
|
||||
guard = 0
|
||||
while cursor < end_ts and guard < 48 * 7:
|
||||
guard += 1
|
||||
try:
|
||||
cur_dt = datetime.fromtimestamp(cursor)
|
||||
except (OSError, ValueError, OverflowError):
|
||||
break
|
||||
next_hour = cur_dt.replace(minute=0, second=0, microsecond=0).timestamp() + 3600
|
||||
slice_end = min(end_ts, next_hour)
|
||||
minutes = max(0.0, (slice_end - cursor) / 60.0)
|
||||
h = cur_dt.hour
|
||||
wd = cur_dt.weekday()
|
||||
by_hour_minutes[h] += minutes
|
||||
by_weekday_minutes[wd] += minutes
|
||||
heatmap_minutes[wd][h] += minutes
|
||||
cursor = slice_end
|
||||
|
||||
day = by_date.setdefault(
|
||||
push_date,
|
||||
{"date": push_date, "sessions": 0, "duration_seconds": 0.0, "anchors": set()},
|
||||
)
|
||||
day["sessions"] += 1
|
||||
day["duration_seconds"] += duration
|
||||
anchor = (session.get("anchor_name") or "").strip() or "(unknown)"
|
||||
day["anchors"].add(anchor)
|
||||
|
||||
room = (session.get("source_room_id") or "").strip()
|
||||
url = (session.get("source_url") or "").strip()
|
||||
key = room or url or anchor
|
||||
item = by_anchor.setdefault(
|
||||
key,
|
||||
{
|
||||
"anchor_name": anchor,
|
||||
"source_room_id": room,
|
||||
"source_url": url,
|
||||
"sessions": 0,
|
||||
"duration_seconds": 0.0,
|
||||
"active_sessions": 0,
|
||||
"first_started_at": started,
|
||||
"last_started_at": started,
|
||||
"hour_counts": [0] * 24,
|
||||
"weekday_counts": [0] * 7,
|
||||
"dates": set(),
|
||||
"channels": set(),
|
||||
"processes": set(),
|
||||
"avg_gap_hours": None,
|
||||
"_starts": [],
|
||||
},
|
||||
)
|
||||
if not item["anchor_name"] or item["anchor_name"] == "(unknown)":
|
||||
item["anchor_name"] = anchor
|
||||
if room and not item["source_room_id"]:
|
||||
item["source_room_id"] = room
|
||||
if url and not item["source_url"]:
|
||||
item["source_url"] = url
|
||||
item["sessions"] += 1
|
||||
item["duration_seconds"] += duration
|
||||
if not session.get("ended_at"):
|
||||
item["active_sessions"] += 1
|
||||
item["first_started_at"] = min(float(item["first_started_at"]), started)
|
||||
item["last_started_at"] = max(float(item["last_started_at"]), started)
|
||||
item["hour_counts"][hour] += 1
|
||||
item["weekday_counts"][weekday] += 1
|
||||
item["dates"].add(push_date)
|
||||
if session.get("channel_name"):
|
||||
item["channels"].add(str(session["channel_name"]))
|
||||
if session.get("process"):
|
||||
item["processes"].add(str(session["process"]))
|
||||
item["_starts"].append(started)
|
||||
|
||||
weekday_names = ["Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"]
|
||||
weekday_names_zh = ["周一", "周二", "周三", "周四", "周五", "周六", "周日"]
|
||||
|
||||
anchors_out: list[dict[str, Any]] = []
|
||||
for item in by_anchor.values():
|
||||
starts = sorted(float(x) for x in item.pop("_starts"))
|
||||
gaps = [ (starts[i] - starts[i - 1]) / 3600.0 for i in range(1, len(starts)) ]
|
||||
peak_hour = max(range(24), key=lambda h: item["hour_counts"][h])
|
||||
peak_weekday = max(range(7), key=lambda d: item["weekday_counts"][d])
|
||||
dates = sorted(item.pop("dates"))
|
||||
sessions_n = int(item["sessions"])
|
||||
dur = float(item["duration_seconds"])
|
||||
span_days = max(1, len(dates))
|
||||
anchors_out.append(
|
||||
{
|
||||
**item,
|
||||
"channels": sorted(item.pop("channels")),
|
||||
"processes": sorted(item.pop("processes")),
|
||||
"dates_active": len(dates),
|
||||
"date_first": dates[0] if dates else "",
|
||||
"date_last": dates[-1] if dates else "",
|
||||
"avg_duration_seconds": dur / sessions_n if sessions_n else 0.0,
|
||||
"sessions_per_active_day": sessions_n / span_days if span_days else 0.0,
|
||||
"hours_total": dur / 3600.0,
|
||||
"peak_hour": peak_hour,
|
||||
"peak_weekday": peak_weekday,
|
||||
"peak_weekday_label": weekday_names_zh[peak_weekday],
|
||||
"avg_gap_hours": (sum(gaps) / len(gaps)) if gaps else None,
|
||||
"median_gap_hours": (sorted(gaps)[len(gaps) // 2] if gaps else None),
|
||||
}
|
||||
)
|
||||
anchors_out.sort(key=lambda x: (-x["sessions"], -x["duration_seconds"], x["anchor_name"]))
|
||||
top_n = max(1, min(int(top_anchors), 100))
|
||||
top_anchors_list = anchors_out[:top_n]
|
||||
|
||||
dates_out = []
|
||||
for date_key in sorted(by_date.keys()):
|
||||
day = by_date[date_key]
|
||||
dates_out.append(
|
||||
{
|
||||
"date": date_key,
|
||||
"sessions": int(day["sessions"]),
|
||||
"duration_seconds": float(day["duration_seconds"]),
|
||||
"hours": float(day["duration_seconds"]) / 3600.0,
|
||||
"unique_anchors": len(day["anchors"]),
|
||||
}
|
||||
)
|
||||
|
||||
duration_values.sort()
|
||||
median_duration = (
|
||||
duration_values[len(duration_values) // 2] if duration_values else 0.0
|
||||
)
|
||||
insights: list[dict[str, str]] = []
|
||||
if sessions:
|
||||
busiest_hour = max(range(24), key=lambda h: by_hour_starts[h])
|
||||
busiest_day = max(range(7), key=lambda d: by_weekday_starts[d])
|
||||
top = top_anchors_list[0] if top_anchors_list else None
|
||||
insights.append(
|
||||
{
|
||||
"zh": f"共 {len(sessions)} 场推流,累计 {total_duration / 3600.0:.1f} 小时,覆盖 {len(by_anchor)} 位主播。",
|
||||
"en": f"{len(sessions)} sessions, {total_duration / 3600.0:.1f}h total, {len(by_anchor)} anchors.",
|
||||
}
|
||||
)
|
||||
insights.append(
|
||||
{
|
||||
"zh": f"最常开播时段:{busiest_hour:02d}:00–{busiest_hour:02d}:59;最常开播星期:{weekday_names_zh[busiest_day]}。",
|
||||
"en": f"Peak start hour: {busiest_hour:02d}:00; peak weekday: {weekday_names[busiest_day]}.",
|
||||
}
|
||||
)
|
||||
if top:
|
||||
insights.append(
|
||||
{
|
||||
"zh": (
|
||||
f"最高频主播「{top['anchor_name']}」:{top['sessions']} 场 / "
|
||||
f"{top['hours_total']:.1f}h,峰值 {top['peak_hour']:02d}:00({top['peak_weekday_label']}),"
|
||||
f"活跃 {top['dates_active']} 天。"
|
||||
),
|
||||
"en": (
|
||||
f"Top anchor «{top['anchor_name']}»: {top['sessions']} sessions / "
|
||||
f"{top['hours_total']:.1f}h, peaks {top['peak_hour']:02d}:00 "
|
||||
f"({weekday_names[top['peak_weekday']]}), {top['dates_active']} active days."
|
||||
),
|
||||
}
|
||||
)
|
||||
if active_count:
|
||||
insights.append(
|
||||
{
|
||||
"zh": f"当前仍有 {active_count} 路进行中。",
|
||||
"en": f"{active_count} session(s) still active.",
|
||||
}
|
||||
)
|
||||
|
||||
return {
|
||||
"overview": {
|
||||
"sessions": len(sessions),
|
||||
"unique_anchors": len(by_anchor),
|
||||
"active_sessions": active_count,
|
||||
"total_duration_seconds": total_duration,
|
||||
"total_hours": total_duration / 3600.0,
|
||||
"avg_duration_seconds": (total_duration / len(sessions)) if sessions else 0.0,
|
||||
"median_duration_seconds": median_duration,
|
||||
"date_from": dates_out[0]["date"] if dates_out else date_from,
|
||||
"date_to": dates_out[-1]["date"] if dates_out else date_to,
|
||||
"days_span": len(dates_out),
|
||||
},
|
||||
"by_anchor": anchors_out,
|
||||
"top_anchors": top_anchors_list,
|
||||
"by_hour": {
|
||||
"starts": by_hour_starts,
|
||||
"minutes": [round(x, 2) for x in by_hour_minutes],
|
||||
"labels": [f"{h:02d}:00" for h in range(24)],
|
||||
},
|
||||
"by_weekday": {
|
||||
"starts": by_weekday_starts,
|
||||
"minutes": [round(x, 2) for x in by_weekday_minutes],
|
||||
"labels": weekday_names,
|
||||
"labels_zh": weekday_names_zh,
|
||||
},
|
||||
"heatmap": {
|
||||
"starts": heatmap_starts,
|
||||
"minutes": [[round(v, 2) for v in row] for row in heatmap_minutes],
|
||||
"weekday_labels": weekday_names,
|
||||
"weekday_labels_zh": weekday_names_zh,
|
||||
"hour_labels": [f"{h:02d}" for h in range(24)],
|
||||
},
|
||||
"by_date": dates_out,
|
||||
"duration_buckets": duration_buckets,
|
||||
"insights": insights,
|
||||
}
|
||||
|
||||
|
||||
def get_relay_session(session_id: int | str, *, db_path: Path | None = None) -> dict[str, Any]:
|
||||
conn = _connect_relay(db_path)
|
||||
try:
|
||||
|
||||
@ -92,6 +92,30 @@ class HubKvStoreTests(unittest.TestCase):
|
||||
|
||||
self.assertEqual([row["pm2Name"] for row in rows], ["youtube2__lane1", "youtube2__lane2"])
|
||||
|
||||
def test_youtube_pro_channel_merge_preserves_existing_order(self) -> None:
|
||||
with tempfile.TemporaryDirectory() as tmp:
|
||||
with patch.object(hub_kv_store, "CONFIG_DIR", Path(tmp) / "config"):
|
||||
hub_kv_store.set_youtube_pro_channels(
|
||||
[
|
||||
{"id": "lane1", "name": "Lane 1", "pm2Name": "youtube2__lane1"},
|
||||
{"id": "lane2", "name": "Lane 2", "pm2Name": "youtube2__lane2"},
|
||||
{"id": "lane3", "name": "Lane 3", "pm2Name": "youtube2__lane3"},
|
||||
]
|
||||
)
|
||||
|
||||
rows = hub_kv_store.merge_youtube_pro_channels(
|
||||
[
|
||||
{"id": "lane3", "name": "Lane 3", "pm2Name": "youtube2__lane3"},
|
||||
{"id": "lane1", "name": "Lane 1", "pm2Name": "youtube2__lane1"},
|
||||
{"id": "lane4", "name": "Lane 4", "pm2Name": "youtube2__lane4"},
|
||||
]
|
||||
)
|
||||
|
||||
self.assertEqual(
|
||||
[row["id"] for row in rows],
|
||||
["lane1", "lane2", "lane3", "lane4"],
|
||||
)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
|
||||
@ -400,6 +400,12 @@ class NekoConfigTests(unittest.TestCase):
|
||||
self.assertEqual(payload["scripts"][0]["options"], {})
|
||||
decoded_source = base64.b64decode(payload["scripts"][0]["source"]).decode("utf-8")
|
||||
self.assertEqual(decoded_source, userscript_path.read_text(encoding="utf-8"))
|
||||
# Avoid YouTube Live risk-control: no synthetic MouseEvent clicks.
|
||||
self.assertIn("// @version 2.2.0", decoded_source)
|
||||
self.assertIn("location.assign", decoded_source)
|
||||
self.assertIn("a#dismiss-link", decoded_source)
|
||||
self.assertNotIn("new MouseEvent", decoded_source)
|
||||
self.assertNotIn("dispatchEvent(evt)", decoded_source)
|
||||
|
||||
spec = importlib.util.spec_from_file_location(
|
||||
"render_tampermonkey_provisioning",
|
||||
|
||||
@ -11,6 +11,7 @@ from src.youtube_relay_log import (
|
||||
list_relay_sessions,
|
||||
on_relay_push_start,
|
||||
start_relay_session,
|
||||
summarize_relay_sessions,
|
||||
sync_relay_from_recent_log,
|
||||
)
|
||||
|
||||
@ -180,6 +181,73 @@ class YoutubeRelayLogTests(unittest.TestCase):
|
||||
active = list_relay_sessions(process="youtube", status="active", db_path=db)
|
||||
self.assertEqual(active["total"], 0)
|
||||
|
||||
def test_summarize_relay_sessions_by_anchor_and_hour(self) -> None:
|
||||
with tempfile.TemporaryDirectory() as td:
|
||||
db = Path(td) / "hub_state.sqlite"
|
||||
start_relay_session(
|
||||
process="youtube",
|
||||
anchor_name="又系_柠檬茶",
|
||||
source_url="https://live.douyin.com/111",
|
||||
source_room_id="111",
|
||||
stream_title="又系_柠檬茶_2026-08-01_10-00-00",
|
||||
db_path=db,
|
||||
)
|
||||
end_relay_session("youtube", reason="done", db_path=db)
|
||||
start_relay_session(
|
||||
process="youtube",
|
||||
anchor_name="又系_柠檬茶",
|
||||
source_url="https://live.douyin.com/111",
|
||||
source_room_id="111",
|
||||
stream_title="又系_柠檬茶_2026-08-02_22-00-00",
|
||||
db_path=db,
|
||||
)
|
||||
end_relay_session("youtube", reason="done", db_path=db)
|
||||
start_relay_session(
|
||||
process="youtube",
|
||||
anchor_name="樱桃炒饭",
|
||||
source_url="https://live.douyin.com/222",
|
||||
source_room_id="222",
|
||||
stream_title="樱桃炒饭_2026-08-03_15-00-00",
|
||||
db_path=db,
|
||||
)
|
||||
end_relay_session("youtube", reason="done", db_path=db)
|
||||
|
||||
# Force deterministic start hours for heatmap assertions.
|
||||
from src.youtube_live_store import _connect
|
||||
|
||||
conn = _connect(db)
|
||||
rows = conn.execute(
|
||||
"SELECT id, stream_title FROM youtube_relay_sessions ORDER BY id"
|
||||
).fetchall()
|
||||
for row in rows:
|
||||
title = row["stream_title"]
|
||||
stamp = title.rsplit("_", 2)
|
||||
# title like name_YYYY-MM-DD_HH-MM-SS
|
||||
day = stamp[-2]
|
||||
hms = stamp[-1]
|
||||
ts = f"{day} {hms.replace('-', ':')}"
|
||||
from datetime import datetime
|
||||
|
||||
started = datetime.strptime(ts, "%Y-%m-%d %H:%M:%S").timestamp()
|
||||
conn.execute(
|
||||
"UPDATE youtube_relay_sessions SET started_at=?, ended_at=?, duration_seconds=?, push_date=? WHERE id=?",
|
||||
(started, started + 3600, 3600, day, row["id"]),
|
||||
)
|
||||
conn.commit()
|
||||
conn.close()
|
||||
|
||||
summary = summarize_relay_sessions(process="youtube", db_path=db)
|
||||
self.assertEqual(summary["overview"]["sessions"], 3)
|
||||
self.assertEqual(summary["overview"]["unique_anchors"], 2)
|
||||
self.assertAlmostEqual(summary["overview"]["total_hours"], 3.0, places=2)
|
||||
top = summary["top_anchors"][0]
|
||||
self.assertEqual(top["anchor_name"], "又系_柠檬茶")
|
||||
self.assertEqual(top["sessions"], 2)
|
||||
self.assertEqual(summary["by_hour"]["starts"][10], 1)
|
||||
self.assertEqual(summary["by_hour"]["starts"][22], 1)
|
||||
self.assertEqual(summary["by_hour"]["starts"][15], 1)
|
||||
self.assertTrue(summary["insights"])
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
|
||||
95
d2ypp2/tools/deploy_neko_hardening_host08.py
Normal file
95
d2ypp2/tools/deploy_neko_hardening_host08.py
Normal file
@ -0,0 +1,95 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Deploy neko hardening scripts to 10.88.0.8 and smoke-check reconfigure."""
|
||||
from __future__ import annotations
|
||||
|
||||
import sys
|
||||
import time
|
||||
from pathlib import Path
|
||||
|
||||
import paramiko
|
||||
|
||||
sys.stdout.reconfigure(encoding="utf-8", errors="replace")
|
||||
|
||||
HOST, USER, PASS = "10.88.0.8", "eric", "4669805"
|
||||
REMOTE_BASE = "/opt/live/d2ypp"
|
||||
ROOT = Path(__file__).resolve().parent.parent
|
||||
FILES = [
|
||||
"src/neko_webrtc_ports.py",
|
||||
"tools/render_neko_compose.py",
|
||||
"scripts/linux/service_ctl.sh",
|
||||
"scripts/linux/lib/common.sh",
|
||||
"scripts/linux/neko_ip_watch.sh",
|
||||
"config/system-stack.env.example",
|
||||
"live-platform/config/defaults/services/neko.json",
|
||||
"tests/test_neko_webrtc_ports.py",
|
||||
]
|
||||
|
||||
|
||||
def run(c: paramiko.SSHClient, cmd: str, timeout: int = 120) -> str:
|
||||
_, o, e = c.exec_command(cmd, timeout=timeout, get_pty=True)
|
||||
return (o.read() + e.read()).decode("utf-8", "replace")
|
||||
|
||||
|
||||
def sudo(c: paramiko.SSHClient, cmd: str, timeout: int = 300) -> str:
|
||||
return run(c, f"echo {PASS!r} | sudo -S -p '' bash -lc {cmd!r}", timeout=timeout)
|
||||
|
||||
|
||||
def main() -> int:
|
||||
c = paramiko.SSHClient()
|
||||
c.set_missing_host_key_policy(paramiko.AutoAddPolicy())
|
||||
c.connect(HOST, username=USER, password=PASS, timeout=20)
|
||||
sftp = c.open_sftp()
|
||||
stamp = int(time.time())
|
||||
for rel in FILES:
|
||||
local = ROOT / rel
|
||||
if not local.exists():
|
||||
print("MISSING", rel)
|
||||
continue
|
||||
remote_tmp = f"/tmp/{Path(rel).name}.{stamp}"
|
||||
sftp.put(str(local), remote_tmp)
|
||||
remote = f"{REMOTE_BASE}/{rel}"
|
||||
sudo(c, f"mkdir -p $(dirname {remote}) && cp {remote_tmp} {remote} && chmod +x {remote} || chmod 644 {remote}")
|
||||
# Ensure LF on shell/python text after Windows SFTP
|
||||
sudo(c, f"sed -i 's/\\r$//' {remote}")
|
||||
print("uploaded", rel)
|
||||
sftp.close()
|
||||
|
||||
print("=== unit smoke on host ===")
|
||||
print(
|
||||
run(
|
||||
c,
|
||||
f"cd {REMOTE_BASE} && NEKO_SKIP_UDP_PORT_PROBE=1 python3 -m unittest tests.test_neko_webrtc_ports -v 2>&1 | tail -30",
|
||||
timeout=60,
|
||||
)
|
||||
)
|
||||
|
||||
print("=== neko reconfigure (uses autofix) ===")
|
||||
# Don't force recreate if already healthy — just re-render and verify status.
|
||||
# Use reconfigure only if we want to apply script path; containers already good.
|
||||
out = sudo(
|
||||
c,
|
||||
f"bash {REMOTE_BASE}/scripts/linux/service_ctl.sh neko status | head -20; "
|
||||
f"python3 {REMOTE_BASE}/tools/render_neko_compose.py --count 2 "
|
||||
f"--output {REMOTE_BASE}/services/neko/docker-compose.generated.yml "
|
||||
f"--stack-env {REMOTE_BASE}/config/system-stack.env 2>&1 | tail -20; "
|
||||
f"grep -E 'NEKO_WEBRTC_UDP_RANGE_1=|NEKO_WEBRTC_EPR_1=' {REMOTE_BASE}/config/system-stack.env; "
|
||||
f"grep -E '52000-|52101-' {REMOTE_BASE}/services/neko/docker-compose.generated.yml | head -10",
|
||||
timeout=120,
|
||||
)
|
||||
print(out[:5000])
|
||||
|
||||
print("=== health ===")
|
||||
print(
|
||||
run(
|
||||
c,
|
||||
"docker ps --format 'table {{.Names}}\t{{.Status}}' | grep neko; "
|
||||
"printf '9200='; curl -sS -m 5 -o /dev/null -w '%{http_code}' http://127.0.0.1:9200/; echo; "
|
||||
"printf '9201='; curl -sS -m 5 -o /dev/null -w '%{http_code}' http://127.0.0.1:9201/; echo",
|
||||
)
|
||||
)
|
||||
c.close()
|
||||
return 0
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
raise SystemExit(main())
|
||||
121
d2ypp2/tools/deploy_relay_log_analytics_host08.py
Normal file
121
d2ypp2/tools/deploy_relay_log_analytics_host08.py
Normal file
@ -0,0 +1,121 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Deploy relay-log analytics UI + API to 10.88.0.8 and restart live-console."""
|
||||
from __future__ import annotations
|
||||
|
||||
import io
|
||||
import posixpath
|
||||
import sys
|
||||
import time
|
||||
from pathlib import Path
|
||||
|
||||
import paramiko
|
||||
|
||||
sys.stdout.reconfigure(encoding="utf-8", errors="replace")
|
||||
|
||||
HOST, USER, PASS = "10.88.0.8", "eric", "4669805"
|
||||
REMOTE_BASE = "/opt/live/d2ypp"
|
||||
REPO = Path(__file__).resolve().parent.parent
|
||||
|
||||
FILES = [
|
||||
"src/youtube_relay_log.py",
|
||||
"src/hub_routes.py",
|
||||
"web.py",
|
||||
"web-console/app/youtube-relay-log/page.tsx",
|
||||
"web-console/components/live-product/LiveYoutubeRelayLogView.tsx",
|
||||
"web-console/components/live-product/LiveYoutubeRelayLogCharts.tsx",
|
||||
"tests/test_youtube_relay_log.py",
|
||||
]
|
||||
|
||||
|
||||
def collect_files() -> list[str]:
|
||||
files = list(FILES)
|
||||
out_dir = REPO / "web-console" / "out"
|
||||
for path in out_dir.rglob("*"):
|
||||
if path.is_file():
|
||||
files.append(str(path.relative_to(REPO)).replace("\\", "/"))
|
||||
return sorted(set(files))
|
||||
|
||||
|
||||
def mkdir_p(sftp: paramiko.SFTPClient, remote_dir: str) -> None:
|
||||
remote_dir = remote_dir.rstrip("/")
|
||||
if not remote_dir or remote_dir == "/":
|
||||
return
|
||||
cur = ""
|
||||
for part in [p for p in remote_dir.split("/") if p]:
|
||||
cur = f"{cur}/{part}" if cur else f"/{part}"
|
||||
try:
|
||||
sftp.stat(cur)
|
||||
except OSError:
|
||||
try:
|
||||
sftp.mkdir(cur)
|
||||
except OSError:
|
||||
pass
|
||||
|
||||
|
||||
def put(sftp: paramiko.SFTPClient, local: Path, remote: str) -> None:
|
||||
mkdir_p(sftp, posixpath.dirname(remote))
|
||||
if local.suffix.lower() in {".py", ".sh", ".tsx", ".ts", ".mjs", ".json", ".css", ".html", ".txt", ".js"}:
|
||||
data = local.read_bytes().replace(b"\r\n", b"\n").replace(b"\r", b"\n")
|
||||
sftp.putfo(io.BytesIO(data), remote)
|
||||
else:
|
||||
sftp.put(str(local), remote)
|
||||
|
||||
|
||||
def run(client: paramiko.SSHClient, cmd: str, timeout: int = 180) -> tuple[int, str]:
|
||||
_, stdout, stderr = client.exec_command(
|
||||
"export LC_ALL=C.UTF-8 LANG=C.UTF-8; " + cmd,
|
||||
timeout=timeout,
|
||||
get_pty=True,
|
||||
)
|
||||
out = (stdout.read() + stderr.read()).decode("utf-8", "replace")
|
||||
return stdout.channel.recv_exit_status(), out
|
||||
|
||||
|
||||
def main() -> int:
|
||||
files = collect_files()
|
||||
client = paramiko.SSHClient()
|
||||
client.set_missing_host_key_policy(paramiko.AutoAddPolicy())
|
||||
client.connect(HOST, username=USER, password=PASS, timeout=20)
|
||||
sftp = client.open_sftp()
|
||||
print(f"Uploading {len(files)} files to {REMOTE_BASE} ...")
|
||||
for idx, rel in enumerate(files, start=1):
|
||||
local = REPO / rel
|
||||
if not local.is_file():
|
||||
print(f"SKIP missing: {rel}")
|
||||
continue
|
||||
put(sftp, local, f"{REMOTE_BASE}/{rel}")
|
||||
if idx <= 8 or idx == len(files) or idx % 50 == 0:
|
||||
print(f" {idx}/{len(files)} {rel}")
|
||||
sftp.close()
|
||||
|
||||
steps = [
|
||||
f"rm -rf {REMOTE_BASE}/src/__pycache__ 2>/dev/null; echo cache_cleared",
|
||||
(
|
||||
f"cd {REMOTE_BASE} && python3 -m py_compile src/youtube_relay_log.py web.py src/hub_routes.py "
|
||||
f"&& python3 -m unittest tests.test_youtube_relay_log.YoutubeRelayLogTests.test_summarize_relay_sessions_by_anchor_and_hour -v "
|
||||
f"2>&1 | tail -20"
|
||||
),
|
||||
f"echo {PASS!r} | sudo -S -p '' systemctl restart live-console.service; echo restarted",
|
||||
"sleep 8",
|
||||
"for i in 1 2 3 4 5 6 7 8 9 10 11 12; do "
|
||||
"curl -sf -m 4 http://127.0.0.1:8001/health >/dev/null 2>&1 && echo health_ok && break; "
|
||||
"sleep 3; done",
|
||||
"curl -sS -m 8 -o /dev/null -w 'relay_log_page=%{http_code}\\n' http://127.0.0.1:8001/youtube-relay-log",
|
||||
"curl -sS -m 12 'http://127.0.0.1:8001/hub/youtube/relay/sessions/stats?process=youtube&top_anchors=5' | head -c 1200; echo",
|
||||
(
|
||||
"curl -sS -m 20 -X POST 'http://127.0.0.1:8001/hub/youtube/relay/sessions/import-log' "
|
||||
"-H 'Content-Type: application/json' "
|
||||
"-d '{\"process\":\"youtube\",\"replace_imported\":true}' | head -c 400; echo"
|
||||
),
|
||||
"curl -sS -m 12 'http://127.0.0.1:8001/hub/youtube/relay/sessions/stats?process=youtube&top_anchors=5' | head -c 1500; echo",
|
||||
"systemctl is-active live-console.service; journalctl -u live-console.service -n 12 --no-pager",
|
||||
]
|
||||
for step in steps:
|
||||
code, out = run(client, step, timeout=240)
|
||||
print(f"\n--- exit={code} ---\n{out.strip()[:2000]}")
|
||||
client.close()
|
||||
return 0
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
raise SystemExit(main())
|
||||
79
d2ypp2/tools/redeploy_relay_charts_host08.py
Normal file
79
d2ypp2/tools/redeploy_relay_charts_host08.py
Normal file
@ -0,0 +1,79 @@
|
||||
#!/usr/bin/env python3
|
||||
import io
|
||||
import posixpath
|
||||
import sys
|
||||
import time
|
||||
from pathlib import Path
|
||||
|
||||
import paramiko
|
||||
|
||||
sys.stdout.reconfigure(encoding="utf-8", errors="replace")
|
||||
HOST, USER, PASS = "10.88.0.8", "eric", "4669805"
|
||||
REMOTE = "/opt/live/d2ypp"
|
||||
REPO = Path(__file__).resolve().parent.parent
|
||||
|
||||
|
||||
def main() -> int:
|
||||
files = [
|
||||
"web-console/components/live-product/LiveYoutubeRelayLogView.tsx",
|
||||
"web-console/components/live-product/LiveYoutubeRelayLogCharts.tsx",
|
||||
"src/youtube_relay_log.py",
|
||||
"src/hub_routes.py",
|
||||
"web.py",
|
||||
]
|
||||
out = REPO / "web-console" / "out"
|
||||
for p in out.rglob("*"):
|
||||
if p.is_file():
|
||||
files.append(str(p.relative_to(REPO)).replace("\\", "/"))
|
||||
files = sorted(set(files))
|
||||
|
||||
c = paramiko.SSHClient()
|
||||
c.set_missing_host_key_policy(paramiko.AutoAddPolicy())
|
||||
c.connect(HOST, username=USER, password=PASS, timeout=20)
|
||||
sftp = c.open_sftp()
|
||||
|
||||
def mkdir_p(d: str) -> None:
|
||||
d = d.rstrip("/")
|
||||
cur = ""
|
||||
for part in [x for x in d.split("/") if x]:
|
||||
cur = f"{cur}/{part}" if cur else f"/{part}"
|
||||
try:
|
||||
sftp.stat(cur)
|
||||
except OSError:
|
||||
try:
|
||||
sftp.mkdir(cur)
|
||||
except OSError:
|
||||
pass
|
||||
|
||||
for rel in files:
|
||||
local = REPO / rel
|
||||
if not local.is_file():
|
||||
continue
|
||||
remote = f"{REMOTE}/{rel}"
|
||||
mkdir_p(posixpath.dirname(remote))
|
||||
data = local.read_bytes().replace(b"\r\n", b"\n").replace(b"\r", b"\n")
|
||||
sftp.putfo(io.BytesIO(data), remote)
|
||||
sftp.close()
|
||||
print(f"uploaded {len(files)}")
|
||||
|
||||
def run(cmd: str, timeout: int = 120) -> str:
|
||||
_, o, e = c.exec_command(cmd, timeout=timeout, get_pty=True)
|
||||
return (o.read() + e.read()).decode("utf-8", "replace")
|
||||
|
||||
print(run(f"echo {PASS!r} | sudo -S -p '' systemctl restart live-console.service"))
|
||||
time.sleep(9)
|
||||
print(run("curl -sf -m 5 http://127.0.0.1:8001/health; echo"))
|
||||
print(run("curl -sS -m 8 -o /dev/null -w 'page=%{http_code}\\n' http://127.0.0.1:8001/youtube-relay-log"))
|
||||
print(
|
||||
run(
|
||||
"curl -sS -m 10 'http://127.0.0.1:8001/hub/youtube/relay/sessions/stats?top_anchors=5' "
|
||||
"| python3 -c \"import sys,json; d=json.load(sys.stdin); print(d['overview']); "
|
||||
"print([(a['anchor_name'], a['sessions'], round(a['hours_total'],1)) for a in d['top_anchors']])\""
|
||||
)
|
||||
)
|
||||
c.close()
|
||||
return 0
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
raise SystemExit(main())
|
||||
125
d2ypp2/tools/youtube_studio_dismiss_uia.ps1
Normal file
125
d2ypp2/tools/youtube_studio_dismiss_uia.ps1
Normal file
@ -0,0 +1,125 @@
|
||||
# YouTube Studio Auto-Dismiss via Windows UI Automation (trusted OS mouse click).
|
||||
# Use this instead of Tampermonkey synthetic MouseEvent clicks (isTrusted=false triggers player "Something went wrong").
|
||||
#
|
||||
# Usage:
|
||||
# powershell -ExecutionPolicy Bypass -File tools/youtube_studio_dismiss_uia.ps1
|
||||
# powershell -ExecutionPolicy Bypass -File tools/youtube_studio_dismiss_uia.ps1 -Once
|
||||
# powershell -ExecutionPolicy Bypass -File tools/youtube_studio_dismiss_uia.ps1 -PollSeconds 2
|
||||
|
||||
param(
|
||||
[double]$PollSeconds = 1.5,
|
||||
[switch]$Once,
|
||||
[int]$MaxClicks = 0
|
||||
)
|
||||
|
||||
$ErrorActionPreference = "Stop"
|
||||
Add-Type -AssemblyName UIAutomationClient
|
||||
Add-Type -AssemblyName UIAutomationTypes
|
||||
|
||||
Add-Type @"
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
public static class YtDismissMouse {
|
||||
[DllImport("user32.dll")] public static extern bool SetCursorPos(int X, int Y);
|
||||
[DllImport("user32.dll")] public static extern void mouse_event(uint dwFlags, uint dx, uint dy, uint dwData, UIntPtr dwExtraInfo);
|
||||
[DllImport("user32.dll")] public static extern bool SetForegroundWindow(IntPtr hWnd);
|
||||
public const uint LEFTDOWN = 0x0002;
|
||||
public const uint LEFTUP = 0x0004;
|
||||
public static void Click(int x, int y) {
|
||||
SetCursorPos(x, y);
|
||||
System.Threading.Thread.Sleep(60 + (new Random().Next(0, 80)));
|
||||
mouse_event(LEFTDOWN, 0, 0, 0, UIntPtr.Zero);
|
||||
System.Threading.Thread.Sleep(35 + (new Random().Next(0, 40)));
|
||||
mouse_event(LEFTUP, 0, 0, 0, UIntPtr.Zero);
|
||||
}
|
||||
}
|
||||
"@
|
||||
|
||||
function Get-StudioWindow {
|
||||
$root = [System.Windows.Automation.AutomationElement]::RootElement
|
||||
$winCond = New-Object System.Windows.Automation.PropertyCondition(
|
||||
[System.Windows.Automation.AutomationElement]::ControlTypeProperty,
|
||||
[System.Windows.Automation.ControlType]::Window
|
||||
)
|
||||
$wins = $root.FindAll([System.Windows.Automation.TreeScope]::Children, $winCond)
|
||||
foreach ($w in $wins) {
|
||||
$name = $w.Current.Name
|
||||
if ($name -match 'YouTube Studio') { return $w }
|
||||
}
|
||||
foreach ($w in $wins) {
|
||||
if ($w.Current.Name -notmatch 'Google Chrome') { continue }
|
||||
$c = New-Object System.Windows.Automation.PropertyCondition(
|
||||
[System.Windows.Automation.AutomationElement]::NameProperty, 'Dismiss'
|
||||
)
|
||||
if ($w.FindFirst([System.Windows.Automation.TreeScope]::Descendants, $c)) { return $w }
|
||||
}
|
||||
return $null
|
||||
}
|
||||
|
||||
function Find-DismissButton([System.Windows.Automation.AutomationElement]$win) {
|
||||
$and = New-Object System.Windows.Automation.AndCondition(
|
||||
(New-Object System.Windows.Automation.PropertyCondition(
|
||||
[System.Windows.Automation.AutomationElement]::NameProperty, 'Dismiss')),
|
||||
(New-Object System.Windows.Automation.PropertyCondition(
|
||||
[System.Windows.Automation.AutomationElement]::ControlTypeProperty,
|
||||
[System.Windows.Automation.ControlType]::Button))
|
||||
)
|
||||
return $win.FindFirst([System.Windows.Automation.TreeScope]::Descendants, $and)
|
||||
}
|
||||
|
||||
function Has-RiskOverlay([System.Windows.Automation.AutomationElement]$win) {
|
||||
foreach ($name in @('Something went wrong', 'Try again')) {
|
||||
$c = New-Object System.Windows.Automation.PropertyCondition(
|
||||
[System.Windows.Automation.AutomationElement]::NameProperty, $name
|
||||
)
|
||||
if ($win.FindFirst([System.Windows.Automation.TreeScope]::Descendants, $c)) { return $true }
|
||||
}
|
||||
return $false
|
||||
}
|
||||
|
||||
function Click-DismissTrusted([System.Windows.Automation.AutomationElement]$btn) {
|
||||
$r = $btn.Current.BoundingRectangle
|
||||
if ($r.Width -le 0 -or $r.Height -le 0) { return $false }
|
||||
$jitterX = Get-Random -Minimum -3 -Maximum 4
|
||||
$jitterY = Get-Random -Minimum -2 -Maximum 3
|
||||
$x = [int]($r.X + ($r.Width / 2) + $jitterX)
|
||||
$y = [int]($r.Y + ($r.Height / 2) + $jitterY)
|
||||
Write-Host ("[{0}] Trusted mouse click Dismiss at ({1},{2}) class={3}" -f (Get-Date -Format 'HH:mm:ss'), $x, $y, $btn.Current.ClassName)
|
||||
[YtDismissMouse]::Click($x, $y)
|
||||
return $true
|
||||
}
|
||||
|
||||
Write-Host "YouTube Studio Dismiss UIA watcher started (trusted OS clicks)."
|
||||
Write-Host "Keep Studio livestream tab open. Ctrl+C to stop."
|
||||
$clicks = 0
|
||||
|
||||
while ($true) {
|
||||
try {
|
||||
$win = Get-StudioWindow
|
||||
if ($win) {
|
||||
if (Has-RiskOverlay $win) {
|
||||
Write-Host ("[{0}] Risk overlay detected (Something went wrong / Try again)." -f (Get-Date -Format 'HH:mm:ss'))
|
||||
}
|
||||
$btn = Find-DismissButton $win
|
||||
if ($btn -and $btn.Current.IsEnabled -and -not $btn.Current.IsOffscreen) {
|
||||
Start-Sleep -Milliseconds (Get-Random -Minimum 400 -Maximum 1200)
|
||||
if (Click-DismissTrusted $btn) {
|
||||
$clicks++
|
||||
Start-Sleep -Seconds 2
|
||||
$win2 = Get-StudioWindow
|
||||
if ($win2 -and (Has-RiskOverlay $win2)) {
|
||||
Write-Host "WARNING: risk overlay appeared after trusted click."
|
||||
} elseif ($win2 -and -not (Find-DismissButton $win2)) {
|
||||
Write-Host ("[{0}] Dismiss cleared OK." -f (Get-Date -Format 'HH:mm:ss'))
|
||||
}
|
||||
if ($Once) { break }
|
||||
if ($MaxClicks -gt 0 -and $clicks -ge $MaxClicks) { break }
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch {
|
||||
Write-Host ("[{0}] watch error: {1}" -f (Get-Date -Format 'HH:mm:ss'), $_.Exception.Message)
|
||||
}
|
||||
if ($Once) { break }
|
||||
Start-Sleep -Seconds $PollSeconds
|
||||
}
|
||||
@ -0,0 +1,384 @@
|
||||
"use client";
|
||||
|
||||
import { useEffect, useMemo, useRef } from "react";
|
||||
|
||||
export type RelayStats = {
|
||||
overview?: {
|
||||
sessions?: number;
|
||||
unique_anchors?: number;
|
||||
active_sessions?: number;
|
||||
total_hours?: number;
|
||||
avg_duration_seconds?: number;
|
||||
median_duration_seconds?: number;
|
||||
days_span?: number;
|
||||
date_from?: string;
|
||||
date_to?: string;
|
||||
};
|
||||
top_anchors?: Array<{
|
||||
anchor_name?: string;
|
||||
sessions?: number;
|
||||
hours_total?: number;
|
||||
avg_duration_seconds?: number;
|
||||
peak_hour?: number;
|
||||
peak_weekday_label?: string;
|
||||
dates_active?: number;
|
||||
sessions_per_active_day?: number;
|
||||
avg_gap_hours?: number | null;
|
||||
source_room_id?: string;
|
||||
}>;
|
||||
by_hour?: { starts?: number[]; minutes?: number[]; labels?: string[] };
|
||||
by_weekday?: { starts?: number[]; minutes?: number[]; labels?: string[]; labels_zh?: string[] };
|
||||
heatmap?: {
|
||||
starts?: number[][];
|
||||
minutes?: number[][];
|
||||
weekday_labels?: string[];
|
||||
weekday_labels_zh?: string[];
|
||||
hour_labels?: string[];
|
||||
};
|
||||
by_date?: Array<{ date: string; sessions: number; hours: number; unique_anchors: number }>;
|
||||
duration_buckets?: Record<string, number>;
|
||||
insights?: Array<{ zh: string; en: string }>;
|
||||
};
|
||||
|
||||
function useEchart(option: Record<string, unknown> | null, height: number) {
|
||||
const ref = useRef<HTMLDivElement>(null);
|
||||
useEffect(() => {
|
||||
const el = ref.current;
|
||||
if (!el || !option) return;
|
||||
let disposed = false;
|
||||
let chart: import("echarts").ECharts | null = null;
|
||||
const onResize = () => chart?.resize();
|
||||
import("echarts").then((echarts) => {
|
||||
if (disposed || !ref.current) return;
|
||||
chart = echarts.init(ref.current, undefined, { renderer: "canvas" });
|
||||
chart.setOption(option, true);
|
||||
window.addEventListener("resize", onResize);
|
||||
});
|
||||
return () => {
|
||||
disposed = true;
|
||||
window.removeEventListener("resize", onResize);
|
||||
chart?.dispose();
|
||||
};
|
||||
}, [option]);
|
||||
return <div ref={ref} style={{ height }} className="w-full" />;
|
||||
}
|
||||
|
||||
const FG = "#f4f4f5";
|
||||
const MUTED = "#a1a1aa";
|
||||
const GRID = "rgba(255,255,255,0.06)";
|
||||
const TOOLTIP = {
|
||||
backgroundColor: "#18181b",
|
||||
borderColor: GRID,
|
||||
textStyle: { color: FG, fontSize: 12 },
|
||||
};
|
||||
|
||||
export function LiveYoutubeRelayLogCharts({
|
||||
stats,
|
||||
lang,
|
||||
t,
|
||||
}: {
|
||||
stats: RelayStats | null;
|
||||
lang: "zh" | "en";
|
||||
t: (zh: string, en: string) => string;
|
||||
}) {
|
||||
const overview = stats?.overview;
|
||||
const weekdayLabels = lang === "zh" ? stats?.by_weekday?.labels_zh || stats?.by_weekday?.labels : stats?.by_weekday?.labels;
|
||||
const heatWeekday = lang === "zh" ? stats?.heatmap?.weekday_labels_zh || stats?.heatmap?.weekday_labels : stats?.heatmap?.weekday_labels;
|
||||
|
||||
const dailyOption = useMemo(() => {
|
||||
const rows = stats?.by_date || [];
|
||||
if (!rows.length) return null;
|
||||
return {
|
||||
color: ["#22d3ee", "#a78bfa"],
|
||||
textStyle: { color: FG },
|
||||
tooltip: { ...TOOLTIP, trigger: "axis" },
|
||||
legend: { data: [t("场次", "Sessions"), t("时长(小时)", "Hours")], textStyle: { color: MUTED } },
|
||||
grid: { left: 48, right: 48, top: 40, bottom: 48 },
|
||||
xAxis: {
|
||||
type: "category",
|
||||
data: rows.map((r) => r.date.slice(5)),
|
||||
axisLabel: { color: MUTED, rotate: rows.length > 14 ? 45 : 0 },
|
||||
axisLine: { lineStyle: { color: GRID } },
|
||||
},
|
||||
yAxis: [
|
||||
{ type: "value", name: t("场次", "Sessions"), nameTextStyle: { color: MUTED }, axisLabel: { color: MUTED }, splitLine: { lineStyle: { color: GRID } } },
|
||||
{ type: "value", name: t("小时", "Hours"), nameTextStyle: { color: MUTED }, axisLabel: { color: MUTED }, splitLine: { show: false } },
|
||||
],
|
||||
series: [
|
||||
{ name: t("场次", "Sessions"), type: "bar", data: rows.map((r) => r.sessions), barMaxWidth: 18 },
|
||||
{ name: t("时长(小时)", "Hours"), type: "line", yAxisIndex: 1, smooth: true, data: rows.map((r) => Number(r.hours.toFixed(2))) },
|
||||
],
|
||||
};
|
||||
}, [stats?.by_date, t]);
|
||||
|
||||
const anchorOption = useMemo(() => {
|
||||
const rows = (stats?.top_anchors || []).slice(0, 12).reverse();
|
||||
if (!rows.length) return null;
|
||||
return {
|
||||
color: ["#34d399", "#38bdf8"],
|
||||
textStyle: { color: FG },
|
||||
tooltip: { ...TOOLTIP, trigger: "axis", axisPointer: { type: "shadow" } },
|
||||
legend: { data: [t("场次", "Sessions"), t("累计小时", "Hours")], textStyle: { color: MUTED } },
|
||||
grid: { left: 110, right: 48, top: 36, bottom: 28 },
|
||||
xAxis: { type: "value", axisLabel: { color: MUTED }, splitLine: { lineStyle: { color: GRID } } },
|
||||
yAxis: {
|
||||
type: "category",
|
||||
data: rows.map((r) => (r.anchor_name || "—").slice(0, 14)),
|
||||
axisLabel: { color: MUTED, fontSize: 11 },
|
||||
axisLine: { lineStyle: { color: GRID } },
|
||||
},
|
||||
series: [
|
||||
{ name: t("场次", "Sessions"), type: "bar", data: rows.map((r) => r.sessions || 0), barMaxWidth: 14 },
|
||||
{ name: t("累计小时", "Hours"), type: "bar", data: rows.map((r) => Number((r.hours_total || 0).toFixed(2))), barMaxWidth: 14 },
|
||||
],
|
||||
};
|
||||
}, [stats?.top_anchors, t]);
|
||||
|
||||
const hourOption = useMemo(() => {
|
||||
const starts = stats?.by_hour?.starts || [];
|
||||
const minutes = stats?.by_hour?.minutes || [];
|
||||
if (!starts.some((n) => n > 0) && !minutes.some((n) => n > 0)) return null;
|
||||
return {
|
||||
color: ["#fbbf24", "#fb7185"],
|
||||
textStyle: { color: FG },
|
||||
tooltip: { ...TOOLTIP, trigger: "axis" },
|
||||
legend: { data: [t("开播次数", "Starts"), t("在播分钟", "On-air minutes")], textStyle: { color: MUTED } },
|
||||
grid: { left: 48, right: 48, top: 40, bottom: 36 },
|
||||
xAxis: {
|
||||
type: "category",
|
||||
data: stats?.by_hour?.labels || Array.from({ length: 24 }, (_, h) => `${String(h).padStart(2, "0")}:00`),
|
||||
axisLabel: { color: MUTED, fontSize: 10 },
|
||||
axisLine: { lineStyle: { color: GRID } },
|
||||
},
|
||||
yAxis: [
|
||||
{ type: "value", axisLabel: { color: MUTED }, splitLine: { lineStyle: { color: GRID } } },
|
||||
{ type: "value", axisLabel: { color: MUTED }, splitLine: { show: false } },
|
||||
],
|
||||
series: [
|
||||
{ name: t("开播次数", "Starts"), type: "bar", data: starts, barMaxWidth: 12 },
|
||||
{ name: t("在播分钟", "On-air minutes"), type: "line", yAxisIndex: 1, smooth: true, areaStyle: { opacity: 0.12 }, data: minutes.map((n) => Number(n.toFixed(1))) },
|
||||
],
|
||||
};
|
||||
}, [stats?.by_hour, t]);
|
||||
|
||||
const weekdayOption = useMemo(() => {
|
||||
const starts = stats?.by_weekday?.starts || [];
|
||||
if (!starts.some((n) => n > 0)) return null;
|
||||
return {
|
||||
color: ["#818cf8"],
|
||||
textStyle: { color: FG },
|
||||
tooltip: { ...TOOLTIP, trigger: "axis" },
|
||||
grid: { left: 48, right: 16, top: 28, bottom: 36 },
|
||||
xAxis: {
|
||||
type: "category",
|
||||
data: weekdayLabels || [],
|
||||
axisLabel: { color: MUTED },
|
||||
axisLine: { lineStyle: { color: GRID } },
|
||||
},
|
||||
yAxis: { type: "value", axisLabel: { color: MUTED }, splitLine: { lineStyle: { color: GRID } } },
|
||||
series: [{ type: "bar", data: starts, barMaxWidth: 28, name: t("开播场次", "Starts") }],
|
||||
};
|
||||
}, [stats?.by_weekday, weekdayLabels, t]);
|
||||
|
||||
const heatmapOption = useMemo(() => {
|
||||
const matrix = stats?.heatmap?.starts || [];
|
||||
if (!matrix.length) return null;
|
||||
const data: [number, number, number][] = [];
|
||||
let max = 0;
|
||||
matrix.forEach((row, wd) => {
|
||||
row.forEach((val, hour) => {
|
||||
data.push([hour, wd, val]);
|
||||
if (val > max) max = val;
|
||||
});
|
||||
});
|
||||
if (max <= 0) return null;
|
||||
return {
|
||||
textStyle: { color: FG },
|
||||
tooltip: {
|
||||
...TOOLTIP,
|
||||
formatter: (p: { data?: [number, number, number] }) => {
|
||||
const d = p.data;
|
||||
if (!d) return "";
|
||||
const hour = d[0];
|
||||
const wd = d[1];
|
||||
const label = (heatWeekday || [])[wd] || String(wd);
|
||||
return `${label} ${hour.toString().padStart(2, "0")}:00<br/>${t("开播", "Starts")}: <b>${d[2]}</b>`;
|
||||
},
|
||||
},
|
||||
grid: { left: 56, right: 24, top: 16, bottom: 40 },
|
||||
xAxis: {
|
||||
type: "category",
|
||||
data: stats?.heatmap?.hour_labels || Array.from({ length: 24 }, (_, h) => `${h}`),
|
||||
splitArea: { show: true },
|
||||
axisLabel: { color: MUTED, fontSize: 10 },
|
||||
},
|
||||
yAxis: {
|
||||
type: "category",
|
||||
data: heatWeekday || [],
|
||||
splitArea: { show: true },
|
||||
axisLabel: { color: MUTED },
|
||||
},
|
||||
visualMap: {
|
||||
min: 0,
|
||||
max: Math.max(1, max),
|
||||
calculable: true,
|
||||
orient: "horizontal",
|
||||
left: "center",
|
||||
bottom: 0,
|
||||
textStyle: { color: MUTED },
|
||||
inRange: { color: ["#18181b", "#0e7490", "#22d3ee", "#fbbf24", "#fb7185"] },
|
||||
},
|
||||
series: [
|
||||
{
|
||||
type: "heatmap",
|
||||
data,
|
||||
label: { show: false },
|
||||
emphasis: { itemStyle: { shadowBlur: 8, shadowColor: "rgba(0,0,0,0.4)" } },
|
||||
},
|
||||
],
|
||||
};
|
||||
}, [stats?.heatmap, heatWeekday, t]);
|
||||
|
||||
const durationOption = useMemo(() => {
|
||||
const buckets = stats?.duration_buckets || {};
|
||||
const keys = Object.keys(buckets);
|
||||
if (!keys.length || !Object.values(buckets).some((n) => n > 0)) return null;
|
||||
return {
|
||||
color: ["#2dd4bf"],
|
||||
textStyle: { color: FG },
|
||||
tooltip: { ...TOOLTIP, trigger: "item" },
|
||||
series: [
|
||||
{
|
||||
type: "pie",
|
||||
radius: ["42%", "68%"],
|
||||
center: ["50%", "52%"],
|
||||
data: keys.map((k) => ({ name: k, value: buckets[k] })),
|
||||
label: { color: MUTED, formatter: "{b}\n{c}" },
|
||||
},
|
||||
],
|
||||
};
|
||||
}, [stats?.duration_buckets]);
|
||||
|
||||
const dailyChart = useEchart(dailyOption, 280);
|
||||
const anchorChart = useEchart(anchorOption, 340);
|
||||
const hourChart = useEchart(hourOption, 280);
|
||||
const weekdayChart = useEchart(weekdayOption, 240);
|
||||
const heatChart = useEchart(heatmapOption, 300);
|
||||
const durationChart = useEchart(durationOption, 260);
|
||||
|
||||
if (!stats || !(overview?.sessions || 0)) {
|
||||
return (
|
||||
<div className="mb-4 rounded-xl border border-dashed border-white/10 bg-black/20 px-4 py-8 text-center text-sm text-zinc-500">
|
||||
{t("暂无统计数据。导入或积累推流记录后,这里会显示主播频率与时段规律。", "No analytics yet. Import or accumulate relay sessions to see patterns.")}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
const fmtDur = (seconds: number | undefined) => {
|
||||
const total = Math.max(0, Math.floor(Number(seconds) || 0));
|
||||
const h = Math.floor(total / 3600);
|
||||
const m = Math.floor((total % 3600) / 60);
|
||||
if (h > 0) return `${h}${t("小时", "h")}${m}${t("分", "m")}`;
|
||||
return `${m}${t("分", "m")}`;
|
||||
};
|
||||
|
||||
return (
|
||||
<div className="mb-6 space-y-4">
|
||||
<div className="grid gap-3 sm:grid-cols-2 xl:grid-cols-6">
|
||||
{[
|
||||
[t("总场次", "Sessions"), String(overview?.sessions ?? 0)],
|
||||
[t("主播数", "Anchors"), String(overview?.unique_anchors ?? 0)],
|
||||
[t("累计时长", "Total hours"), `${Number(overview?.total_hours || 0).toFixed(1)}h`],
|
||||
[t("平均场长", "Avg length"), fmtDur(overview?.avg_duration_seconds)],
|
||||
[t("中位场长", "Median"), fmtDur(overview?.median_duration_seconds)],
|
||||
[t("进行中", "Active"), String(overview?.active_sessions ?? 0)],
|
||||
].map(([label, value]) => (
|
||||
<div key={label} className="rounded-xl border border-white/10 bg-gradient-to-br from-white/[0.06] to-transparent px-4 py-3">
|
||||
<div className="text-[11px] uppercase tracking-wide text-zinc-500">{label}</div>
|
||||
<div className="mt-1 text-xl font-semibold tabular-nums text-zinc-50">{value}</div>
|
||||
</div>
|
||||
))}
|
||||
</div>
|
||||
|
||||
{stats.insights?.length ? (
|
||||
<div className="rounded-xl border border-cyan-500/20 bg-cyan-500/5 px-4 py-3 text-sm text-cyan-50/90">
|
||||
<div className="mb-1 text-xs font-medium uppercase tracking-wide text-cyan-300/80">{t("规律速览", "Pattern snapshot")}</div>
|
||||
<ul className="space-y-1 text-zinc-200">
|
||||
{stats.insights.map((item, idx) => (
|
||||
<li key={idx}>· {lang === "zh" ? item.zh : item.en}</li>
|
||||
))}
|
||||
</ul>
|
||||
</div>
|
||||
) : null}
|
||||
|
||||
<div className="grid gap-4 xl:grid-cols-2">
|
||||
<section className="rounded-xl border border-white/10 bg-black/25 p-4">
|
||||
<h3 className="mb-1 text-sm font-medium text-zinc-200">{t("每日推流频率与时长", "Daily session frequency & hours")}</h3>
|
||||
<p className="mb-2 text-xs text-zinc-500">{t("柱:当天开播场次;线:当天累计推流小时。", "Bars: sessions/day; line: total hours/day.")}</p>
|
||||
{dailyChart}
|
||||
</section>
|
||||
<section className="rounded-xl border border-white/10 bg-black/25 p-4">
|
||||
<h3 className="mb-1 text-sm font-medium text-zinc-200">{t("主播排行(场次 / 累计小时)", "Anchor ranking (sessions / hours)")}</h3>
|
||||
<p className="mb-2 text-xs text-zinc-500">{t("看谁最常被转、谁播得最久。", "Who is relayed most often and longest.")}</p>
|
||||
{anchorChart}
|
||||
</section>
|
||||
<section className="rounded-xl border border-white/10 bg-black/25 p-4">
|
||||
<h3 className="mb-1 text-sm font-medium text-zinc-200">{t("一天内时段分布", "Time-of-day distribution")}</h3>
|
||||
<p className="mb-2 text-xs text-zinc-500">{t("开播次数 vs 实际在播占用(分钟)。", "Start counts vs on-air occupancy (minutes).")}</p>
|
||||
{hourChart}
|
||||
</section>
|
||||
<section className="rounded-xl border border-white/10 bg-black/25 p-4">
|
||||
<h3 className="mb-1 text-sm font-medium text-zinc-200">{t("星期分布", "Weekday distribution")}</h3>
|
||||
<p className="mb-2 text-xs text-zinc-500">{t("哪天更容易开播。", "Which weekdays see more starts.")}</p>
|
||||
{weekdayChart}
|
||||
</section>
|
||||
<section className="rounded-xl border border-white/10 bg-black/25 p-4 xl:col-span-2">
|
||||
<h3 className="mb-1 text-sm font-medium text-zinc-200">{t("星期 × 小时 热力图(开播次数)", "Weekday × hour heatmap (starts)")}</h3>
|
||||
<p className="mb-2 text-xs text-zinc-500">{t("颜色越亮表示该时段开播越频繁,适合找固定档期。", "Brighter = more frequent starts; useful for spotting fixed slots.")}</p>
|
||||
{heatChart}
|
||||
</section>
|
||||
<section className="rounded-xl border border-white/10 bg-black/25 p-4">
|
||||
<h3 className="mb-1 text-sm font-medium text-zinc-200">{t("单场时长分布", "Duration distribution")}</h3>
|
||||
<p className="mb-2 text-xs text-zinc-500">{t("短场/长场比例。", "Short vs long session mix.")}</p>
|
||||
{durationChart}
|
||||
</section>
|
||||
<section className="rounded-xl border border-white/10 bg-black/25 p-4">
|
||||
<h3 className="mb-3 text-sm font-medium text-zinc-200">{t("主播明细(可对照图表)", "Anchor detail")}</h3>
|
||||
<div className="max-h-[260px] overflow-auto">
|
||||
<table className="min-w-full text-left text-xs">
|
||||
<thead className="sticky top-0 bg-zinc-950 text-zinc-500">
|
||||
<tr>
|
||||
<th className="px-2 py-2">{t("主播", "Anchor")}</th>
|
||||
<th className="px-2 py-2">{t("场次", "N")}</th>
|
||||
<th className="px-2 py-2">{t("小时", "Hours")}</th>
|
||||
<th className="px-2 py-2">{t("日均场", "/day")}</th>
|
||||
<th className="px-2 py-2">{t("峰值", "Peak")}</th>
|
||||
<th className="px-2 py-2">{t("间隔", "Gap")}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{(stats.top_anchors || []).map((row) => (
|
||||
<tr key={`${row.anchor_name}-${row.source_room_id}`} className="border-t border-white/5 text-zinc-300">
|
||||
<td className="px-2 py-2 font-medium text-zinc-100">{row.anchor_name || "—"}</td>
|
||||
<td className="px-2 py-2 tabular-nums">{row.sessions ?? 0}</td>
|
||||
<td className="px-2 py-2 tabular-nums">{Number(row.hours_total || 0).toFixed(1)}</td>
|
||||
<td className="px-2 py-2 tabular-nums">{Number(row.sessions_per_active_day || 0).toFixed(2)}</td>
|
||||
<td className="px-2 py-2">
|
||||
{String(row.peak_hour ?? 0).padStart(2, "0")}:00
|
||||
{row.peak_weekday_label ? ` · ${row.peak_weekday_label}` : ""}
|
||||
</td>
|
||||
<td className="px-2 py-2 tabular-nums">
|
||||
{row.avg_gap_hours == null ? "—" : `${Number(row.avg_gap_hours).toFixed(1)}h`}
|
||||
</td>
|
||||
</tr>
|
||||
))}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</section>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
export default LiveYoutubeRelayLogCharts;
|
||||
@ -3,6 +3,7 @@
|
||||
import { ExternalLink, Loader2, RefreshCw, Search } from "lucide-react";
|
||||
import { useCallback, useEffect, useMemo, useState } from "react";
|
||||
|
||||
import { LiveYoutubeRelayLogCharts, type RelayStats } from "@/components/live-product/LiveYoutubeRelayLogCharts";
|
||||
import { fetchJsonResponse } from "@/lib/fetchJson";
|
||||
|
||||
type Lang = "zh" | "en";
|
||||
@ -71,8 +72,8 @@ export function LiveYoutubeRelayLogView() {
|
||||
});
|
||||
const initialProcess =
|
||||
typeof window !== "undefined"
|
||||
? new URLSearchParams(window.location.search).get("process") || "youtube"
|
||||
: "youtube";
|
||||
? new URLSearchParams(window.location.search).get("process") || ""
|
||||
: "";
|
||||
|
||||
const [process, setProcess] = useState(initialProcess);
|
||||
const [q, setQ] = useState("");
|
||||
@ -80,43 +81,60 @@ export function LiveYoutubeRelayLogView() {
|
||||
const [dateTo, setDateTo] = useState("");
|
||||
const [status, setStatus] = useState("");
|
||||
const [sessions, setSessions] = useState<RelaySession[]>([]);
|
||||
const [stats, setStats] = useState<RelayStats | null>(null);
|
||||
const [total, setTotal] = useState(0);
|
||||
const [loading, setLoading] = useState(false);
|
||||
const [importing, setImporting] = useState(false);
|
||||
const [error, setError] = useState("");
|
||||
const [selected, setSelected] = useState<RelaySession | null>(null);
|
||||
const [offset, setOffset] = useState(0);
|
||||
const [tab, setTab] = useState<"charts" | "list">("charts");
|
||||
const limit = 50;
|
||||
|
||||
const t = useCallback((zh: string, en: string) => tr(lang, zh, en), [lang]);
|
||||
|
||||
const queryString = useMemo(() => {
|
||||
const filterParams = useMemo(() => {
|
||||
const params = new URLSearchParams();
|
||||
if (process.trim()) params.set("process", process.trim());
|
||||
if (q.trim()) params.set("q", q.trim());
|
||||
if (dateFrom) params.set("date_from", dateFrom);
|
||||
if (dateTo) params.set("date_to", dateTo);
|
||||
if (status) params.set("status", status);
|
||||
return params;
|
||||
}, [process, q, dateFrom, dateTo, status]);
|
||||
|
||||
const queryString = useMemo(() => {
|
||||
const params = new URLSearchParams(filterParams);
|
||||
params.set("limit", String(limit));
|
||||
params.set("offset", String(offset));
|
||||
return params.toString();
|
||||
}, [process, q, dateFrom, dateTo, status, offset]);
|
||||
}, [filterParams, offset]);
|
||||
|
||||
const statsQuery = useMemo(() => {
|
||||
const params = new URLSearchParams(filterParams);
|
||||
params.set("top_anchors", "25");
|
||||
return params.toString();
|
||||
}, [filterParams]);
|
||||
|
||||
const loadSessions = useCallback(async () => {
|
||||
setLoading(true);
|
||||
setError("");
|
||||
try {
|
||||
const data = await fetchJsonResponse<{ sessions?: RelaySession[]; total?: number }>(
|
||||
`/hub/youtube/relay/sessions?${queryString}`,
|
||||
);
|
||||
setSessions(data.sessions || []);
|
||||
setTotal(Number(data.total) || 0);
|
||||
const [listData, statsData] = await Promise.all([
|
||||
fetchJsonResponse<{ sessions?: RelaySession[]; total?: number }>(
|
||||
`/hub/youtube/relay/sessions?${queryString}`,
|
||||
),
|
||||
fetchJsonResponse<RelayStats>(`/hub/youtube/relay/sessions/stats?${statsQuery}`),
|
||||
]);
|
||||
setSessions(listData.sessions || []);
|
||||
setTotal(Number(listData.total) || 0);
|
||||
setStats(statsData || null);
|
||||
} catch (e) {
|
||||
setError((e as Error).message);
|
||||
} finally {
|
||||
setLoading(false);
|
||||
}
|
||||
}, [queryString]);
|
||||
}, [queryString, statsQuery]);
|
||||
|
||||
useEffect(() => {
|
||||
void loadSessions();
|
||||
@ -129,7 +147,10 @@ export function LiveYoutubeRelayLogView() {
|
||||
await fetchJsonResponse("/hub/youtube/relay/sessions/import-log", {
|
||||
method: "POST",
|
||||
headers: { "Content-Type": "application/json" },
|
||||
body: JSON.stringify({ process: process.trim() || "youtube", replace_imported: true }),
|
||||
body: JSON.stringify({
|
||||
process: process.trim() || undefined,
|
||||
replace_imported: true,
|
||||
}),
|
||||
});
|
||||
setOffset(0);
|
||||
await loadSessions();
|
||||
@ -151,8 +172,8 @@ export function LiveYoutubeRelayLogView() {
|
||||
<h1 className="text-2xl font-semibold tracking-tight">{t("YouTube 推流日志", "YouTube relay log")}</h1>
|
||||
<p className="mt-1 max-w-3xl text-sm text-zinc-400">
|
||||
{t(
|
||||
"记录每次抖音源转播到 YouTube 的时段、主播昵称、直播间 URL 与开播截图,便于追溯音乐版权等问题。",
|
||||
"Track each Douyin-to-YouTube relay with anchor, room URL, timing, and start snapshot for copyright tracing.",
|
||||
"图表展示每位主播的开播频率、时段规律与累计时长;列表保留逐场明细与截图,便于版权追溯。",
|
||||
"Charts show per-anchor frequency, time-of-day patterns, and hours; the table keeps per-session detail and covers for tracing.",
|
||||
)}
|
||||
</p>
|
||||
</div>
|
||||
@ -188,7 +209,7 @@ export function LiveYoutubeRelayLogView() {
|
||||
setProcess(e.target.value);
|
||||
}}
|
||||
className="mt-1 w-full rounded-lg border border-white/10 bg-zinc-900 px-3 py-2 text-sm"
|
||||
placeholder="youtube"
|
||||
placeholder={t("全部线路(留空)", "All lanes (empty)")}
|
||||
/>
|
||||
</label>
|
||||
<label className="block text-xs text-zinc-400 xl:col-span-2">
|
||||
@ -247,115 +268,147 @@ export function LiveYoutubeRelayLogView() {
|
||||
</label>
|
||||
</div>
|
||||
|
||||
{error ? <div className="mb-4 rounded-lg border border-rose-500/30 bg-rose-500/10 px-4 py-3 text-sm text-rose-100">{error}</div> : null}
|
||||
{error ? (
|
||||
<div className="mb-4 rounded-lg border border-rose-500/30 bg-rose-500/10 px-4 py-3 text-sm text-rose-100">{error}</div>
|
||||
) : null}
|
||||
|
||||
<div className="overflow-hidden rounded-xl border border-white/10 bg-black/20">
|
||||
<div className="overflow-x-auto">
|
||||
<table className="min-w-full text-left text-sm">
|
||||
<thead className="bg-white/5 text-xs uppercase tracking-wide text-zinc-400">
|
||||
<tr>
|
||||
<th className="px-3 py-3">{t("截图", "Cover")}</th>
|
||||
<th className="px-3 py-3">{t("主播昵称", "Anchor")}</th>
|
||||
<th className="px-3 py-3">{t("直播间 URL", "Room URL")}</th>
|
||||
<th className="px-3 py-3">{t("推流开始", "Started")}</th>
|
||||
<th className="px-3 py-3">{t("推流结束", "Ended")}</th>
|
||||
<th className="px-3 py-3">{t("总时长", "Duration")}</th>
|
||||
<th className="px-3 py-3">{t("推流日期", "Date")}</th>
|
||||
<th className="px-3 py-3">{t("YT 密钥", "YT key")}</th>
|
||||
<th className="px-3 py-3">{t("线路", "Lane")}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{sessions.map((session) => {
|
||||
const url = douyinUrl(session);
|
||||
return (
|
||||
<tr
|
||||
key={session.id}
|
||||
className="cursor-pointer border-t border-white/5 hover:bg-white/[0.03]"
|
||||
onClick={() => setSelected(session)}
|
||||
>
|
||||
<td className="px-3 py-3">
|
||||
{session.cover_url ? (
|
||||
// eslint-disable-next-line @next/next/no-img-element
|
||||
<img
|
||||
src={`${session.cover_url}?ts=${session.started_at || 0}`}
|
||||
alt={session.anchor_name || "cover"}
|
||||
className="h-16 w-10 rounded object-cover ring-1 ring-white/10"
|
||||
/>
|
||||
) : (
|
||||
<div className="flex h-16 w-10 items-center justify-center rounded bg-zinc-900 text-[10px] text-zinc-500 ring-1 ring-white/10">
|
||||
N/A
|
||||
</div>
|
||||
)}
|
||||
</td>
|
||||
<td className="px-3 py-3 font-medium text-zinc-100">{session.anchor_name || "—"}</td>
|
||||
<td className="max-w-[14rem] truncate px-3 py-3 font-mono text-xs text-cyan-300/90">
|
||||
{url ? (
|
||||
<a
|
||||
href={url}
|
||||
target="_blank"
|
||||
rel="noreferrer"
|
||||
className="hover:underline"
|
||||
onClick={(e) => e.stopPropagation()}
|
||||
>
|
||||
{url.replace(/^https?:\/\//, "")}
|
||||
</a>
|
||||
) : (
|
||||
"—"
|
||||
)}
|
||||
</td>
|
||||
<td className="whitespace-nowrap px-3 py-3 text-zinc-300">{fmtTs(session.started_at, lang)}</td>
|
||||
<td className="whitespace-nowrap px-3 py-3 text-zinc-300">
|
||||
{session.ended_at ? fmtTs(session.ended_at, lang) : t("进行中", "Active")}
|
||||
</td>
|
||||
<td className="whitespace-nowrap px-3 py-3 font-mono text-zinc-200">
|
||||
{fmtDuration(session.duration_seconds, lang)}
|
||||
</td>
|
||||
<td className="whitespace-nowrap px-3 py-3">{session.push_date || "—"}</td>
|
||||
<td className="whitespace-nowrap px-3 py-3 font-mono text-xs text-amber-200/90">
|
||||
{session.youtube_key_suffix ? `…${session.youtube_key_suffix}` : "—"}
|
||||
</td>
|
||||
<td className="px-3 py-3 text-xs text-zinc-400">
|
||||
{session.channel_name || session.process || "—"}
|
||||
</td>
|
||||
<div className="mb-4 flex gap-2">
|
||||
<button
|
||||
type="button"
|
||||
onClick={() => setTab("charts")}
|
||||
className={`rounded-lg px-3 py-1.5 text-sm ${
|
||||
tab === "charts" ? "bg-white/15 text-white" : "bg-white/5 text-zinc-400 hover:bg-white/10"
|
||||
}`}
|
||||
>
|
||||
{t("可视化分析", "Analytics")}
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
onClick={() => setTab("list")}
|
||||
className={`rounded-lg px-3 py-1.5 text-sm ${
|
||||
tab === "list" ? "bg-white/15 text-white" : "bg-white/5 text-zinc-400 hover:bg-white/10"
|
||||
}`}
|
||||
>
|
||||
{t("场次列表", "Session list")} ({total})
|
||||
</button>
|
||||
</div>
|
||||
|
||||
{tab === "charts" ? <LiveYoutubeRelayLogCharts stats={stats} lang={lang} t={t} /> : null}
|
||||
|
||||
{tab === "list" ? (
|
||||
<>
|
||||
<div className="overflow-hidden rounded-xl border border-white/10 bg-black/20">
|
||||
<div className="overflow-x-auto">
|
||||
<table className="min-w-full text-left text-sm">
|
||||
<thead className="bg-white/5 text-xs uppercase tracking-wide text-zinc-400">
|
||||
<tr>
|
||||
<th className="px-3 py-3">{t("截图", "Cover")}</th>
|
||||
<th className="px-3 py-3">{t("主播昵称", "Anchor")}</th>
|
||||
<th className="px-3 py-3">{t("直播间 URL", "Room URL")}</th>
|
||||
<th className="px-3 py-3">{t("推流开始", "Started")}</th>
|
||||
<th className="px-3 py-3">{t("推流结束", "Ended")}</th>
|
||||
<th className="px-3 py-3">{t("总时长", "Duration")}</th>
|
||||
<th className="px-3 py-3">{t("推流日期", "Date")}</th>
|
||||
<th className="px-3 py-3">{t("YT 密钥", "YT key")}</th>
|
||||
<th className="px-3 py-3">{t("线路", "Lane")}</th>
|
||||
</tr>
|
||||
);
|
||||
})}
|
||||
{!loading && sessions.length === 0 ? (
|
||||
<tr>
|
||||
<td colSpan={9} className="px-3 py-10 text-center text-zinc-500">
|
||||
{t("暂无推流记录。可先点击「从 PM2 日志导入历史」。", "No relay sessions yet. Try importing PM2 logs first.")}
|
||||
</td>
|
||||
</tr>
|
||||
) : null}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</thead>
|
||||
<tbody>
|
||||
{sessions.map((session) => {
|
||||
const url = douyinUrl(session);
|
||||
return (
|
||||
<tr
|
||||
key={session.id}
|
||||
className="cursor-pointer border-t border-white/5 hover:bg-white/[0.03]"
|
||||
onClick={() => setSelected(session)}
|
||||
>
|
||||
<td className="px-3 py-3">
|
||||
{session.cover_url ? (
|
||||
// eslint-disable-next-line @next/next/no-img-element
|
||||
<img
|
||||
src={`${session.cover_url}?ts=${session.started_at || 0}`}
|
||||
alt={session.anchor_name || "cover"}
|
||||
className="h-16 w-10 rounded object-cover ring-1 ring-white/10"
|
||||
/>
|
||||
) : (
|
||||
<div className="flex h-16 w-10 items-center justify-center rounded bg-zinc-900 text-[10px] text-zinc-500 ring-1 ring-white/10">
|
||||
N/A
|
||||
</div>
|
||||
)}
|
||||
</td>
|
||||
<td className="px-3 py-3 font-medium text-zinc-100">{session.anchor_name || "—"}</td>
|
||||
<td className="max-w-[14rem] truncate px-3 py-3 font-mono text-xs text-cyan-300/90">
|
||||
{url ? (
|
||||
<a
|
||||
href={url}
|
||||
target="_blank"
|
||||
rel="noreferrer"
|
||||
className="hover:underline"
|
||||
onClick={(e) => e.stopPropagation()}
|
||||
>
|
||||
{url.replace(/^https?:\/\//, "")}
|
||||
</a>
|
||||
) : (
|
||||
"—"
|
||||
)}
|
||||
</td>
|
||||
<td className="whitespace-nowrap px-3 py-3 text-zinc-300">{fmtTs(session.started_at, lang)}</td>
|
||||
<td className="whitespace-nowrap px-3 py-3 text-zinc-300">
|
||||
{session.ended_at ? fmtTs(session.ended_at, lang) : t("进行中", "Active")}
|
||||
</td>
|
||||
<td className="whitespace-nowrap px-3 py-3 font-mono text-zinc-200">
|
||||
{fmtDuration(session.duration_seconds, lang)}
|
||||
</td>
|
||||
<td className="whitespace-nowrap px-3 py-3">{session.push_date || "—"}</td>
|
||||
<td className="whitespace-nowrap px-3 py-3 font-mono text-xs text-amber-200/90">
|
||||
{session.youtube_key_suffix ? `…${session.youtube_key_suffix}` : "—"}
|
||||
</td>
|
||||
<td className="px-3 py-3 text-xs text-zinc-400">
|
||||
{session.channel_name || session.process || "—"}
|
||||
</td>
|
||||
</tr>
|
||||
);
|
||||
})}
|
||||
{!loading && sessions.length === 0 ? (
|
||||
<tr>
|
||||
<td colSpan={9} className="px-3 py-10 text-center text-zinc-500">
|
||||
{t(
|
||||
"暂无推流记录。可先点击「从 PM2 日志导入历史」。",
|
||||
"No relay sessions yet. Try importing PM2 logs first.",
|
||||
)}
|
||||
</td>
|
||||
</tr>
|
||||
) : null}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div className="mt-4 flex items-center justify-between text-sm text-zinc-400">
|
||||
<span>
|
||||
{t("共", "Total")} {total} {t("条", "records")} · {t("第", "Page")} {pageIndex}/{pageCount}
|
||||
</span>
|
||||
<div className="flex gap-2">
|
||||
<button
|
||||
type="button"
|
||||
disabled={offset <= 0 || loading}
|
||||
onClick={() => setOffset(Math.max(0, offset - limit))}
|
||||
className="rounded-lg border border-white/10 px-3 py-1.5 disabled:opacity-40"
|
||||
>
|
||||
{t("上一页", "Prev")}
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
disabled={offset + limit >= total || loading}
|
||||
onClick={() => setOffset(offset + limit)}
|
||||
className="rounded-lg border border-white/10 px-3 py-1.5 disabled:opacity-40"
|
||||
>
|
||||
{t("下一页", "Next")}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
<div className="mt-4 flex items-center justify-between text-sm text-zinc-400">
|
||||
<span>
|
||||
{t("共", "Total")} {total} {t("条", "records")} · {t("第", "Page")} {pageIndex}/{pageCount}
|
||||
</span>
|
||||
<div className="flex gap-2">
|
||||
<button
|
||||
type="button"
|
||||
disabled={offset <= 0 || loading}
|
||||
onClick={() => setOffset(Math.max(0, offset - limit))}
|
||||
className="rounded-lg border border-white/10 px-3 py-1.5 disabled:opacity-40"
|
||||
>
|
||||
{t("上一页", "Prev")}
|
||||
</button>
|
||||
<button
|
||||
type="button"
|
||||
disabled={offset + limit >= total || loading}
|
||||
onClick={() => setOffset(offset + limit)}
|
||||
className="rounded-lg border border-white/10 px-3 py-1.5 disabled:opacity-40"
|
||||
>
|
||||
{t("下一页", "Next")}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
</>
|
||||
) : null}
|
||||
</div>
|
||||
|
||||
{selected ? (
|
||||
@ -390,7 +443,12 @@ export function LiveYoutubeRelayLogView() {
|
||||
<dt className="text-zinc-500">{t("直播间 URL", "Room URL")}</dt>
|
||||
<dd className="break-all font-mono text-cyan-300">
|
||||
{douyinUrl(selected) ? (
|
||||
<a href={douyinUrl(selected)} target="_blank" rel="noreferrer" className="inline-flex items-center gap-1 hover:underline">
|
||||
<a
|
||||
href={douyinUrl(selected)}
|
||||
target="_blank"
|
||||
rel="noreferrer"
|
||||
className="inline-flex items-center gap-1 hover:underline"
|
||||
>
|
||||
{douyinUrl(selected)} <ExternalLink className="h-3.5 w-3.5" />
|
||||
</a>
|
||||
) : (
|
||||
|
||||
@ -34,6 +34,7 @@ import {
|
||||
resolveYoutubeProChannelPm2,
|
||||
saveYoutubeProChannels,
|
||||
sanitizeYoutubePm2Name,
|
||||
stabilizeYoutubeProChannelOrder,
|
||||
type YoutubeProChannel,
|
||||
type YoutubeProChannelsSyncOptions,
|
||||
} from "@/lib/youtubeProChannels";
|
||||
@ -239,21 +240,21 @@ function proLaneStatusLabel(row: LiveProcRow | undefined, t: TFn): string {
|
||||
return businessStatusLabel(row, t);
|
||||
}
|
||||
|
||||
function proLanePrimaryTitle(
|
||||
laneName: string,
|
||||
row?: LiveProcRow,
|
||||
urlLines = "",
|
||||
qualityLane?: YoutubeQualityLane,
|
||||
): string {
|
||||
const fromQuality = (qualityLane?.source_display || qualityLane?.source_title || "").trim();
|
||||
if (fromQuality) return fromQuality;
|
||||
return douyinSourceDisplayFor(row, urlLines) || laneName.trim();
|
||||
function proLanePrimaryTitle(laneName: string): string {
|
||||
// 卡片顺序/身份必须稳定:始终用线路名做主标题,避免推流状态变化时与抖音源标题对调。
|
||||
return laneName.trim();
|
||||
}
|
||||
|
||||
function proLaneDouyinSubtitle(row?: LiveProcRow, urlLines = "", laneName = ""): string {
|
||||
const source = douyinSourceDisplayFor(row, urlLines).trim();
|
||||
function proLaneDouyinSubtitle(
|
||||
row?: LiveProcRow,
|
||||
urlLines = "",
|
||||
laneName = "",
|
||||
qualityLane?: YoutubeQualityLane,
|
||||
): string {
|
||||
const lane = laneName.trim();
|
||||
if (isLivePushingRow(row) && lane && source && lane !== source) return lane;
|
||||
const fromQuality = (qualityLane?.source_display || qualityLane?.source_title || "").trim();
|
||||
const source = fromQuality || douyinSourceDisplayFor(row, urlLines).trim();
|
||||
if (source && source !== lane) return source;
|
||||
return "";
|
||||
}
|
||||
|
||||
@ -1053,7 +1054,10 @@ export function LiveYoutubeUnmannedView({
|
||||
try {
|
||||
const remote = await fetchYoutubeProChannelsRemote(fetchJson);
|
||||
if (remote.fetched && remote.channels.length && !cancelled) {
|
||||
const nextChannels = cleanYoutubeProChannelNames(remote.channels);
|
||||
const nextChannels = stabilizeYoutubeProChannelOrder(
|
||||
channelsRef.current,
|
||||
cleanYoutubeProChannelNames(remote.channels),
|
||||
);
|
||||
channelsRef.current = nextChannels;
|
||||
setChannels(nextChannels);
|
||||
setLaneDrafts(laneDraftsFromChannels(nextChannels));
|
||||
@ -1423,7 +1427,10 @@ export function LiveYoutubeUnmannedView({
|
||||
try {
|
||||
const remote = await fetchYoutubeProChannelsRemote(fetchJson);
|
||||
if (!remote.fetched || !remote.channels.length) return;
|
||||
const nextChannels = cleanYoutubeProChannelNames(remote.channels);
|
||||
const nextChannels = stabilizeYoutubeProChannelOrder(
|
||||
channelsRef.current,
|
||||
cleanYoutubeProChannelNames(remote.channels),
|
||||
);
|
||||
channelsRef.current = nextChannels;
|
||||
setChannels(nextChannels);
|
||||
setLaneDrafts(laneDraftsFromChannels(nextChannels));
|
||||
@ -2083,7 +2090,8 @@ export function LiveYoutubeUnmannedView({
|
||||
const overviewLaneName = overviewChannel
|
||||
? cleanLaneName(overviewChannel.name, overviewLaneIndex >= 0 ? overviewLaneIndex : 0)
|
||||
: "";
|
||||
const overviewSource = proLanePrimaryTitle(overviewLaneName, overviewRow, monitorUrlDraft);
|
||||
const overviewSource =
|
||||
proLanePrimaryTitle(overviewLaneName) || douyinSourceDisplayFor(overviewRow, monitorUrlDraft);
|
||||
const overviewDouyinSubtitle = proLaneDouyinSubtitle(overviewRow, monitorUrlDraft, overviewLaneName);
|
||||
const overviewStatusLabel = proLaneStatusLabel(overviewRow, t);
|
||||
const overviewSourceUrl = douyinSourceUrlFor(overviewRow, monitorUrlDraft);
|
||||
@ -3263,8 +3271,8 @@ export function LiveYoutubeUnmannedView({
|
||||
const laneNeko = resolveNekoBrowserLink(nekoLinks, laneIndex).link;
|
||||
const laneName = cleanLaneName(c.name, laneIndex >= 0 ? laneIndex : 0);
|
||||
const laneQuality = qualityGuard?.lanes?.find((lane) => lane.process === pm);
|
||||
const laneDisplay = proLanePrimaryTitle(laneName, row, laneUrlText, laneQuality);
|
||||
const laneDouyinSubtitle = proLaneDouyinSubtitle(row, laneUrlText, laneName);
|
||||
const laneDisplay = proLanePrimaryTitle(laneName);
|
||||
const laneDouyinSubtitle = proLaneDouyinSubtitle(row, laneUrlText, laneName, laneQuality);
|
||||
const laneStatusLabel = proLaneStatusLabel(row, t);
|
||||
const laneLiveMetrics = qualityLaneMetrics(row, laneQuality);
|
||||
const laneStatsText = formatFfmpegStatsBrief(laneLiveMetrics, {
|
||||
|
||||
@ -43,6 +43,30 @@ export function cleanYoutubeProChannelNames(channels: YoutubeProChannel[]): Yout
|
||||
}));
|
||||
}
|
||||
|
||||
/** Keep previous card order when applying a remote channel list. */
|
||||
export function stabilizeYoutubeProChannelOrder(
|
||||
previous: YoutubeProChannel[],
|
||||
incoming: YoutubeProChannel[],
|
||||
): YoutubeProChannel[] {
|
||||
if (!previous.length || !incoming.length) return incoming;
|
||||
const byId = new Map(incoming.map((row) => [row.id, row]));
|
||||
const byPm2 = new Map(incoming.map((row) => [resolveYoutubeProChannelPm2(row), row]));
|
||||
const out: YoutubeProChannel[] = [];
|
||||
const used = new Set<string>();
|
||||
for (const prev of previous) {
|
||||
const hit = byId.get(prev.id) || byPm2.get(resolveYoutubeProChannelPm2(prev));
|
||||
if (!hit || used.has(hit.id)) continue;
|
||||
out.push(hit);
|
||||
used.add(hit.id);
|
||||
}
|
||||
for (const row of incoming) {
|
||||
if (used.has(row.id)) continue;
|
||||
out.push(row);
|
||||
used.add(row.id);
|
||||
}
|
||||
return out;
|
||||
}
|
||||
|
||||
export function sanitizeYoutubePm2Name(value: string): string {
|
||||
return (value || "").trim().replace(PM2_SANITIZE_RE, "_");
|
||||
}
|
||||
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -2,6 +2,6 @@
|
||||
3:I[7588,["335","static/chunks/335-15aa194ced88957b.js","653","static/chunks/653-15975e374f8e28da.js","357","static/chunks/app/android/page-6fdeef4fee9d1d0a.js"],"default",1]
|
||||
4:I[176,[],""]
|
||||
5:I[9414,[],""]
|
||||
0:["xYg2qS760UEpBRHWcTFN5",[[["",{"children":["android",{"children":["__PAGE__",{}]}]},"$undefined","$undefined",true],["",{"children":["android",{"children":["__PAGE__",{},[["$L1",["$","$L2",null,{"props":{"params":{},"searchParams":{}},"Component":"$3"}],null],null],null]},[null,["$","$L4",null,{"parallelRouterKey":"children","segmentPath":["children","android","children"],"error":"$undefined","errorStyles":"$undefined","errorScripts":"$undefined","template":["$","$L5",null,{}],"templateStyles":"$undefined","templateScripts":"$undefined","notFound":"$undefined","notFoundStyles":"$undefined"}]],null]},[[[["$","link","0",{"rel":"stylesheet","href":"/_next/static/css/27b4d6b789fddb24.css","precedence":"next","crossOrigin":"$undefined"}],["$","link","1",{"rel":"stylesheet","href":"/_next/static/css/f72551e7a5dadbbb.css","precedence":"next","crossOrigin":"$undefined"}]],["$","html",null,{"lang":"zh-CN","data-theme":"dark","suppressHydrationWarning":true,"children":["$","body",null,{"className":"__variable_1e4310 __variable_c3aa02 font-sans antialiased","children":[["$","div",null,{"className":"app-bg-layer","aria-hidden":true}],["$","$L4",null,{"parallelRouterKey":"children","segmentPath":["children"],"error":"$undefined","errorStyles":"$undefined","errorScripts":"$undefined","template":["$","$L5",null,{}],"templateStyles":"$undefined","templateScripts":"$undefined","notFound":[["$","title",null,{"children":"404: This page could not be found."}],["$","div",null,{"style":{"fontFamily":"system-ui,\"Segoe UI\",Roboto,Helvetica,Arial,sans-serif,\"Apple Color Emoji\",\"Segoe UI Emoji\"","height":"100vh","textAlign":"center","display":"flex","flexDirection":"column","alignItems":"center","justifyContent":"center"},"children":["$","div",null,{"children":[["$","style",null,{"dangerouslySetInnerHTML":{"__html":"body{color:#000;background:#fff;margin:0}.next-error-h1{border-right:1px solid rgba(0,0,0,.3)}@media (prefers-color-scheme:dark){body{color:#fff;background:#000}.next-error-h1{border-right:1px solid rgba(255,255,255,.3)}}"}}],["$","h1",null,{"className":"next-error-h1","style":{"display":"inline-block","margin":"0 20px 0 0","padding":"0 23px 0 0","fontSize":24,"fontWeight":500,"verticalAlign":"top","lineHeight":"49px"},"children":"404"}],["$","div",null,{"style":{"display":"inline-block"},"children":["$","h2",null,{"style":{"fontSize":14,"fontWeight":400,"lineHeight":"49px","margin":0},"children":"This page could not be found."}]}]]}]}]],"notFoundStyles":[]}]]}]}]],null],null],["$L6",null]]]]
|
||||
0:["93noLwLTiZ-nO6dg8JRLS",[[["",{"children":["android",{"children":["__PAGE__",{}]}]},"$undefined","$undefined",true],["",{"children":["android",{"children":["__PAGE__",{},[["$L1",["$","$L2",null,{"props":{"params":{},"searchParams":{}},"Component":"$3"}],null],null],null]},[null,["$","$L4",null,{"parallelRouterKey":"children","segmentPath":["children","android","children"],"error":"$undefined","errorStyles":"$undefined","errorScripts":"$undefined","template":["$","$L5",null,{}],"templateStyles":"$undefined","templateScripts":"$undefined","notFound":"$undefined","notFoundStyles":"$undefined"}]],null]},[[[["$","link","0",{"rel":"stylesheet","href":"/_next/static/css/27b4d6b789fddb24.css","precedence":"next","crossOrigin":"$undefined"}],["$","link","1",{"rel":"stylesheet","href":"/_next/static/css/7e3b6f8d9077dbc2.css","precedence":"next","crossOrigin":"$undefined"}]],["$","html",null,{"lang":"zh-CN","data-theme":"dark","suppressHydrationWarning":true,"children":["$","body",null,{"className":"__variable_1e4310 __variable_c3aa02 font-sans antialiased","children":[["$","div",null,{"className":"app-bg-layer","aria-hidden":true}],["$","$L4",null,{"parallelRouterKey":"children","segmentPath":["children"],"error":"$undefined","errorStyles":"$undefined","errorScripts":"$undefined","template":["$","$L5",null,{}],"templateStyles":"$undefined","templateScripts":"$undefined","notFound":[["$","title",null,{"children":"404: This page could not be found."}],["$","div",null,{"style":{"fontFamily":"system-ui,\"Segoe UI\",Roboto,Helvetica,Arial,sans-serif,\"Apple Color Emoji\",\"Segoe UI Emoji\"","height":"100vh","textAlign":"center","display":"flex","flexDirection":"column","alignItems":"center","justifyContent":"center"},"children":["$","div",null,{"children":[["$","style",null,{"dangerouslySetInnerHTML":{"__html":"body{color:#000;background:#fff;margin:0}.next-error-h1{border-right:1px solid rgba(0,0,0,.3)}@media (prefers-color-scheme:dark){body{color:#fff;background:#000}.next-error-h1{border-right:1px solid rgba(255,255,255,.3)}}"}}],["$","h1",null,{"className":"next-error-h1","style":{"display":"inline-block","margin":"0 20px 0 0","padding":"0 23px 0 0","fontSize":24,"fontWeight":500,"verticalAlign":"top","lineHeight":"49px"},"children":"404"}],["$","div",null,{"style":{"display":"inline-block"},"children":["$","h2",null,{"style":{"fontSize":14,"fontWeight":400,"lineHeight":"49px","margin":0},"children":"This page could not be found."}]}]]}]}]],"notFoundStyles":[]}]]}]}]],null],null],["$L6",null]]]]
|
||||
6:[["$","meta","0",{"name":"viewport","content":"width=device-width, initial-scale=1"}],["$","meta","1",{"charSet":"utf-8"}],["$","title","2",{"children":"无人直播系统 · live.local"}],["$","meta","3",{"name":"description","content":"Linux ARM/x86 一键部署的无人直播控制台:YouTube 转播、TikTok HDMI、SRS、Neko 与系统服务"}],["$","link","4",{"rel":"icon","href":"/favicon.ico","type":"image/x-icon","sizes":"16x16"}]]
|
||||
1:null
|
||||
|
||||
File diff suppressed because one or more lines are too long
@ -2,6 +2,6 @@
|
||||
3:I[8422,["335","static/chunks/335-15aa194ced88957b.js","653","static/chunks/653-15975e374f8e28da.js","443","static/chunks/app/console/page-a3e7b4f0539e497a.js"],"default",1]
|
||||
4:I[176,[],""]
|
||||
5:I[9414,[],""]
|
||||
0:["xYg2qS760UEpBRHWcTFN5",[[["",{"children":["console",{"children":["__PAGE__",{}]}]},"$undefined","$undefined",true],["",{"children":["console",{"children":["__PAGE__",{},[["$L1",["$","$L2",null,{"props":{"params":{},"searchParams":{}},"Component":"$3"}],null],null],null]},[null,["$","$L4",null,{"parallelRouterKey":"children","segmentPath":["children","console","children"],"error":"$undefined","errorStyles":"$undefined","errorScripts":"$undefined","template":["$","$L5",null,{}],"templateStyles":"$undefined","templateScripts":"$undefined","notFound":"$undefined","notFoundStyles":"$undefined"}]],null]},[[[["$","link","0",{"rel":"stylesheet","href":"/_next/static/css/27b4d6b789fddb24.css","precedence":"next","crossOrigin":"$undefined"}],["$","link","1",{"rel":"stylesheet","href":"/_next/static/css/f72551e7a5dadbbb.css","precedence":"next","crossOrigin":"$undefined"}]],["$","html",null,{"lang":"zh-CN","data-theme":"dark","suppressHydrationWarning":true,"children":["$","body",null,{"className":"__variable_1e4310 __variable_c3aa02 font-sans antialiased","children":[["$","div",null,{"className":"app-bg-layer","aria-hidden":true}],["$","$L4",null,{"parallelRouterKey":"children","segmentPath":["children"],"error":"$undefined","errorStyles":"$undefined","errorScripts":"$undefined","template":["$","$L5",null,{}],"templateStyles":"$undefined","templateScripts":"$undefined","notFound":[["$","title",null,{"children":"404: This page could not be found."}],["$","div",null,{"style":{"fontFamily":"system-ui,\"Segoe UI\",Roboto,Helvetica,Arial,sans-serif,\"Apple Color Emoji\",\"Segoe UI Emoji\"","height":"100vh","textAlign":"center","display":"flex","flexDirection":"column","alignItems":"center","justifyContent":"center"},"children":["$","div",null,{"children":[["$","style",null,{"dangerouslySetInnerHTML":{"__html":"body{color:#000;background:#fff;margin:0}.next-error-h1{border-right:1px solid rgba(0,0,0,.3)}@media (prefers-color-scheme:dark){body{color:#fff;background:#000}.next-error-h1{border-right:1px solid rgba(255,255,255,.3)}}"}}],["$","h1",null,{"className":"next-error-h1","style":{"display":"inline-block","margin":"0 20px 0 0","padding":"0 23px 0 0","fontSize":24,"fontWeight":500,"verticalAlign":"top","lineHeight":"49px"},"children":"404"}],["$","div",null,{"style":{"display":"inline-block"},"children":["$","h2",null,{"style":{"fontSize":14,"fontWeight":400,"lineHeight":"49px","margin":0},"children":"This page could not be found."}]}]]}]}]],"notFoundStyles":[]}]]}]}]],null],null],["$L6",null]]]]
|
||||
0:["93noLwLTiZ-nO6dg8JRLS",[[["",{"children":["console",{"children":["__PAGE__",{}]}]},"$undefined","$undefined",true],["",{"children":["console",{"children":["__PAGE__",{},[["$L1",["$","$L2",null,{"props":{"params":{},"searchParams":{}},"Component":"$3"}],null],null],null]},[null,["$","$L4",null,{"parallelRouterKey":"children","segmentPath":["children","console","children"],"error":"$undefined","errorStyles":"$undefined","errorScripts":"$undefined","template":["$","$L5",null,{}],"templateStyles":"$undefined","templateScripts":"$undefined","notFound":"$undefined","notFoundStyles":"$undefined"}]],null]},[[[["$","link","0",{"rel":"stylesheet","href":"/_next/static/css/27b4d6b789fddb24.css","precedence":"next","crossOrigin":"$undefined"}],["$","link","1",{"rel":"stylesheet","href":"/_next/static/css/7e3b6f8d9077dbc2.css","precedence":"next","crossOrigin":"$undefined"}]],["$","html",null,{"lang":"zh-CN","data-theme":"dark","suppressHydrationWarning":true,"children":["$","body",null,{"className":"__variable_1e4310 __variable_c3aa02 font-sans antialiased","children":[["$","div",null,{"className":"app-bg-layer","aria-hidden":true}],["$","$L4",null,{"parallelRouterKey":"children","segmentPath":["children"],"error":"$undefined","errorStyles":"$undefined","errorScripts":"$undefined","template":["$","$L5",null,{}],"templateStyles":"$undefined","templateScripts":"$undefined","notFound":[["$","title",null,{"children":"404: This page could not be found."}],["$","div",null,{"style":{"fontFamily":"system-ui,\"Segoe UI\",Roboto,Helvetica,Arial,sans-serif,\"Apple Color Emoji\",\"Segoe UI Emoji\"","height":"100vh","textAlign":"center","display":"flex","flexDirection":"column","alignItems":"center","justifyContent":"center"},"children":["$","div",null,{"children":[["$","style",null,{"dangerouslySetInnerHTML":{"__html":"body{color:#000;background:#fff;margin:0}.next-error-h1{border-right:1px solid rgba(0,0,0,.3)}@media (prefers-color-scheme:dark){body{color:#fff;background:#000}.next-error-h1{border-right:1px solid rgba(255,255,255,.3)}}"}}],["$","h1",null,{"className":"next-error-h1","style":{"display":"inline-block","margin":"0 20px 0 0","padding":"0 23px 0 0","fontSize":24,"fontWeight":500,"verticalAlign":"top","lineHeight":"49px"},"children":"404"}],["$","div",null,{"style":{"display":"inline-block"},"children":["$","h2",null,{"style":{"fontSize":14,"fontWeight":400,"lineHeight":"49px","margin":0},"children":"This page could not be found."}]}]]}]}]],"notFoundStyles":[]}]]}]}]],null],null],["$L6",null]]]]
|
||||
6:[["$","meta","0",{"name":"viewport","content":"width=device-width, initial-scale=1"}],["$","meta","1",{"charSet":"utf-8"}],["$","title","2",{"children":"无人直播系统 · live.local"}],["$","meta","3",{"name":"description","content":"Linux ARM/x86 一键部署的无人直播控制台:YouTube 转播、TikTok HDMI、SRS、Neko 与系统服务"}],["$","link","4",{"rel":"icon","href":"/favicon.ico","type":"image/x-icon","sizes":"16x16"}]]
|
||||
1:null
|
||||
|
||||
File diff suppressed because one or more lines are too long
@ -1,7 +1,7 @@
|
||||
2:I[7523,[],"ClientPageRoot"]
|
||||
3:I[3372,["335","static/chunks/335-15aa194ced88957b.js","270","static/chunks/270-ee064b8a2cee7977.js","653","static/chunks/653-15975e374f8e28da.js","371","static/chunks/371-bddad8b92b1ea180.js","931","static/chunks/app/page-da87e47f3337d8f4.js"],"default",1]
|
||||
3:I[3372,["335","static/chunks/335-15aa194ced88957b.js","270","static/chunks/270-ee064b8a2cee7977.js","653","static/chunks/653-15975e374f8e28da.js","371","static/chunks/371-3c69d09687afa990.js","931","static/chunks/app/page-da87e47f3337d8f4.js"],"default",1]
|
||||
4:I[176,[],""]
|
||||
5:I[9414,[],""]
|
||||
0:["xYg2qS760UEpBRHWcTFN5",[[["",{"children":["__PAGE__",{}]},"$undefined","$undefined",true],["",{"children":["__PAGE__",{},[["$L1",["$","$L2",null,{"props":{"params":{},"searchParams":{}},"Component":"$3"}],null],null],null]},[[[["$","link","0",{"rel":"stylesheet","href":"/_next/static/css/27b4d6b789fddb24.css","precedence":"next","crossOrigin":"$undefined"}],["$","link","1",{"rel":"stylesheet","href":"/_next/static/css/f72551e7a5dadbbb.css","precedence":"next","crossOrigin":"$undefined"}]],["$","html",null,{"lang":"zh-CN","data-theme":"dark","suppressHydrationWarning":true,"children":["$","body",null,{"className":"__variable_1e4310 __variable_c3aa02 font-sans antialiased","children":[["$","div",null,{"className":"app-bg-layer","aria-hidden":true}],["$","$L4",null,{"parallelRouterKey":"children","segmentPath":["children"],"error":"$undefined","errorStyles":"$undefined","errorScripts":"$undefined","template":["$","$L5",null,{}],"templateStyles":"$undefined","templateScripts":"$undefined","notFound":[["$","title",null,{"children":"404: This page could not be found."}],["$","div",null,{"style":{"fontFamily":"system-ui,\"Segoe UI\",Roboto,Helvetica,Arial,sans-serif,\"Apple Color Emoji\",\"Segoe UI Emoji\"","height":"100vh","textAlign":"center","display":"flex","flexDirection":"column","alignItems":"center","justifyContent":"center"},"children":["$","div",null,{"children":[["$","style",null,{"dangerouslySetInnerHTML":{"__html":"body{color:#000;background:#fff;margin:0}.next-error-h1{border-right:1px solid rgba(0,0,0,.3)}@media (prefers-color-scheme:dark){body{color:#fff;background:#000}.next-error-h1{border-right:1px solid rgba(255,255,255,.3)}}"}}],["$","h1",null,{"className":"next-error-h1","style":{"display":"inline-block","margin":"0 20px 0 0","padding":"0 23px 0 0","fontSize":24,"fontWeight":500,"verticalAlign":"top","lineHeight":"49px"},"children":"404"}],["$","div",null,{"style":{"display":"inline-block"},"children":["$","h2",null,{"style":{"fontSize":14,"fontWeight":400,"lineHeight":"49px","margin":0},"children":"This page could not be found."}]}]]}]}]],"notFoundStyles":[]}]]}]}]],null],null],["$L6",null]]]]
|
||||
0:["93noLwLTiZ-nO6dg8JRLS",[[["",{"children":["__PAGE__",{}]},"$undefined","$undefined",true],["",{"children":["__PAGE__",{},[["$L1",["$","$L2",null,{"props":{"params":{},"searchParams":{}},"Component":"$3"}],null],null],null]},[[[["$","link","0",{"rel":"stylesheet","href":"/_next/static/css/27b4d6b789fddb24.css","precedence":"next","crossOrigin":"$undefined"}],["$","link","1",{"rel":"stylesheet","href":"/_next/static/css/7e3b6f8d9077dbc2.css","precedence":"next","crossOrigin":"$undefined"}]],["$","html",null,{"lang":"zh-CN","data-theme":"dark","suppressHydrationWarning":true,"children":["$","body",null,{"className":"__variable_1e4310 __variable_c3aa02 font-sans antialiased","children":[["$","div",null,{"className":"app-bg-layer","aria-hidden":true}],["$","$L4",null,{"parallelRouterKey":"children","segmentPath":["children"],"error":"$undefined","errorStyles":"$undefined","errorScripts":"$undefined","template":["$","$L5",null,{}],"templateStyles":"$undefined","templateScripts":"$undefined","notFound":[["$","title",null,{"children":"404: This page could not be found."}],["$","div",null,{"style":{"fontFamily":"system-ui,\"Segoe UI\",Roboto,Helvetica,Arial,sans-serif,\"Apple Color Emoji\",\"Segoe UI Emoji\"","height":"100vh","textAlign":"center","display":"flex","flexDirection":"column","alignItems":"center","justifyContent":"center"},"children":["$","div",null,{"children":[["$","style",null,{"dangerouslySetInnerHTML":{"__html":"body{color:#000;background:#fff;margin:0}.next-error-h1{border-right:1px solid rgba(0,0,0,.3)}@media (prefers-color-scheme:dark){body{color:#fff;background:#000}.next-error-h1{border-right:1px solid rgba(255,255,255,.3)}}"}}],["$","h1",null,{"className":"next-error-h1","style":{"display":"inline-block","margin":"0 20px 0 0","padding":"0 23px 0 0","fontSize":24,"fontWeight":500,"verticalAlign":"top","lineHeight":"49px"},"children":"404"}],["$","div",null,{"style":{"display":"inline-block"},"children":["$","h2",null,{"style":{"fontSize":14,"fontWeight":400,"lineHeight":"49px","margin":0},"children":"This page could not be found."}]}]]}]}]],"notFoundStyles":[]}]]}]}]],null],null],["$L6",null]]]]
|
||||
6:[["$","meta","0",{"name":"viewport","content":"width=device-width, initial-scale=1"}],["$","meta","1",{"charSet":"utf-8"}],["$","title","2",{"children":"无人直播系统 · live.local"}],["$","meta","3",{"name":"description","content":"Linux ARM/x86 一键部署的无人直播控制台:YouTube 转播、TikTok HDMI、SRS、Neko 与系统服务"}],["$","link","4",{"rel":"icon","href":"/favicon.ico","type":"image/x-icon","sizes":"16x16"}]]
|
||||
1:null
|
||||
|
||||
File diff suppressed because one or more lines are too long
@ -2,6 +2,6 @@
|
||||
3:I[4825,["335","static/chunks/335-15aa194ced88957b.js","653","static/chunks/653-15975e374f8e28da.js","6","static/chunks/app/shellcrash/page-af8576bff9fa13fc.js"],"default",1]
|
||||
4:I[176,[],""]
|
||||
5:I[9414,[],""]
|
||||
0:["xYg2qS760UEpBRHWcTFN5",[[["",{"children":["shellcrash",{"children":["__PAGE__",{}]}]},"$undefined","$undefined",true],["",{"children":["shellcrash",{"children":["__PAGE__",{},[["$L1",["$","$L2",null,{"props":{"params":{},"searchParams":{}},"Component":"$3"}],null],null],null]},[null,["$","$L4",null,{"parallelRouterKey":"children","segmentPath":["children","shellcrash","children"],"error":"$undefined","errorStyles":"$undefined","errorScripts":"$undefined","template":["$","$L5",null,{}],"templateStyles":"$undefined","templateScripts":"$undefined","notFound":"$undefined","notFoundStyles":"$undefined"}]],null]},[[[["$","link","0",{"rel":"stylesheet","href":"/_next/static/css/27b4d6b789fddb24.css","precedence":"next","crossOrigin":"$undefined"}],["$","link","1",{"rel":"stylesheet","href":"/_next/static/css/f72551e7a5dadbbb.css","precedence":"next","crossOrigin":"$undefined"}]],["$","html",null,{"lang":"zh-CN","data-theme":"dark","suppressHydrationWarning":true,"children":["$","body",null,{"className":"__variable_1e4310 __variable_c3aa02 font-sans antialiased","children":[["$","div",null,{"className":"app-bg-layer","aria-hidden":true}],["$","$L4",null,{"parallelRouterKey":"children","segmentPath":["children"],"error":"$undefined","errorStyles":"$undefined","errorScripts":"$undefined","template":["$","$L5",null,{}],"templateStyles":"$undefined","templateScripts":"$undefined","notFound":[["$","title",null,{"children":"404: This page could not be found."}],["$","div",null,{"style":{"fontFamily":"system-ui,\"Segoe UI\",Roboto,Helvetica,Arial,sans-serif,\"Apple Color Emoji\",\"Segoe UI Emoji\"","height":"100vh","textAlign":"center","display":"flex","flexDirection":"column","alignItems":"center","justifyContent":"center"},"children":["$","div",null,{"children":[["$","style",null,{"dangerouslySetInnerHTML":{"__html":"body{color:#000;background:#fff;margin:0}.next-error-h1{border-right:1px solid rgba(0,0,0,.3)}@media (prefers-color-scheme:dark){body{color:#fff;background:#000}.next-error-h1{border-right:1px solid rgba(255,255,255,.3)}}"}}],["$","h1",null,{"className":"next-error-h1","style":{"display":"inline-block","margin":"0 20px 0 0","padding":"0 23px 0 0","fontSize":24,"fontWeight":500,"verticalAlign":"top","lineHeight":"49px"},"children":"404"}],["$","div",null,{"style":{"display":"inline-block"},"children":["$","h2",null,{"style":{"fontSize":14,"fontWeight":400,"lineHeight":"49px","margin":0},"children":"This page could not be found."}]}]]}]}]],"notFoundStyles":[]}]]}]}]],null],null],["$L6",null]]]]
|
||||
0:["93noLwLTiZ-nO6dg8JRLS",[[["",{"children":["shellcrash",{"children":["__PAGE__",{}]}]},"$undefined","$undefined",true],["",{"children":["shellcrash",{"children":["__PAGE__",{},[["$L1",["$","$L2",null,{"props":{"params":{},"searchParams":{}},"Component":"$3"}],null],null],null]},[null,["$","$L4",null,{"parallelRouterKey":"children","segmentPath":["children","shellcrash","children"],"error":"$undefined","errorStyles":"$undefined","errorScripts":"$undefined","template":["$","$L5",null,{}],"templateStyles":"$undefined","templateScripts":"$undefined","notFound":"$undefined","notFoundStyles":"$undefined"}]],null]},[[[["$","link","0",{"rel":"stylesheet","href":"/_next/static/css/27b4d6b789fddb24.css","precedence":"next","crossOrigin":"$undefined"}],["$","link","1",{"rel":"stylesheet","href":"/_next/static/css/7e3b6f8d9077dbc2.css","precedence":"next","crossOrigin":"$undefined"}]],["$","html",null,{"lang":"zh-CN","data-theme":"dark","suppressHydrationWarning":true,"children":["$","body",null,{"className":"__variable_1e4310 __variable_c3aa02 font-sans antialiased","children":[["$","div",null,{"className":"app-bg-layer","aria-hidden":true}],["$","$L4",null,{"parallelRouterKey":"children","segmentPath":["children"],"error":"$undefined","errorStyles":"$undefined","errorScripts":"$undefined","template":["$","$L5",null,{}],"templateStyles":"$undefined","templateScripts":"$undefined","notFound":[["$","title",null,{"children":"404: This page could not be found."}],["$","div",null,{"style":{"fontFamily":"system-ui,\"Segoe UI\",Roboto,Helvetica,Arial,sans-serif,\"Apple Color Emoji\",\"Segoe UI Emoji\"","height":"100vh","textAlign":"center","display":"flex","flexDirection":"column","alignItems":"center","justifyContent":"center"},"children":["$","div",null,{"children":[["$","style",null,{"dangerouslySetInnerHTML":{"__html":"body{color:#000;background:#fff;margin:0}.next-error-h1{border-right:1px solid rgba(0,0,0,.3)}@media (prefers-color-scheme:dark){body{color:#fff;background:#000}.next-error-h1{border-right:1px solid rgba(255,255,255,.3)}}"}}],["$","h1",null,{"className":"next-error-h1","style":{"display":"inline-block","margin":"0 20px 0 0","padding":"0 23px 0 0","fontSize":24,"fontWeight":500,"verticalAlign":"top","lineHeight":"49px"},"children":"404"}],["$","div",null,{"style":{"display":"inline-block"},"children":["$","h2",null,{"style":{"fontSize":14,"fontWeight":400,"lineHeight":"49px","margin":0},"children":"This page could not be found."}]}]]}]}]],"notFoundStyles":[]}]]}]}]],null],null],["$L6",null]]]]
|
||||
6:[["$","meta","0",{"name":"viewport","content":"width=device-width, initial-scale=1"}],["$","meta","1",{"charSet":"utf-8"}],["$","title","2",{"children":"无人直播系统 · live.local"}],["$","meta","3",{"name":"description","content":"Linux ARM/x86 一键部署的无人直播控制台:YouTube 转播、TikTok HDMI、SRS、Neko 与系统服务"}],["$","link","4",{"rel":"icon","href":"/favicon.ico","type":"image/x-icon","sizes":"16x16"}]]
|
||||
1:null
|
||||
|
||||
File diff suppressed because one or more lines are too long
@ -1,7 +1,7 @@
|
||||
2:I[7523,[],"ClientPageRoot"]
|
||||
3:I[8307,["335","static/chunks/335-15aa194ced88957b.js","270","static/chunks/270-ee064b8a2cee7977.js","653","static/chunks/653-15975e374f8e28da.js","371","static/chunks/371-bddad8b92b1ea180.js","851","static/chunks/app/youtube-events/page-6cfcc966a308c73f.js"],"default",1]
|
||||
3:I[8307,["335","static/chunks/335-15aa194ced88957b.js","270","static/chunks/270-ee064b8a2cee7977.js","653","static/chunks/653-15975e374f8e28da.js","371","static/chunks/371-3c69d09687afa990.js","851","static/chunks/app/youtube-events/page-6cfcc966a308c73f.js"],"default",1]
|
||||
4:I[176,[],""]
|
||||
5:I[9414,[],""]
|
||||
0:["xYg2qS760UEpBRHWcTFN5",[[["",{"children":["youtube-events",{"children":["__PAGE__",{}]}]},"$undefined","$undefined",true],["",{"children":["youtube-events",{"children":["__PAGE__",{},[["$L1",["$","$L2",null,{"props":{"params":{},"searchParams":{}},"Component":"$3"}],null],null],null]},[null,["$","$L4",null,{"parallelRouterKey":"children","segmentPath":["children","youtube-events","children"],"error":"$undefined","errorStyles":"$undefined","errorScripts":"$undefined","template":["$","$L5",null,{}],"templateStyles":"$undefined","templateScripts":"$undefined","notFound":"$undefined","notFoundStyles":"$undefined"}]],null]},[[[["$","link","0",{"rel":"stylesheet","href":"/_next/static/css/27b4d6b789fddb24.css","precedence":"next","crossOrigin":"$undefined"}],["$","link","1",{"rel":"stylesheet","href":"/_next/static/css/f72551e7a5dadbbb.css","precedence":"next","crossOrigin":"$undefined"}]],["$","html",null,{"lang":"zh-CN","data-theme":"dark","suppressHydrationWarning":true,"children":["$","body",null,{"className":"__variable_1e4310 __variable_c3aa02 font-sans antialiased","children":[["$","div",null,{"className":"app-bg-layer","aria-hidden":true}],["$","$L4",null,{"parallelRouterKey":"children","segmentPath":["children"],"error":"$undefined","errorStyles":"$undefined","errorScripts":"$undefined","template":["$","$L5",null,{}],"templateStyles":"$undefined","templateScripts":"$undefined","notFound":[["$","title",null,{"children":"404: This page could not be found."}],["$","div",null,{"style":{"fontFamily":"system-ui,\"Segoe UI\",Roboto,Helvetica,Arial,sans-serif,\"Apple Color Emoji\",\"Segoe UI Emoji\"","height":"100vh","textAlign":"center","display":"flex","flexDirection":"column","alignItems":"center","justifyContent":"center"},"children":["$","div",null,{"children":[["$","style",null,{"dangerouslySetInnerHTML":{"__html":"body{color:#000;background:#fff;margin:0}.next-error-h1{border-right:1px solid rgba(0,0,0,.3)}@media (prefers-color-scheme:dark){body{color:#fff;background:#000}.next-error-h1{border-right:1px solid rgba(255,255,255,.3)}}"}}],["$","h1",null,{"className":"next-error-h1","style":{"display":"inline-block","margin":"0 20px 0 0","padding":"0 23px 0 0","fontSize":24,"fontWeight":500,"verticalAlign":"top","lineHeight":"49px"},"children":"404"}],["$","div",null,{"style":{"display":"inline-block"},"children":["$","h2",null,{"style":{"fontSize":14,"fontWeight":400,"lineHeight":"49px","margin":0},"children":"This page could not be found."}]}]]}]}]],"notFoundStyles":[]}]]}]}]],null],null],["$L6",null]]]]
|
||||
0:["93noLwLTiZ-nO6dg8JRLS",[[["",{"children":["youtube-events",{"children":["__PAGE__",{}]}]},"$undefined","$undefined",true],["",{"children":["youtube-events",{"children":["__PAGE__",{},[["$L1",["$","$L2",null,{"props":{"params":{},"searchParams":{}},"Component":"$3"}],null],null],null]},[null,["$","$L4",null,{"parallelRouterKey":"children","segmentPath":["children","youtube-events","children"],"error":"$undefined","errorStyles":"$undefined","errorScripts":"$undefined","template":["$","$L5",null,{}],"templateStyles":"$undefined","templateScripts":"$undefined","notFound":"$undefined","notFoundStyles":"$undefined"}]],null]},[[[["$","link","0",{"rel":"stylesheet","href":"/_next/static/css/27b4d6b789fddb24.css","precedence":"next","crossOrigin":"$undefined"}],["$","link","1",{"rel":"stylesheet","href":"/_next/static/css/7e3b6f8d9077dbc2.css","precedence":"next","crossOrigin":"$undefined"}]],["$","html",null,{"lang":"zh-CN","data-theme":"dark","suppressHydrationWarning":true,"children":["$","body",null,{"className":"__variable_1e4310 __variable_c3aa02 font-sans antialiased","children":[["$","div",null,{"className":"app-bg-layer","aria-hidden":true}],["$","$L4",null,{"parallelRouterKey":"children","segmentPath":["children"],"error":"$undefined","errorStyles":"$undefined","errorScripts":"$undefined","template":["$","$L5",null,{}],"templateStyles":"$undefined","templateScripts":"$undefined","notFound":[["$","title",null,{"children":"404: This page could not be found."}],["$","div",null,{"style":{"fontFamily":"system-ui,\"Segoe UI\",Roboto,Helvetica,Arial,sans-serif,\"Apple Color Emoji\",\"Segoe UI Emoji\"","height":"100vh","textAlign":"center","display":"flex","flexDirection":"column","alignItems":"center","justifyContent":"center"},"children":["$","div",null,{"children":[["$","style",null,{"dangerouslySetInnerHTML":{"__html":"body{color:#000;background:#fff;margin:0}.next-error-h1{border-right:1px solid rgba(0,0,0,.3)}@media (prefers-color-scheme:dark){body{color:#fff;background:#000}.next-error-h1{border-right:1px solid rgba(255,255,255,.3)}}"}}],["$","h1",null,{"className":"next-error-h1","style":{"display":"inline-block","margin":"0 20px 0 0","padding":"0 23px 0 0","fontSize":24,"fontWeight":500,"verticalAlign":"top","lineHeight":"49px"},"children":"404"}],["$","div",null,{"style":{"display":"inline-block"},"children":["$","h2",null,{"style":{"fontSize":14,"fontWeight":400,"lineHeight":"49px","margin":0},"children":"This page could not be found."}]}]]}]}]],"notFoundStyles":[]}]]}]}]],null],null],["$L6",null]]]]
|
||||
6:[["$","meta","0",{"name":"viewport","content":"width=device-width, initial-scale=1"}],["$","meta","1",{"charSet":"utf-8"}],["$","title","2",{"children":"无人直播系统 · live.local"}],["$","meta","3",{"name":"description","content":"Linux ARM/x86 一键部署的无人直播控制台:YouTube 转播、TikTok HDMI、SRS、Neko 与系统服务"}],["$","link","4",{"rel":"icon","href":"/favicon.ico","type":"image/x-icon","sizes":"16x16"}]]
|
||||
1:null
|
||||
|
||||
File diff suppressed because one or more lines are too long
@ -1,7 +1,7 @@
|
||||
2:I[7523,[],"ClientPageRoot"]
|
||||
3:I[3211,["614","static/chunks/app/youtube-relay-log/page-44c22a5313590d69.js"],"default",1]
|
||||
3:I[673,["614","static/chunks/app/youtube-relay-log/page-ef6cbd6ed2424191.js"],"default",1]
|
||||
4:I[176,[],""]
|
||||
5:I[9414,[],""]
|
||||
0:["xYg2qS760UEpBRHWcTFN5",[[["",{"children":["youtube-relay-log",{"children":["__PAGE__",{}]}]},"$undefined","$undefined",true],["",{"children":["youtube-relay-log",{"children":["__PAGE__",{},[["$L1",["$","$L2",null,{"props":{"params":{},"searchParams":{}},"Component":"$3"}],null],null],null]},[null,["$","$L4",null,{"parallelRouterKey":"children","segmentPath":["children","youtube-relay-log","children"],"error":"$undefined","errorStyles":"$undefined","errorScripts":"$undefined","template":["$","$L5",null,{}],"templateStyles":"$undefined","templateScripts":"$undefined","notFound":"$undefined","notFoundStyles":"$undefined"}]],null]},[[[["$","link","0",{"rel":"stylesheet","href":"/_next/static/css/27b4d6b789fddb24.css","precedence":"next","crossOrigin":"$undefined"}],["$","link","1",{"rel":"stylesheet","href":"/_next/static/css/f72551e7a5dadbbb.css","precedence":"next","crossOrigin":"$undefined"}]],["$","html",null,{"lang":"zh-CN","data-theme":"dark","suppressHydrationWarning":true,"children":["$","body",null,{"className":"__variable_1e4310 __variable_c3aa02 font-sans antialiased","children":[["$","div",null,{"className":"app-bg-layer","aria-hidden":true}],["$","$L4",null,{"parallelRouterKey":"children","segmentPath":["children"],"error":"$undefined","errorStyles":"$undefined","errorScripts":"$undefined","template":["$","$L5",null,{}],"templateStyles":"$undefined","templateScripts":"$undefined","notFound":[["$","title",null,{"children":"404: This page could not be found."}],["$","div",null,{"style":{"fontFamily":"system-ui,\"Segoe UI\",Roboto,Helvetica,Arial,sans-serif,\"Apple Color Emoji\",\"Segoe UI Emoji\"","height":"100vh","textAlign":"center","display":"flex","flexDirection":"column","alignItems":"center","justifyContent":"center"},"children":["$","div",null,{"children":[["$","style",null,{"dangerouslySetInnerHTML":{"__html":"body{color:#000;background:#fff;margin:0}.next-error-h1{border-right:1px solid rgba(0,0,0,.3)}@media (prefers-color-scheme:dark){body{color:#fff;background:#000}.next-error-h1{border-right:1px solid rgba(255,255,255,.3)}}"}}],["$","h1",null,{"className":"next-error-h1","style":{"display":"inline-block","margin":"0 20px 0 0","padding":"0 23px 0 0","fontSize":24,"fontWeight":500,"verticalAlign":"top","lineHeight":"49px"},"children":"404"}],["$","div",null,{"style":{"display":"inline-block"},"children":["$","h2",null,{"style":{"fontSize":14,"fontWeight":400,"lineHeight":"49px","margin":0},"children":"This page could not be found."}]}]]}]}]],"notFoundStyles":[]}]]}]}]],null],null],["$L6",null]]]]
|
||||
0:["93noLwLTiZ-nO6dg8JRLS",[[["",{"children":["youtube-relay-log",{"children":["__PAGE__",{}]}]},"$undefined","$undefined",true],["",{"children":["youtube-relay-log",{"children":["__PAGE__",{},[["$L1",["$","$L2",null,{"props":{"params":{},"searchParams":{}},"Component":"$3"}],null],null],null]},[null,["$","$L4",null,{"parallelRouterKey":"children","segmentPath":["children","youtube-relay-log","children"],"error":"$undefined","errorStyles":"$undefined","errorScripts":"$undefined","template":["$","$L5",null,{}],"templateStyles":"$undefined","templateScripts":"$undefined","notFound":"$undefined","notFoundStyles":"$undefined"}]],null]},[[[["$","link","0",{"rel":"stylesheet","href":"/_next/static/css/27b4d6b789fddb24.css","precedence":"next","crossOrigin":"$undefined"}],["$","link","1",{"rel":"stylesheet","href":"/_next/static/css/7e3b6f8d9077dbc2.css","precedence":"next","crossOrigin":"$undefined"}]],["$","html",null,{"lang":"zh-CN","data-theme":"dark","suppressHydrationWarning":true,"children":["$","body",null,{"className":"__variable_1e4310 __variable_c3aa02 font-sans antialiased","children":[["$","div",null,{"className":"app-bg-layer","aria-hidden":true}],["$","$L4",null,{"parallelRouterKey":"children","segmentPath":["children"],"error":"$undefined","errorStyles":"$undefined","errorScripts":"$undefined","template":["$","$L5",null,{}],"templateStyles":"$undefined","templateScripts":"$undefined","notFound":[["$","title",null,{"children":"404: This page could not be found."}],["$","div",null,{"style":{"fontFamily":"system-ui,\"Segoe UI\",Roboto,Helvetica,Arial,sans-serif,\"Apple Color Emoji\",\"Segoe UI Emoji\"","height":"100vh","textAlign":"center","display":"flex","flexDirection":"column","alignItems":"center","justifyContent":"center"},"children":["$","div",null,{"children":[["$","style",null,{"dangerouslySetInnerHTML":{"__html":"body{color:#000;background:#fff;margin:0}.next-error-h1{border-right:1px solid rgba(0,0,0,.3)}@media (prefers-color-scheme:dark){body{color:#fff;background:#000}.next-error-h1{border-right:1px solid rgba(255,255,255,.3)}}"}}],["$","h1",null,{"className":"next-error-h1","style":{"display":"inline-block","margin":"0 20px 0 0","padding":"0 23px 0 0","fontSize":24,"fontWeight":500,"verticalAlign":"top","lineHeight":"49px"},"children":"404"}],["$","div",null,{"style":{"display":"inline-block"},"children":["$","h2",null,{"style":{"fontSize":14,"fontWeight":400,"lineHeight":"49px","margin":0},"children":"This page could not be found."}]}]]}]}]],"notFoundStyles":[]}]]}]}]],null],null],["$L6",null]]]]
|
||||
6:[["$","meta","0",{"name":"viewport","content":"width=device-width, initial-scale=1"}],["$","meta","1",{"charSet":"utf-8"}],["$","title","2",{"children":"无人直播系统 · live.local"}],["$","meta","3",{"name":"description","content":"Linux ARM/x86 一键部署的无人直播控制台:YouTube 转播、TikTok HDMI、SRS、Neko 与系统服务"}],["$","link","4",{"rel":"icon","href":"/favicon.ico","type":"image/x-icon","sizes":"16x16"}]]
|
||||
1:null
|
||||
|
||||
@ -112,6 +112,7 @@ from src.youtube_relay_log import (
|
||||
get_relay_session,
|
||||
import_relay_sessions_for_process,
|
||||
list_relay_sessions,
|
||||
summarize_relay_sessions,
|
||||
sync_relay_from_recent_log,
|
||||
)
|
||||
from src.youtube_quality_guard import build_youtube_quality_guard_report
|
||||
@ -2314,6 +2315,26 @@ async def hub_youtube_relay_sessions(
|
||||
)
|
||||
|
||||
|
||||
@app.get("/hub/youtube/relay/sessions/stats", include_in_schema=False)
|
||||
async def hub_youtube_relay_sessions_stats(
|
||||
process: str = "",
|
||||
q: str = "",
|
||||
date_from: str = "",
|
||||
date_to: str = "",
|
||||
status: str = "",
|
||||
top_anchors: int = 20,
|
||||
):
|
||||
return await asyncio.to_thread(
|
||||
summarize_relay_sessions,
|
||||
process=process,
|
||||
q=q,
|
||||
date_from=date_from,
|
||||
date_to=date_to,
|
||||
status=status,
|
||||
top_anchors=top_anchors,
|
||||
)
|
||||
|
||||
|
||||
@app.get("/hub/youtube/relay/sessions/{session_id}", include_in_schema=False)
|
||||
async def hub_youtube_relay_session_detail(session_id: str):
|
||||
session = await asyncio.to_thread(get_relay_session, session_id)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user