mirror of
https://github.com/EasyTier/EasytierGame.git
synced 2025-05-19 10:27:56 +00:00
修复不启用config.json,但是本地存在config.json,无法取消勾选的bug,增加删除config.json的提示
This commit is contained in:
+22
-2
@@ -222,12 +222,13 @@
|
||||
import { QuestionFilled } from "@element-plus/icons-vue";
|
||||
import { resourceDir as getResourceDir, join } from "@tauri-apps/api/path";
|
||||
import { Command } from "@tauri-apps/plugin-shell";
|
||||
import { exists, mkdir, BaseDirectory } from "@tauri-apps/plugin-fs";
|
||||
import { exists, mkdir, BaseDirectory, remove } from "@tauri-apps/plugin-fs";
|
||||
import { ElMessage } from "element-plus";
|
||||
import { reactive } from "vue";
|
||||
import { dataSubscribe } from "@/composables/windows";
|
||||
import { supportProtocols } from "~/utils";
|
||||
import { ATJ, supportProtocols } from "~/utils";
|
||||
import CoreVersionWarning from "@/components/CoreVersionWarning.vue";
|
||||
import { ElConfirmDanger } from "~/utils/element";
|
||||
|
||||
const protocols = supportProtocols();
|
||||
const listenerDialogData = reactive<{ [key: string]: any }>({
|
||||
@@ -269,6 +270,25 @@
|
||||
};
|
||||
|
||||
dataSubscribe(async (...a) => {
|
||||
if (!mainStore.createConfigInEasytier) {
|
||||
// 考虑删除本地config.json文件
|
||||
const configJsonPath = import.meta.env.VITE_CONFIG_FILE_NAME;
|
||||
const isExists = await exists(configJsonPath, { baseDir: BaseDirectory.Resource });
|
||||
// console.log({ isExists });
|
||||
if (isExists) {
|
||||
const [error, _] = await ElConfirmDanger("生成配置文件功能被关闭,是否删除本地config.json", "提示", {
|
||||
confirmButtonText: "删除",
|
||||
cancelButtonText: "取消"
|
||||
});
|
||||
if (!error) {
|
||||
// 删除本地config.json文件
|
||||
const [error, _] = await ATJ(remove(configJsonPath, { baseDir: BaseDirectory.Resource }));
|
||||
if (error) {
|
||||
ElMessage.error("删除失败,请打开目录手动删除");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return {
|
||||
config: { ...mainStore.config },
|
||||
createConfigInEasytier: mainStore.createConfigInEasytier
|
||||
|
||||
+4
-4
@@ -983,14 +983,14 @@
|
||||
console.error(err);
|
||||
ElMessage.error(`config.json格式或编码错误`);
|
||||
} finally {
|
||||
mainStore.$patch({
|
||||
createConfigInEasytier: true // 发现本地存在config.json 默认启用该功能
|
||||
});
|
||||
// mainStore.$patch({
|
||||
// createConfigInEasytier: true // 发现本地存在config.json 默认启用该功能
|
||||
// });
|
||||
}
|
||||
}
|
||||
}
|
||||
const b = bounce(600);
|
||||
mainStore.$subscribe((...a) => {
|
||||
mainStore.$subscribe(async (...a) => {
|
||||
if (mainStore.createConfigInEasytier) {
|
||||
b(async () => {
|
||||
await updateConfigJson(data.configJsonSeverUrl);
|
||||
|
||||
Reference in New Issue
Block a user