fix: 一次保存学习配置,改代理后重开任务
This commit is contained in:
@@ -252,6 +252,16 @@ async function probeAll() {
|
||||
setError("没有测出延迟。");
|
||||
return;
|
||||
}
|
||||
for (let attempt = 0; attempt < 120; attempt += 1) {
|
||||
const status = await fetch("/api/admin/proxies/probe");
|
||||
const body: unknown = await status.json().catch(() => ({}));
|
||||
if (!status.ok || !isRecord(body)) break;
|
||||
if (body.running !== true) {
|
||||
if (typeof body.error === "string" && body.error) setError(body.error);
|
||||
break;
|
||||
}
|
||||
await new Promise((resolve) => window.setTimeout(resolve, 500));
|
||||
}
|
||||
await load();
|
||||
} catch {
|
||||
setError("没有测出延迟。");
|
||||
|
||||
@@ -378,9 +378,15 @@ async function saveSchedule() {
|
||||
scheduleSaving.value = true;
|
||||
scheduleError.value = "";
|
||||
try {
|
||||
await putJson("/api/settings/monthly-target", { monthly_target: target }, "没有保存每月目标。");
|
||||
await putJson("/api/settings/study-start", { day, hour, minute, second, enabled: scheduleEnabled.value }, "没有保存定时启动。");
|
||||
await putJson("/api/settings/course-workers", { workers }, "没有保存同时学习课程数。");
|
||||
await putJson("/api/settings/study", {
|
||||
monthly_target: target,
|
||||
day,
|
||||
hour,
|
||||
minute,
|
||||
second,
|
||||
enabled: scheduleEnabled.value,
|
||||
workers,
|
||||
}, "没有保存定时配置。");
|
||||
await loadStudyControl();
|
||||
} catch (exc) {
|
||||
scheduleError.value = exc instanceof Error ? exc.message : "没有保存。";
|
||||
|
||||
Reference in New Issue
Block a user