Преглед изворни кода

fix: better feature config loading hopefully

Sv443 пре 1 година
родитељ
комит
a398401f56
1 измењених фајлова са 2 додато и 2 уклоњено
  1. 2 2
      src/config.ts

+ 2 - 2
src/config.ts

@@ -32,7 +32,7 @@ export async function loadFeatureConf(): Promise<FeatureConfig> {
       return featuresCache = defConf;
     }
 
-    return Object.freeze(featureConf ? JSON.parse(featureConf) : {});
+    return featuresCache = Object.freeze(featureConf ? JSON.parse(featureConf) : defConf);
   }
   catch(err) {
     await setDefaultFeatConf();
@@ -48,7 +48,7 @@ export function saveFeatureConf(featureConf: FeatureConfig) {
   if(!featureConf || typeof featureConf != "object")
     throw new TypeError("Feature config not provided or invalid");
 
-  log("");
+  log("Saving new feature config:", featureConf);
   featuresCache = { ...featureConf };
   return GM.setValue("betterytm-config", JSON.stringify(featureConf));
 }