Fix Pro live Start button staying active while the process is already running.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
eric 2026-07-31 06:02:25 -05:00
parent 39497fa29a
commit 9e267366ef

View File

@ -220,7 +220,9 @@ function isLivePushingRow(row?: LiveProcRow): boolean {
}
function procStartBlocked(row?: LiveProcRow): boolean {
return isLivePushingRow(row);
// PM2 already online (waiting_source / monitoring / …) must also lock Start —
// otherwise Pro lane “开始” stays clickable after start until ffmpeg is_pushing.
return isLivePushingRow(row) || pm2StatusOnline(row?.process_status);
}
function proLaneStatusLabel(row: LiveProcRow | undefined, t: TFn): string {
@ -696,7 +698,8 @@ function LiveStreamActionBtn({
const actionForBusy = busyKind ?? kind;
const loading = !!(forThisProc && pb.action === actionForBusy);
const siblingBusy = !!(forThisProc && pb.action !== actionForBusy);
const blockStart = kind === "start" && pushing;
// Start locks on pushing OR process online (waiting source still counts as started).
const blockStart = kind === "start" && (pushing || online);
const blockStop = kind === "stop" && !online;
const blockRestart = kind === "restart" && !online;
const blocked = blockStart || blockStop || blockRestart;
@ -709,7 +712,11 @@ function LiveStreamActionBtn({
return;
}
if (blockStart) {
notify(t("已在推流中,无需重复开始", "Already pushing"));
notify(
pushing
? t("已在推流中,无需重复开始", "Already pushing")
: t("进程已在运行,请用「停止」或「重新开始」", "Already running — use Stop or Restart"),
);
return;
}
if (blockStop) {