authorize: auto-raise & skip on import (#56)

This commit is contained in:
Pacalini
2024-11-19 16:01:35 +08:00
committed by GitHub
parent ed67bc80ea
commit 8402c1c9f3
2 changed files with 14 additions and 1 deletions

View File

@@ -71,12 +71,14 @@ Future<void> importAppData(File file, [bool checkVersion = false]) async {
LocalFavoritesManager().init();
}
if (await appdataFile.exists()) {
// proxy settings should be kept
// proxy settings & authorization setting should be kept
var proxySettings = appdata.settings["proxy"];
var authSettings = appdata.settings["authorizationRequired"];
File(FilePath.join(App.dataPath, "appdata.json")).deleteIfExistsSync();
appdataFile.renameSync(FilePath.join(App.dataPath, "appdata.json"));
await appdata.init();
appdata.settings["proxy"] = proxySettings;
appdata.settings["authorizationRequired"] = authSettings;
appdata.saveData();
}
if (await cookieFile.exists()) {