Kaynağa Gözat

add upgrade code

Gildas 2 yıl önce
ebeveyn
işleme
9cd2627648
1 değiştirilmiş dosya ile 10 ekleme ve 0 silme
  1. 10 0
      src/core/bg/config.js

+ 10 - 0
src/core/bg/config.js

@@ -225,6 +225,16 @@ async function upgrade() {
 	if (!config.processInForeground) {
 		await configStorage.set({ processInForeground: false });
 	}
+	const profileNames = await getProfileNames();
+	profileNames.map(async profileName => {
+		const profile = await getProfile(profileName);
+		for (const key of Object.keys(DEFAULT_CONFIG)) {
+			if (profile[key] === undefined) {
+				profile[key] = DEFAULT_CONFIG[key];
+			}
+		}
+		await setProfile(profileName, profile);
+	});
 }
 
 async function getRule(url, ignoreWildcard) {