mirror of
https://github.com/YuJunZhiXue/dsh-purge.git
synced 2026-11-28 10:30:24 +08:00
fix: 停用/卸载时清掉 selectedDefault=redteam(#108)
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
1 parent
fefae8764c
commit
7a78399e0b
6 files changed
+77
-17
No files matched your search
@@ -27,6 +27,12 @@ import * as continueRetry from "./continue-retry.js";
|
||||
import * as uninstaller from "./uninstall.js";
|
||||
import { readDrillGrant, writeDrillGrant } from "./drill-grant.js";
|
||||
import { installRegionGate, readAllowText, writeAllowText } from "./net-scope.js";
|
||||
import {
|
||||
cancelClearOwnedSelectedDefault,
|
||||
clearOwnedSelectedDefault,
|
||||
removeStaleAgentPresetDir,
|
||||
scheduleClearOwnedSelectedDefault,
|
||||
} from "./preset-default.js";
|
||||
import {
|
||||
applyShouldRestart,
|
||||
isInactiveContextError,
|
||||
@@ -1455,8 +1461,16 @@ export function apply(ctx, config) {
|
||||
const cfg = { ...DEFAULTS, ...(config || {}) };
|
||||
if (!cfg.enabled) {
|
||||
purgeLog("boot", { enabled: false });
|
||||
try { clearOwnedSelectedDefault({ ctx, dshHome: core.findDshHome() }); } catch { /* 停用不被清默认挡住 */ }
|
||||
try { removeStaleAgentPresetDir(core.findDshHome(), "redteam"); } catch { /* ignore */ }
|
||||
return;
|
||||
}
|
||||
cancelClearOwnedSelectedDefault();
|
||||
try {
|
||||
ctx.effect(() => () => {
|
||||
try { scheduleClearOwnedSelectedDefault({ ctx, dshHome: core.findDshHome() }); } catch { /* 停用不被清默认挡住 */ }
|
||||
});
|
||||
} catch { /* 无 effect 时靠 uninstall / enabled:false 清 */ }
|
||||
purgeLog("boot", {
|
||||
enabled: true,
|
||||
surface: hostctl.currentSurface(),
|
||||
|
||||
Reference in new issue
Block a user