Files
Surge/Surge-main/Scripts/AutoClearApprovalCartId.js
2026-04-02 21:02:16 +08:00

23 lines
695 B
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
/**
* Surge 脚本Clear_ApprovalCartId.js
* 作用:监测到 Family Safety 的 Complete 请求时,自动清空 ApprovalCartId
*/
const STORE_KEY = "ApprovalCartId";
(function() {
// 只有 POST 方法才触发清理
if ($request.method === "POST") {
const oldValue = $persistentStore.read(STORE_KEY);
if (oldValue) {
$persistentStore.write("", STORE_KEY);
console.log("🧹 [Batch Approve] 购买流程结束,已自动清空 ApprovalCartId 缓存。");
$notification.post("Microsoft Family", "购买流程结束", "ApprovalCartId 缓存已清空");
}
}
$done({});
})();