Procházet zdrojové kódy

feat: delete all GM values on "reset everything"

Sv443 před 1 dnem
rodič
revize
4c81d4373b
2 změnil soubory, kde provedl 3 přidání a 1 odebrání
  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"),
         message: t("reset_everything_confirm"),
       })) {
       })) {
         await getStoreSerializer().resetStoresData();
         await getStoreSerializer().resetStoresData();
+        const gmKeys = await GM.listValues();
+        await Promise.allSettled(gmKeys.map(key => GM.deleteValue(key)));
         await reloadTab();
         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` */
 /** Extra `@grant` directives added when `mode` is `development` */
 const devGrants = [
 const devGrants = [
   "GM.registerMenuCommand",
   "GM.registerMenuCommand",
-  "GM.listValues"
 ] as const;
 ] as const;
 
 
 const repo = "Sv443/BetterYTM" as const;
 const repo = "Sv443/BetterYTM" as const;
@@ -238,6 +237,7 @@ ${localizedDescriptions ? "\n" + localizedDescriptions : ""}\
 // @grant             GM.getValue
 // @grant             GM.getValue
 // @grant             GM.setValue
 // @grant             GM.setValue
 // @grant             GM.deleteValue
 // @grant             GM.deleteValue
+// @grant             GM.listValues
 // @grant             GM.getResourceUrl
 // @grant             GM.getResourceUrl
 // @grant             GM.setClipboard
 // @grant             GM.setClipboard
 // @grant             GM.xmlHttpRequest
 // @grant             GM.xmlHttpRequest