This commit is contained in:
root
2026-05-17 14:06:06 +00:00
parent a3e8a4a96c
commit a91188ca68
29 changed files with 442 additions and 58 deletions

View File

@@ -12,6 +12,12 @@ import {
parseYoutubeStreamKeySuffix,
type YoutubeIniFields,
} from "@/lib/youtubeConfigUtils";
import {
extractNekoBrowserLinks,
formatNekoPorts,
resolveNekoBrowserLink,
type QuickLinkMap,
} from "@/lib/nekoLinks";
import type { PortalNavTarget } from "@/components/live-product/LivePipelineStrip";
import { LivePipelineStrip } from "@/components/live-product/LivePipelineStrip";
import { LiveProcessLiveLogCard } from "@/components/live-product/LiveProcessLiveLogCard";
@@ -131,7 +137,6 @@ const PRO_PM2_RESERVED = new Set(["tiktok", "obs", "web"]);
/** UI 暂时隐藏「多频道 Pro」切换(DOM 与逻辑保留,改 false 即可恢复) */
const HIDE_YOUTUBE_MULTI_PRO_TOGGLE = false;
type QuickLinkMap = Record<string, string>;
type ProLaneDraft = {
name: string;
streamKey: string;
@@ -1036,14 +1041,18 @@ export function LiveYoutubeUnmannedView({
const currentUrlDraft = mode === "single" ? urlConfig : proUrlDraft;
const currentUrlCount = useMemo(() => nonCommentUrlLinesOf(currentUrlDraft).length, [currentUrlDraft]);
const currentDouyinCount = useMemo(() => extractDouyinLiveUrls(currentUrlDraft).length, [currentUrlDraft]);
const nekoLinks = useMemo(() => extractNekoBrowserLinks(quickLinks), [quickLinks]);
const selectedNeko = useMemo(
() => resolveNekoBrowserLink(nekoLinks, mode === "pro" && active ? channels.findIndex((row) => row.id === active.id) : 0),
[active, channels, mode, nekoLinks],
);
const selectedNekoUrl = selectedNeko.link
? normalizeBrowserReachableHttpUrl(selectedNeko.link.url)
: normalizeBrowserReachableHttpUrl("http://live.local:9200/");
const nekoPortsLabel = useMemo(() => formatNekoPorts(nekoLinks), [nekoLinks]);
const laneQuickLinks = useMemo(
() =>
[
quickLinks?.neko_browser,
quickLinks?.chromium_remote_debug,
quickLinks?.srs_api,
].filter((value): value is string => !!value),
[quickLinks],
() => [selectedNeko.link?.url, quickLinks?.chromium_remote_debug, quickLinks?.srs_api].filter((value): value is string => !!value),
[quickLinks, selectedNeko.link?.url],
);
const flushProChannelsBeforeRun = useCallback(
@@ -1164,9 +1173,11 @@ export function LiveYoutubeUnmannedView({
},
{
label: "Neko",
sub: t("Chromium 工作室", "Chromium"),
sub: selectedNeko.link
? `${t("Chromium 工作室", "Chromium studio")} · ${selectedNeko.link.label}`
: t("Chromium 工作室", "Chromium studio"),
gradient: "from-emerald-400 to-teal-500",
openUrl: normalizeBrowserReachableHttpUrl(quickLinks?.neko_browser || "http://live.local:9200/"),
openUrl: selectedNekoUrl,
},
]}
/>
@@ -1219,16 +1230,36 @@ export function LiveYoutubeUnmannedView({
{laneQuickLinks.length ? (
<div className="flex flex-wrap gap-2">
{quickLinks?.neko_browser ? (
{selectedNeko.link ? (
<a
href={normalizeBrowserReachableHttpUrl(quickLinks.neko_browser)}
href={selectedNekoUrl}
target="_blank"
rel="noreferrer"
className="rounded-lg border border-emerald-500/20 bg-emerald-500/10 px-3 py-2 text-xs text-emerald-100 ring-1 ring-emerald-500/20"
>
{t("打开 Neko 工作室", "Open Neko studio")}
{t("打开当前线路 Neko 工作室", "Open lane Neko studio")}
</a>
) : null}
{nekoLinks.length > 1 ? (
<div className="flex flex-wrap gap-2">
{nekoLinks.map((link) => (
<a
key={link.key}
href={normalizeBrowserReachableHttpUrl(link.url)}
target="_blank"
rel="noreferrer"
className={`rounded-lg border px-3 py-2 text-xs ring-1 ${
selectedNeko.link?.id === link.id
? "border-emerald-400/30 bg-emerald-500/15 text-emerald-50 ring-emerald-400/25"
: "border-white/10 bg-white/5 text-zinc-200 ring-white/10"
}`}
>
{link.label}
{link.port ? ` :${link.port}` : ""}
</a>
))}
</div>
) : null}
{quickLinks?.chromium_remote_debug ? (
<a
href={normalizeBrowserReachableHttpUrl(quickLinks.chromium_remote_debug)}
@@ -1338,6 +1369,11 @@ export function LiveYoutubeUnmannedView({
<p className="mt-1 text-[11px] text-zinc-500">
{t("对齐桌面端:每路独立 URL / youtube 配置文件;点左侧信息切换编辑,右侧控制进程。", "Per-lane config files like desktop; click row info to edit, use right-side controls for PM2.")}
</p>
{nekoPortsLabel ? (
<p className="mt-2 text-[11px] text-zinc-500">
{t("Neko 实例", "Neko instances")}: {nekoPortsLabel}
</p>
) : null}
<div className="mt-3 max-h-[min(24rem,55vh)] space-y-2 overflow-y-auto pr-1">
{channels.map((c) => {
const pm = resolveChannelPm2(c);
@@ -1349,6 +1385,8 @@ export function LiveYoutubeUnmannedView({
const suf = parseYoutubeStreamKeySuffix(`key = ${c.streamKey ?? ""}`);
const sel = activeCh === c.id;
const rowOnline = pm2StatusOnline(st);
const laneIndex = channels.findIndex((row) => row.id === c.id);
const laneNeko = resolveNekoBrowserLink(nekoLinks, laneIndex).link;
return (
<div
key={c.id}
@@ -1373,6 +1411,11 @@ export function LiveYoutubeUnmannedView({
>
{businessStatusLabel(row, t)}
</span>
{laneNeko ? (
<span className="shrink-0 rounded-md bg-emerald-500/15 px-2 py-0.5 text-[10px] font-medium text-emerald-100 ring-1 ring-emerald-500/25">
{laneNeko.label}
</span>
) : null}
</div>
<div className="mt-0.5 flex flex-wrap items-center gap-x-2 gap-y-0.5 font-mono text-[10px] text-zinc-500">
<span>