This commit is contained in:
eric
2026-03-28 17:16:38 -05:00
parent 37ab25911a
commit 46fb194a02
20 changed files with 962 additions and 331 deletions

View File

@@ -9,6 +9,7 @@ import {
parseYoutubeStreamKeySuffix,
type YoutubeIniFields,
} from "@/lib/youtubeConfigUtils";
import { LiveProcessLiveLogCard } from "@/components/live-product/LiveProcessLiveLogCard";
import {
defaultPm2NameForChannel,
loadYoutubeProChannels,
@@ -37,6 +38,10 @@ type Props = {
setUrlConfig: (v: string) => void;
douyinUrl: string;
setDouyinUrl: (v: string) => void;
businessYoutubeKey: string;
setBusinessYoutubeKey: (v: string) => void;
syncYoutubeIni: boolean;
setSyncYoutubeIni: (v: boolean) => void;
onRunProcess: (a: "start" | "stop" | "restart") => void;
onSaveUrlConfig: (content?: string) => void;
onSaveBusinessMeta: () => void;
@@ -53,6 +58,10 @@ export function LiveYoutubeUnmannedView({
setUrlConfig,
douyinUrl,
setDouyinUrl,
businessYoutubeKey,
setBusinessYoutubeKey,
syncYoutubeIni,
setSyncYoutubeIni,
onRunProcess,
onSaveUrlConfig,
onSaveBusinessMeta,
@@ -169,7 +178,8 @@ export function LiveYoutubeUnmannedView({
setYtIniLoading(true);
setYtIniStatus(null);
try {
await fetchJson("/save_config", {
const params = new URLSearchParams({ process: currentProc });
await fetchJson(`/save_config?${params}`, {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({ content }),
@@ -236,8 +246,8 @@ export function LiveYoutubeUnmannedView({
</h2>
<p className="mt-0.5 text-xs text-zinc-500">
{t(
"对齐桌面客户端「直播」页:单路配置与多路 Pro 编排,无账号登录。",
"Desktop-style live control: single or Pro lanes, no account login.",
"对齐 d2y 桌面懒人包「直播」页:单路 / Pro、无 Google 登录;Linux 推荐 PM2 或 systemd 托管下方所选进程。底部为实时日志(轮询 PM2/本地日志文件)。",
"Like d2y desktop: single/Pro, no Google login; on Linux use PM2/systemd for the selected process. Bottom: live logs from PM2/local log files.",
)}
</p>
</div>
@@ -497,12 +507,20 @@ export function LiveYoutubeUnmannedView({
{t("将本线路密钥写入服务器 youtube.ini", "Push key → server youtube.ini")}
</button>
</div>
<p className="text-[11px] text-amber-200/70">
{t(
"服务器仅一份 youtube.ini:推送会覆盖;多路并行请在板上为每路配置独立 PM2 与独立 config 目录,或轮流推送。",
"Server has one youtube.ini; overwrite. For true parallel lanes use separate PM2 + config dirs on the host.",
)}
</p>
<div
role="alert"
className="rounded-xl border border-rose-500/45 bg-rose-950/35 p-3 ring-1 ring-rose-500/25"
>
<p className="text-xs font-semibold text-rose-100/95">
{t("覆盖警告", "Overwrite warning")}
</p>
<p className="mt-1 text-[11px] leading-relaxed text-rose-100/80">
{t(
"服务器上通常只有一份 youtube.ini:点此推送会立刻覆盖其中 key=;多路并行请在板上为每路使用独立 PM2 与独立 config 目录,或轮流推送后再开播。",
"Hosts usually have a single youtube.ini: this overwrites key=. For parallel lanes use separate PM2 + config dirs per lane, or push then start one at a time.",
)}
</p>
</div>
<textarea
className="h-16 w-full resize-y rounded-xl border border-white/10 bg-black/40 p-3 text-xs text-zinc-300"
value={active.notes ?? ""}
@@ -561,14 +579,45 @@ export function LiveYoutubeUnmannedView({
)}
<div className="rounded-2xl border border-white/[0.08] bg-zinc-950/50 p-6">
<h3 className="text-sm font-semibold text-white">{t("抖音源站(业务元数据)", "Douyin source (metadata)")}</h3>
<p className="mt-1 text-xs text-zinc-500">{t("写入 business JSON,供运维脚本读取。", "business.json for automation.")}</p>
<h3 className="text-sm font-semibold text-white">{t("业务元数据(配置中心)", "Hub business metadata")}</h3>
<p className="mt-1 text-xs text-zinc-500">
{t(
"写入 business/douyinyoutube.json;可与下方选项同步到仓库 config/youtube.ini。",
"Writes business/douyinyoutube.json; optional sync to config/youtube.ini.",
)}
</p>
<label className="mt-4 block text-xs text-zinc-400">{t("抖音直播间 URL", "Douyin live URL")}</label>
<input
className="mt-4 w-full rounded-xl border border-white/10 bg-black/40 px-4 py-3 text-sm"
className="mt-1 w-full rounded-xl border border-white/10 bg-black/40 px-4 py-3 text-sm"
value={douyinUrl}
onChange={(e) => setDouyinUrl(e.target.value)}
placeholder="https://live.douyin.com/..."
/>
<label className="mt-3 block text-xs text-zinc-400">
{t("YouTube 串流密钥(声明式 youtube_rtmp_key)", "YouTube stream key (declarative)")}
</label>
<input
className="mt-1 w-full rounded-xl border border-white/10 bg-black/40 px-4 py-3 font-mono text-sm text-zinc-200"
spellCheck={false}
autoComplete="off"
value={businessYoutubeKey}
onChange={(e) => setBusinessYoutubeKey(e.target.value)}
placeholder="xxxx-xxxx… 或完整 rtmp(s) URL"
/>
<label className="mt-3 flex cursor-pointer items-start gap-2 text-xs text-zinc-300">
<input
type="checkbox"
className="mt-0.5 rounded border-white/20 bg-black/40"
checked={syncYoutubeIni}
onChange={(e) => setSyncYoutubeIni(e.target.checked)}
/>
<span>
{t(
"同时写入本仓库(进程工作目录)下的 config/youtube.ini 中的 key=(需 Web 已配置 repo 根目录)",
"Also write key= to repo config/youtube.ini (FastAPI repo root must match this deployment).",
)}
</span>
</label>
<button
type="button"
disabled={lock}
@@ -607,6 +656,15 @@ export function LiveYoutubeUnmannedView({
<p className="mt-4 text-xs text-zinc-600">{t("Pro 模式:请使用「当前线路」中的地址列表。", "Use lane URL list in Pro mode.")}</p>
)}
</div>
<LiveProcessLiveLogCard
t={t}
currentProc={currentProc}
fetchJson={fetchJson}
urlListText={mode === "single" ? urlConfig : proUrlDraft}
keySuffixUi={keySuffixUi}
showKeyRow
/>
</div>
);
}