mirror of
https://github.com/BTMuli/TeyvatGuide.git
synced 2026-05-10 00:44:04 +08:00
✨ 完成 深渊数据 的备份与恢复
This commit is contained in:
@@ -8,7 +8,7 @@
|
||||
// tauri
|
||||
import { fs, path } from "@tauri-apps/api";
|
||||
// utils
|
||||
import TGSqlite from "../../utils/TGSqlite";
|
||||
import TGSqlite from "../../plugins/Sqlite";
|
||||
|
||||
/**
|
||||
* @description 恢复 Cookie 数据
|
||||
@@ -22,3 +22,16 @@ export async function restoreCookieData (): Promise<boolean> {
|
||||
await TGSqlite.saveAppData("cookie", JSON.stringify(JSON.parse(cookieData)));
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @description 恢复深渊数据
|
||||
* @since Alpha v0.2.0
|
||||
* @returns {Promise<boolean>}
|
||||
*/
|
||||
export async function restoreAbyssData (): Promise<boolean> {
|
||||
const abyssPath = `${await path.appLocalDataDir()}\\userData\\abyss.json`;
|
||||
if (!await fs.exists(abyssPath)) return false;
|
||||
const abyssData = await fs.readTextFile(abyssPath);
|
||||
await TGSqlite.restoreAbyss(JSON.parse(abyssData));
|
||||
return true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user