🎨 调整保存时的hint

This commit is contained in:
目棃
2024-10-26 15:07:40 +08:00
parent 0050ee773e
commit 83bfd5d1eb
3 changed files with 208 additions and 10 deletions

View File

@@ -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<void>} 无返回值
*/
export async function copyToClipboard(buffer: Uint8Array): Promise<void> {
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,

View File

@@ -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",