mirror of
https://github.com/YuJunZhiXue/dsh-purge.git
synced 2026-11-28 10:10:22 +08:00
fix: 清洗不再写坏 YAML,检测更新失败能看见结果
Apply 会清掉 personaPrefix 空值后的缩进残段,避免 dsh 起不来;#5/#11 在官方已改句式时不再挡应用。检测更新改走带超时的接口,结果显示在按钮旁。 Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
1 parent
8b001c5803
commit
0d2a126205
4 files changed
+218
-49
No files matched your search
+24
-24
@@ -692,6 +692,30 @@ function installWebServer(ctx, cfg) {
|
||||
}
|
||||
},
|
||||
}, "dsh-purge: status");
|
||||
host.webServer.register({
|
||||
kind: "exact",
|
||||
path: "/dsh-purge/update",
|
||||
handler: async (request, response) => {
|
||||
if (request.method === "GET") {
|
||||
try {
|
||||
sendJson(response, 200, await updater.checkUpdate());
|
||||
} catch (e) {
|
||||
sendJson(response, 500, { ok: false, error: String(e) });
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (request.method === "POST") {
|
||||
try {
|
||||
sendJson(response, 200, await updater.applyUpdate());
|
||||
} catch (e) {
|
||||
sendJson(response, 500, { ok: false, error: String(e) });
|
||||
}
|
||||
return;
|
||||
}
|
||||
response.writeHead(405, { allow: "GET, POST" });
|
||||
response.end();
|
||||
},
|
||||
}, "dsh-purge: update");
|
||||
host.webServer.register({
|
||||
kind: "exact",
|
||||
path: "/dsh-purge/apply",
|
||||
@@ -820,30 +844,6 @@ function installWebServer(ctx, cfg) {
|
||||
}
|
||||
},
|
||||
}, "dsh-purge: restart");
|
||||
host.webServer.register({
|
||||
kind: "exact",
|
||||
path: "/dsh-purge/update",
|
||||
handler: async (request, response) => {
|
||||
if (request.method === "GET") {
|
||||
try {
|
||||
sendJson(response, 200, await updater.checkUpdate());
|
||||
} catch (e) {
|
||||
sendJson(response, 500, { ok: false, error: String(e) });
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (request.method === "POST") {
|
||||
try {
|
||||
sendJson(response, 200, await updater.applyUpdate());
|
||||
} catch (e) {
|
||||
sendJson(response, 500, { ok: false, error: String(e) });
|
||||
}
|
||||
return;
|
||||
}
|
||||
response.writeHead(405, { allow: "GET, POST" });
|
||||
response.end();
|
||||
},
|
||||
}, "dsh-purge: update");
|
||||
}, "dsh-purge: http routes");
|
||||
});
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user