diff --git a/src-tauri/capabilities/SubWindow.json b/src-tauri/capabilities/SubWindow.json index 9e2e6497..b7b7ef70 100644 --- a/src-tauri/capabilities/SubWindow.json +++ b/src-tauri/capabilities/SubWindow.json @@ -6,8 +6,11 @@ "permissions": [ "app:allow-version", "app:default", + "dialog:allow-save", + "dialog:default", "event:allow-listen", "event:default", + "fs:default", "http:allow-fetch", "log:allow-log", "log:default", @@ -21,6 +24,34 @@ "window:allow-set-title", "window:allow-set-fullscreen", "window:allow-show", + { + "identifier": "fs:allow-exists", + "allow": [{ "path": "**" }] + }, + { + "identifier": "fs:allow-mkdir", + "allow": [{ "path": "**" }] + }, + { + "identifier": "fs:allow-read-dir", + "allow": [{ "path": "**" }] + }, + { + "identifier": "fs:allow-read-text-file", + "allow": [{ "path": "**" }] + }, + { + "identifier": "fs:allow-remove", + "allow": [{ "path": "**" }] + }, + { + "identifier": "fs:allow-write-file", + "allow": [{ "path": "**" }] + }, + { + "identifier": "fs:allow-write-text-file", + "allow": [{ "path": "**" }] + }, { "identifier": "http:default", "allow": [ diff --git a/src-tauri/gen/schemas/capabilities.json b/src-tauri/gen/schemas/capabilities.json index 0de94ad1..e16efa5d 100644 --- a/src-tauri/gen/schemas/capabilities.json +++ b/src-tauri/gen/schemas/capabilities.json @@ -59,8 +59,11 @@ "permissions": [ "app:allow-version", "app:default", + "dialog:allow-save", + "dialog:default", "event:allow-listen", "event:default", + "fs:default", "http:allow-fetch", "log:allow-log", "log:default", @@ -74,6 +77,13 @@ "window:allow-set-title", "window:allow-set-fullscreen", "window:allow-show", + { "identifier": "fs:allow-exists", "allow": [{ "path": "**" }] }, + { "identifier": "fs:allow-mkdir", "allow": [{ "path": "**" }] }, + { "identifier": "fs:allow-read-dir", "allow": [{ "path": "**" }] }, + { "identifier": "fs:allow-read-text-file", "allow": [{ "path": "**" }] }, + { "identifier": "fs:allow-remove", "allow": [{ "path": "**" }] }, + { "identifier": "fs:allow-write-file", "allow": [{ "path": "**" }] }, + { "identifier": "fs:allow-write-text-file", "allow": [{ "path": "**" }] }, { "identifier": "http:default", "allow": [{ "url": "https://*.miyoushe.com/*" }, { "url": "https://*.mihoyo.com/*" }] diff --git a/src/utils/TGShare.ts b/src/utils/TGShare.ts index 988dfbb7..006f18de 100644 --- a/src/utils/TGShare.ts +++ b/src/utils/TGShare.ts @@ -33,7 +33,7 @@ export async function saveCanvasImg( const res = await save({ title: "保存图片", filters: [{ name: "图片", extensions: [format] }], - defaultPath: `${await path.downloadDir()}${path.sep}${filename}.${format}`, + defaultPath: `${await path.downloadDir()}${path.sep()}${filename}.${format}`, }); if (res === null) { await TGLogger.Info(`[saveCanvasImg][${filename}] 未选择保存路径`); @@ -63,7 +63,7 @@ export async function saveImgLocal(url: string): Promise { * @returns {Promise} 图片 buffer */ export async function getImageBuffer(url: string): Promise { - const res = await TGHttp(url, { method: "GET" }); + const res = await TGHttp(url, { method: "GET", isBlob: true }); return new Uint8Array(res); }