From 83bfd5d1eba4d8dbfc5d1b2b3ab6c1c34e0e1797 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=9B=AE=E6=A3=83?= Date: Sat, 26 Oct 2024 15:07:40 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=8E=A8=20=E8=B0=83=E6=95=B4=E4=BF=9D?= =?UTF-8?q?=E5=AD=98=E6=97=B6=E7=9A=84hint?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src-tauri/gen/schemas/capabilities.json | 194 +++++++++++++++++++++++- src/utils/TGShare.ts | 12 +- src/web/constant/bbs.ts | 12 +- 3 files changed, 208 insertions(+), 10 deletions(-) diff --git a/src-tauri/gen/schemas/capabilities.json b/src-tauri/gen/schemas/capabilities.json index 5bf4fba6..dc2a5820 100644 --- a/src-tauri/gen/schemas/capabilities.json +++ b/src-tauri/gen/schemas/capabilities.json @@ -1 +1,193 @@ -{"DevJson":{"identifier":"DevJson","description":"Capability for the dev json window","local":true,"windows":["Dev_JSON"],"permissions":["core:app:allow-version","core:app:default","core:event:allow-listen","core:event:default","http:allow-fetch","log:allow-log","log:default","core:path:allow-resolve-directory","core:path:default","sql:allow-load","sql:allow-execute","sql:default","core:webview:allow-set-webview-zoom","core:webview:default","core:window:allow-center","core:window:allow-close","core:window:allow-destroy","core:window:allow-set-size","core:window:allow-set-title","core:window:allow-set-fullscreen","core:window:allow-show","core:window:default",{"identifier":"http:default","allow":[{"url":"https://*.miyoushe.com/*"},{"url":"https://*.mihoyo.com/*"},{"url":"https://*.hoyoverse.com/*"}]}],"platforms":["windows","macOS"]},"Mys":{"identifier":"Mys","description":"Capability for the mys client window","remote":{"urls":["https://*.mihoyo.com/*","https://*.miyoushe.com/*"]},"local":true,"windows":["mhy_client"],"permissions":["dialog:allow-message","dialog:default","core:event:allow-emit","http:allow-fetch","core:webview:allow-set-webview-zoom","core:webview:default","core:window:allow-center","core:window:default","core:path:allow-resolve-directory","core:path:default",{"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/*"}]}],"platforms":["windows","macOS"]},"SubWindow":{"identifier":"SubWindow","description":"Capability for the sub window","local":true,"windows":["Sub_window"],"permissions":["core:app:allow-version","core:app:default","dialog:allow-save","dialog:default","core:event:allow-listen","core:event:default","fs:default","http:allow-fetch","log:allow-log","log:default","core:path:allow-resolve-directory","core:path:default","shell:allow-open","shell:default","sql:allow-load","sql:allow-execute","sql:default","core:webview:allow-set-webview-zoom","core:webview:default","core:window:allow-center","core:window:allow-close","core:window:allow-destroy","core:window:allow-set-size","core:window:allow-set-title","core:window:allow-set-focus","core:window:allow-set-fullscreen","core:window:allow-show","core:window:allow-set-always-on-top","core:window:default",{"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/*"},{"url":"https://*.mihoyogift.com/*"},{"url":"https://*.bilibili.com/*"},{"url":"https://*.hoyoverse.com/*"}]}],"platforms":["windows","macOS"]},"TeyvatGuide":{"identifier":"TeyvatGuide","description":"Capability for the main window","local":true,"windows":["TeyvatGuide"],"permissions":["core:app:allow-version","core:app:default","dialog:allow-save","dialog:default","core:event:allow-listen","core:event:default","fs:default","http:allow-fetch","log:allow-log","log:default","core:path:allow-resolve-directory","core:path:default","process:allow-exit","process:default","shell:allow-execute","shell:allow-open","shell:default","sql:allow-load","sql:allow-execute","sql:default","core:webview:allow-create-webview-window","core:webview:allow-set-webview-zoom","core:webview:default","core:window:allow-center","core:window:allow-close","core:window:allow-destroy","core:window:allow-set-size","core:window:default","core:window:allow-is-minimized","core:window:allow-set-title","core:window:allow-set-focus","core:window:allow-show","core:window:allow-unminimize",{"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/*"},{"url":"https://homa.snapgenshin.com/*"},{"url":"https://*.hoyoverse.com/*"}]},{"identifier":"shell:allow-execute","allow":[{"args":true,"cmd":"explorer","name":"win_open"},{"args":true,"cmd":"open","name":"mac_open"},{"args":true,"cmd":"powershell","name":"exec-sh"}]}],"platforms":["windows","macOS"]}} \ No newline at end of file +{ + "DevJson": { + "identifier": "DevJson", + "description": "Capability for the dev json window", + "local": true, + "windows": ["Dev_JSON"], + "permissions": [ + "core:app:allow-version", + "core:app:default", + "core:event:allow-listen", + "core:event:default", + "http:allow-fetch", + "log:allow-log", + "log:default", + "core:path:allow-resolve-directory", + "core:path:default", + "sql:allow-load", + "sql:allow-execute", + "sql:default", + "core:webview:allow-set-webview-zoom", + "core:webview:default", + "core:window:allow-center", + "core:window:allow-close", + "core:window:allow-destroy", + "core:window:allow-set-size", + "core:window:allow-set-title", + "core:window:allow-set-fullscreen", + "core:window:allow-show", + "core:window:default", + { + "identifier": "http:default", + "allow": [ + { "url": "https://*.miyoushe.com/*" }, + { "url": "https://*.mihoyo.com/*" }, + { "url": "https://*.hoyoverse.com/*" } + ] + } + ], + "platforms": ["windows", "macOS"] + }, + "Mys": { + "identifier": "Mys", + "description": "Capability for the mys client window", + "remote": { "urls": ["https://*.mihoyo.com/*", "https://*.miyoushe.com/*"] }, + "local": true, + "windows": ["mhy_client"], + "permissions": [ + "dialog:allow-message", + "dialog:default", + "core:event:allow-emit", + "http:allow-fetch", + "core:webview:allow-set-webview-zoom", + "core:webview:default", + "core:window:allow-center", + "core:window:default", + "core:path:allow-resolve-directory", + "core:path:default", + { "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/*" }] + } + ], + "platforms": ["windows", "macOS"] + }, + "SubWindow": { + "identifier": "SubWindow", + "description": "Capability for the sub window", + "local": true, + "windows": ["Sub_window"], + "permissions": [ + "core:app:allow-version", + "core:app:default", + "dialog:allow-save", + "dialog:default", + "core:event:allow-listen", + "core:event:default", + "fs:default", + "http:allow-fetch", + "log:allow-log", + "log:default", + "core:path:allow-resolve-directory", + "core:path:default", + "shell:allow-open", + "shell:default", + "sql:allow-load", + "sql:allow-execute", + "sql:default", + "core:webview:allow-set-webview-zoom", + "core:webview:default", + "core:window:allow-center", + "core:window:allow-close", + "core:window:allow-destroy", + "core:window:allow-set-size", + "core:window:allow-set-title", + "core:window:allow-set-focus", + "core:window:allow-set-fullscreen", + "core:window:allow-show", + "core:window:allow-set-always-on-top", + "core:window:default", + { "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/*" }, + { "url": "https://*.mihoyogift.com/*" }, + { "url": "https://*.bilibili.com/*" }, + { "url": "https://*.hoyoverse.com/*" } + ] + } + ], + "platforms": ["windows", "macOS"] + }, + "TeyvatGuide": { + "identifier": "TeyvatGuide", + "description": "Capability for the main window", + "local": true, + "windows": ["TeyvatGuide"], + "permissions": [ + "core:app:allow-version", + "core:app:default", + "dialog:allow-save", + "dialog:default", + "core:event:allow-listen", + "core:event:default", + "fs:default", + "http:allow-fetch", + "log:allow-log", + "log:default", + "core:path:allow-resolve-directory", + "core:path:default", + "process:allow-exit", + "process:default", + "shell:allow-execute", + "shell:allow-open", + "shell:default", + "sql:allow-load", + "sql:allow-execute", + "sql:default", + "core:webview:allow-create-webview-window", + "core:webview:allow-set-webview-zoom", + "core:webview:default", + "core:window:allow-center", + "core:window:allow-close", + "core:window:allow-destroy", + "core:window:allow-set-size", + "core:window:default", + "core:window:allow-is-minimized", + "core:window:allow-set-title", + "core:window:allow-set-focus", + "core:window:allow-show", + "core:window:allow-unminimize", + { "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/*" }, + { "url": "https://homa.snapgenshin.com/*" }, + { "url": "https://*.hoyoverse.com/*" } + ] + }, + { + "identifier": "shell:allow-execute", + "allow": [ + { "args": true, "cmd": "explorer", "name": "win_open" }, + { "args": true, "cmd": "open", "name": "mac_open" }, + { "args": true, "cmd": "powershell", "name": "exec-sh" } + ] + } + ], + "platforms": ["windows", "macOS"] + } +} diff --git a/src/utils/TGShare.ts b/src/utils/TGShare.ts index 432a3111..cb4ba70d 100644 --- a/src/utils/TGShare.ts +++ b/src/utils/TGShare.ts @@ -1,7 +1,7 @@ /** * @file utils/TGShare.ts * @description 生成分享截图并保存到本地 - * @since Beta v0.6.0 + * @since Beta v0.6.2 */ import { path } from "@tauri-apps/api"; @@ -18,7 +18,7 @@ import { bytesToSize } from "./toolFunc.js"; /** * @description 保存图片-canvas - * @since Beta v0.5.0 + * @since Beta v0.6.2 * @param {Uint8Array} buffer - 图片数据 * @param {string} filename - 文件名 * @param {string} format - 文件格式 @@ -37,10 +37,12 @@ export async function saveCanvasImg( }); if (res === null) { await TGLogger.Info(`[saveCanvasImg][${filename}] 未选择保存路径`); + showSnackbar({ text: "未选择保存路径", color: "cancel" }); return; } await writeFile(res, buffer); await TGLogger.Info(`[saveCanvasImg][${filename}] 已将图像保存到本地`); + showSnackbar({ text: `已将 ${filename} 保存到本地` }); } /** @@ -156,13 +158,17 @@ export async function generateShareImg( /** * @description 复制到剪贴板 - * @since Beta v0.3.7 + * @since Beta v0.6.2 * @param {Uint8Array} buffer - 图片数据 * @returns {Promise} 无返回值 */ export async function copyToClipboard(buffer: Uint8Array): Promise { const blob = new Blob([buffer], { type: "image/png" }); const url = URL.createObjectURL(blob); + // todo mac 会报错: https://bugs.webkit.org/show_bug.cgi?id=222262 + // NotAllowedError: + // The request is not allowed by the user agent or the platform in the current context, + // possibly because the user denied permission. await navigator.clipboard.write([ new ClipboardItem({ [blob.type]: blob, diff --git a/src/web/constant/bbs.ts b/src/web/constant/bbs.ts index 1c1bc996..dcb18ab8 100644 --- a/src/web/constant/bbs.ts +++ b/src/web/constant/bbs.ts @@ -1,22 +1,22 @@ /** * @file web/constant/bbs.ts * @description 常量-应用数据 - * @since Beta v0.5.5 + * @since Beta v0.6.2 */ -export const BBS_VERSION = "2.75.1"; +export const BBS_VERSION = "2.76.1"; export const BBS_UA_PC = `Mozilla/5.0 (Windows NT 10.0; Win64; x64) miHoYoBBS/${BBS_VERSION}`; export const BBS_UA_MOBILE = `Mozilla/5.0 (Linux; Android 12) Mobile miHoYoBBS/${BBS_VERSION}`; export const BBS_APP_ID = "bll8iq97cem8"; /** * @description salt 值 - * @version 2.75.1 - * @since Beta v0.5.0 + * @version 2.76.1 + * @since Beta v0.6.2 */ export const BBS_SALT = { - K2: "oqrJbPCoFhWhFBNDvVRuldbrbiVxyWsP", - LK2: "zZDfHqEcwTqvvKDmqRcHyqqurxGgLfBV", + K2: "OZatXfBgOYfCeDxVQwkEnFHFxJNtCrzB", + LK2: "FyZqfQfTDamvpNGuTMPkgyNOEpYQlBQf", X4: "xV8v4Qu54lUKrEYFZkJhB8cuOh9Asafs", X6: "t0qEgfub6cvueAPgR5m9aQWWVciEer7v", PROD: "t0qEgfub6cvueAPgR5m9aQWWVciEer7v",