mirror of
https://github.com/YuJunZhiXue/dsh-purge.git
synced 2026-11-28 11:10:22 +08:00
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
1 parent
4dce6689a8
commit
e8567a8d34
8 files changed
+564
-114
No files matched your search
+12
-1
@@ -18,6 +18,7 @@ export const inject = ["systemPrompt", "tools"];
|
||||
const DEFAULTS = {
|
||||
enabled: true,
|
||||
autoApplyOnStart: true,
|
||||
autoUpdateOnStart: true,
|
||||
autoRevertOnMissing: false,
|
||||
postPrompt: "",
|
||||
postPromptOrder: 5100,
|
||||
@@ -474,6 +475,11 @@ export function apply(ctx, config) {
|
||||
rules.ensureInitialState(core.findDshHome())
|
||||
.then((r) => log(cfg, "rules init:", JSON.stringify(r)))
|
||||
.catch((e) => console.warn("[dsh-purge] rules init error:", String(e)));
|
||||
if (cfg.autoUpdateOnStart !== false) {
|
||||
updater.autoUpdateIfNeeded()
|
||||
.then((r) => log(cfg, "auto-update:", JSON.stringify(r)))
|
||||
.catch((e) => console.warn("[dsh-purge] auto-update error:", String(e)));
|
||||
}
|
||||
});
|
||||
|
||||
installIdentityOverride(ctx);
|
||||
@@ -686,6 +692,7 @@ function installWebServer(ctx, cfg) {
|
||||
override_path: state.override_path,
|
||||
dsh_home: state.dsh_home,
|
||||
plugin_version: updater.localVersion(),
|
||||
update: updater.lastUpdateResult(),
|
||||
});
|
||||
} catch (e) {
|
||||
sendJson(response, 500, { ok: false, error: String(e) });
|
||||
@@ -706,7 +713,11 @@ function installWebServer(ctx, cfg) {
|
||||
}
|
||||
if (request.method === "POST") {
|
||||
try {
|
||||
sendJson(response, 200, await updater.applyUpdate());
|
||||
const body = await readJsonBody(request);
|
||||
const result = body && body.auto
|
||||
? await updater.autoUpdateIfNeeded()
|
||||
: await updater.applyUpdate();
|
||||
sendJson(response, 200, result);
|
||||
} catch (e) {
|
||||
sendJson(response, 500, { ok: false, error: String(e) });
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user