Skip to content

Commit af09645

Browse files
committed
🐛 修复备份文件操作错误 #113
1 parent 10a5c19 commit af09645

File tree

2 files changed

+7
-8
lines changed

2 files changed

+7
-8
lines changed

src/app/const.ts

+1-4
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
11
export const ExtVersion = "0.10.2";
22

3-
export const ExtServer =
4-
process.env.NODE_ENV === "development"
5-
? "http://localhost:8080/"
6-
: "https://ext.scriptcat.org/";
3+
export const ExtServer = "https://ext.scriptcat.org/";
74

85
export const ExternalWhitelist = [
96
"greasyfork.org",

src/pages/options/routes/Tools.tsx

+6-4
Original file line numberDiff line numberDiff line change
@@ -131,10 +131,10 @@ function Tools() {
131131
);
132132
try {
133133
fs = await fs.openDir("ScriptCat");
134-
const list = await fs.list();
134+
let list = await fs.list();
135135
list.sort((a, b) => b.updatetime - a.updatetime);
136136
// 过滤掉非zip文件
137-
list.filter((file) => file.name.endsWith(".zip"));
137+
list = list.filter((file) => file.name.endsWith(".zip"));
138138
if (list.length === 0) {
139139
Message.info("没有备份文件");
140140
return;
@@ -177,13 +177,14 @@ function Tools() {
177177
size="small"
178178
onClick={async () => {
179179
Message.info("正在从云端拉取数据");
180-
const fs = await FileSystemFactory.create(
180+
let fs = await FileSystemFactory.create(
181181
fileSystemType,
182182
fileSystemParams
183183
);
184184
let file: FileReader;
185185
let data: Blob;
186186
try {
187+
fs = await fs.openDir("ScriptCat");
187188
file = await fs.open(item);
188189
data = (await file.read("blob")) as Blob;
189190
} catch (e) {
@@ -215,11 +216,12 @@ function Tools() {
215216
title: "确认删除",
216217
content: `确认删除备份文件${item.name}?`,
217218
onOk: async () => {
218-
const fs = await FileSystemFactory.create(
219+
let fs = await FileSystemFactory.create(
219220
fileSystemType,
220221
fileSystemParams
221222
);
222223
try {
224+
fs = await fs.openDir("ScriptCat");
223225
await fs.delete(item.name);
224226
setBackupFileList(
225227
backupFileList.filter(

0 commit comments

Comments
 (0)