Browse Source

feat: delete all GM values on "reset everything"

Sv443 16 hours ago
parent
commit
4c81d4373b
2 changed files with 3 additions and 1 deletions
  1. 2 0
      src/features/index.ts
  2. 1 1
      src/tools/post-build.ts

+ 2 - 0
src/features/index.ts

@@ -969,6 +969,8 @@ export const featInfo = {
         message: t("reset_everything_confirm"),
       })) {
         await getStoreSerializer().resetStoresData();
+        const gmKeys = await GM.listValues();
+        await Promise.allSettled(gmKeys.map(key => GM.deleteValue(key)));
         await reloadTab();
       }
     },

+ 1 - 1
src/tools/post-build.ts

@@ -65,7 +65,6 @@ const devServerUserscriptUrl = `http://localhost:${devServerPort}/${rollupCfgOut
 /** Extra `@grant` directives added when `mode` is `development` */
 const devGrants = [
   "GM.registerMenuCommand",
-  "GM.listValues"
 ] as const;
 
 const repo = "Sv443/BetterYTM" as const;
@@ -238,6 +237,7 @@ ${localizedDescriptions ? "\n" + localizedDescriptions : ""}\
 // @grant             GM.getValue
 // @grant             GM.setValue
 // @grant             GM.deleteValue
+// @grant             GM.listValues
 // @grant             GM.getResourceUrl
 // @grant             GM.setClipboard
 // @grant             GM.xmlHttpRequest