Ver código fonte

fix: default feature cfg not being applied

Sv443 1 ano atrás
pai
commit
708c3d0142
1 arquivos alterados com 5 adições e 2 exclusões
  1. 5 2
      src/config.ts

+ 5 - 2
src/config.ts

@@ -32,13 +32,16 @@ export async function loadFeatureConf(): Promise<FeatureConfig> {
   try {
     const featureConf = await GM.getValue("betterytm-config") as string;
 
-    // empty object length is 2, so we check for 3 to be sure
+    // empty object length is 2-3, so check for >3 to be sure
     if(typeof featureConf !== "string" || featureConf.length <= 3) {
       await setDefaultFeatConf();
       return featuresCache = defConf;
     }
 
-    return featuresCache = featureConf ? JSON.parse(featureConf) as FeatureConfig : defConf;
+    return featuresCache = {
+      ...defConf,
+      ...(featureConf ? JSON.parse(featureConf) as FeatureConfig : {}),
+    };
   }
   catch(err) {
     error("Error loading feature configuration, resetting to default:", err);