Skip to content

Commit

Permalink
🐛 修复CAT_fileStorage网络错误也会导致配置实现的问题
Browse files Browse the repository at this point in the history
fixed #224
  • Loading branch information
CodFrm committed Aug 25, 2023
1 parent 890076a commit c309832
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 12 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ on:
push:
branches:
- main
- release/*
- dev

jobs:
build-deploy:
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "scriptcat",
"version": "0.15.0",
"version": "0.15.1",
"description": "脚本猫,一个可以执行用户脚本的浏览器扩展,万物皆可脚本化,让你的浏览器可以做更多的事情!",
"author": "CodFrm",
"license": "GPLv3",
Expand Down
2 changes: 1 addition & 1 deletion src/manifest.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"manifest_version": 2,
"name": "ScriptCat",
"version": "0.15.0",
"version": "0.15.1",
"author": "CodFrm",
"description": "脚本猫,一个用户脚本管理器,支持后台脚本、定时脚本、页面脚本,可编写脚本每天帮你自动处理事务.",
"options_ui": {
Expand Down
10 changes: 7 additions & 3 deletions src/runtime/background/gm_api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import FileSystem from "@Pkg/filesystem/filesystem";
import { joinPath } from "@Pkg/filesystem/utils";
import i18next from "i18next";
import { i18nName } from "@App/locales/locales";
import { isWarpTokenError } from "@Pkg/filesystem/error";
import PermissionVerify, {
ConfirmParam,
IPermissionVerify,
Expand Down Expand Up @@ -879,9 +880,12 @@ export default class GMApi {
await FileSystemFactory.mkdirAll(fs, baseDir);
fs = await fs.openDir(baseDir);
} catch (e: any) {
fsConfig.status = "error";
this.systemConfig.catFileStorage = fsConfig;
return channel.throw({ code: 2, error: e.message });
if (isWarpTokenError(e)) {
fsConfig.status = "error";
this.systemConfig.catFileStorage = fsConfig;
return channel.throw({ code: 2, error: e.error.message });
}
return channel.throw({ code: 8, error: e.message });
}
switch (action) {
case "list":
Expand Down
8 changes: 4 additions & 4 deletions src/types/scriptcat.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ declare const GM_info: {
scriptUpdateURL?: string;
// scriptSource: string;
scriptMetaStr?: string;
userConfig?: UserConfig,
userConfigStr?: string,
userConfig?: UserConfig;
userConfigStr?: string;
// isIncognito: boolean;
// downloadMode: "native" | "disabled" | "browser";
script: {
Expand Down Expand Up @@ -307,8 +307,8 @@ declare namespace CATType {

interface FileStorageError {
// 错误码 -1 未知错误 1 用户未配置文件储存源 2 文件储存源配置错误 3 路径不存在
// 4 上传失败 5 下载失败 6 删除失败 7 不允许的文件路径
code: -1 | 1 | 2 | 3 | 4 | 5 | 6 | 7;
// 4 上传失败 5 下载失败 6 删除失败 7 不允许的文件路径 8 网络类型的错误
code: -1 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8;
error: string;
}

Expand Down

0 comments on commit c309832

Please sign in to comment.