️ 不允许低于 UIGF v2.3 版本的数据导入

This commit is contained in:
目棃
2024-07-18 18:04:12 +08:00
parent 41ee27c74e
commit 5bf2521938
13 changed files with 778 additions and 719 deletions

View File

@@ -2,7 +2,7 @@
<TOverlay v-model="visible" hide blur-val="20px" :to-click="onCancel">
<div class="tog-box">
<div class="tog-top">
<div class="tog-title">请使用米游社或原神进行操作</div>
<div class="tog-title">请使用米游社APP进行操作</div>
<div class="tog-subtitle">所需米游社版本 >= 2.57.1</div>
</div>
<div class="tog-mid">
@@ -135,7 +135,7 @@ async function cycleGetData() {
if (res.payload.proto !== "OpenToken" && res.payload.proto !== "Account") {
await TGLogger.Warn(`[to-gameLogin] 检测到意外协议:${res.payload.proto}`);
showSnackbar({
text: "请使用米游社或原神进行扫码操作",
text: "请使用米游社APP进行扫码操作",
color: "error",
});
visible.value = false;

View File

@@ -1,7 +1,7 @@
/**
* @file plugins/Sqlite/modules/userGacha.ts
* @description 用户祈愿模块
* @since Beta v0.5.0
* @since Beta v0.5.1
*/
import { AppCharacterData, AppWeaponData } from "../../../data/index.js";
@@ -29,12 +29,12 @@ function getGachaItemType(item_id: string): gachaItemTypeRes {
/**
* @description 转换祈愿数据,防止多语言
* @since Beta v0.4.7
* @since Beta v0.5.1
* @param {TGApp.Plugins.UIGF.GachaItem} gacha - UIGF数据
* @return {TGApp.Plugins.UIGF.GachaItem} 转换后的数据
*/
function transGacha(gacha: TGApp.Plugins.UIGF.GachaItem): TGApp.Plugins.UIGF.GachaItem {
const type = getGachaItemType(gacha.item_id!);
const type = getGachaItemType(gacha.item_id);
let res = gacha;
res.item_type = type[0];
if (type[0] === "角色") {

View File

@@ -1,7 +1,7 @@
/**
* @file types/Plugins/UIGF.d.ts
* @description UIGF 插件类型定义文件
* @since Beta v0.5.0
* @since Beta v0.5.1
* @version UIGF v3.0 | UIGF v4.0
*/
@@ -114,7 +114,8 @@ declare namespace TGApp.Plugins.UIGF {
/**
* @description UIGF 祈愿列表
* @since Alpha v0.2.3
* @Beta v0.5.1
* @version UIGF v3.0
* @interface GachaItem
* @property {EnumGachaType} gacha_type - 祈愿类型
* @property {string} item_id - 物品ID
@@ -130,7 +131,7 @@ declare namespace TGApp.Plugins.UIGF {
interface GachaItem {
uigf_gacha_type: string;
gacha_type: string;
item_id?: string;
item_id: string;
count?: string;
time: string;
name: string;

View File

@@ -1,7 +1,7 @@
/**
* @file utils/UIGF.ts
* @description UIGF工具类
* @since Beta v0.5.0
* @since Beta v0.5.1
*/
import { app, path } from "@tauri-apps/api";
@@ -110,7 +110,7 @@ export async function verifyUigfData(path: string, isVersion4: boolean = false):
/**
* @description 验证 UIGF 数据
* @since Beta v0.5.0
* @since Beta v0.5.1
* @param {object} data - UIGF 数据
* @returns {boolean} 是否验证通过
*/
@@ -126,6 +126,14 @@ function validateUigfData(data: object): boolean {
});
return false;
}
const parsedData: TGApp.Plugins.UIGF.Schema = <TGApp.Plugins.UIGF.Schema>data;
if (parsedData.info.uigf_version < "v2.3") {
showSnackbar({
text: "UIGF 版本过低,请使用 v2.3 或以上版本",
color: "error",
});
return false;
}
return true;
}