This commit is contained in:
root
2026-05-17 05:52:35 +00:00
parent 03dc47a569
commit 71ea4da318
14 changed files with 26 additions and 16 deletions

View File

@@ -1290,6 +1290,7 @@ export default function LiveControlApp() {
fetchJson={fetchJson}
liveProcesses={processRows.length ? processRows : (dash?.live?.processes ?? [])}
notify={notify}
quickLinks={ql}
onNavigate={(target: PortalNavTarget) => setView(target)}
/>
) : null}

View File

@@ -553,6 +553,10 @@ export function LiveYoutubeUnmannedView({
const active = channels.find((c) => c.id === activeCh) || channels[0];
const activeSavedUrlDraft = useMemo(() => (active?.urlLines ?? "").trim(), [active?.urlLines]);
const activeUrlDirty = useMemo(
() => (active ? proUrlDraft !== (active.urlLines ?? "").trim() : false),
[active, proUrlDraft],
);
const activeLaneDraft = useMemo(
() => (active ? laneDrafts[active.id] ?? laneDraftFromChannel(active) : null),
[active, laneDrafts],
@@ -659,7 +663,9 @@ export function LiveYoutubeUnmannedView({
const setModePersist = useCallback(
(m: "single" | "pro") => {
if (m === "single" && mode === "pro" && active) {
persistChannels(channels.map((x) => (x.id === active.id ? { ...x, urlLines: proUrlDraft } : x)));
if (activeUrlDirty) {
persistChannels(channels.map((x) => (x.id === active.id ? { ...x, urlLines: proUrlDraft } : x)));
}
}
if (m === "pro" && channels.length) {
const first = channels[0];
@@ -691,6 +697,7 @@ export function LiveYoutubeUnmannedView({
[
mode,
active,
activeUrlDirty,
channels,
proUrlDraft,
ytFields.key,
@@ -704,7 +711,7 @@ export function LiveYoutubeUnmannedView({
const selectProChannel = useCallback(
(c: YoutubeProChannel) => {
if (active && mode === "pro") {
if (active && mode === "pro" && activeUrlDirty) {
persistChannels(channels.map((x) => (x.id === active.id ? { ...x, urlLines: proUrlDraft } : x)));
}
const u = (c.urlLines ?? "").trim();
@@ -712,7 +719,7 @@ export function LiveYoutubeUnmannedView({
setActiveCh(c.id);
setCurrentProc(resolveChannelPm2(c));
},
[active, mode, channels, proUrlDraft, setCurrentProc, persistChannels],
[active, activeUrlDirty, mode, channels, proUrlDraft, setCurrentProc, persistChannels],
);
useEffect(() => {
@@ -931,8 +938,10 @@ export function LiveYoutubeUnmannedView({
await Promise.resolve(onSaveUrlConfig(proUrlDraft, saved.pm2));
urlListDirtyRef.current = false;
setLaneStatus(t("线路与地址已保存", "Lane settings and URLs saved"));
} catch {
/* parent 已 toast */
} catch (e) {
const message = e instanceof Error ? e.message : String(e);
setLaneStatus(message);
notify(message);
} finally {
setLaneSaving(false);
}