mirror of
https://github.com/BTMuli/TeyvatGuide.git
synced 2025-12-07 08:42:49 +08:00
10
src/types/Plugins/UIGF.d.ts
vendored
10
src/types/Plugins/UIGF.d.ts
vendored
@@ -1,8 +1,8 @@
|
|||||||
/**
|
/**
|
||||||
* @file types Plugins UIGF.d.ts
|
* @file types/Plugins/UIGF.d.ts
|
||||||
* @description UIGF 插件类型定义文件
|
* @description UIGF 插件类型定义文件
|
||||||
* @author BTMuli<bt-muli@outlook.com>
|
* @since Beta v0.3.5
|
||||||
* @since Alpha v0.2.3
|
* @version UIGF v2.4
|
||||||
*/
|
*/
|
||||||
|
|
||||||
declare namespace TGApp.Plugins.UIGF {
|
declare namespace TGApp.Plugins.UIGF {
|
||||||
@@ -21,7 +21,7 @@ declare namespace TGApp.Plugins.UIGF {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* @description UIGF 头部信息
|
* @description UIGF 头部信息
|
||||||
* @since Alpha v0.2.3
|
* @since Beta v0.3.5
|
||||||
* @interface Export
|
* @interface Export
|
||||||
* @see docs\UIGF.md
|
* @see docs\UIGF.md
|
||||||
* @property {string} uid - UID
|
* @property {string} uid - UID
|
||||||
@@ -31,6 +31,7 @@ declare namespace TGApp.Plugins.UIGF {
|
|||||||
* @property {string} export_time - 导出时间 yyyy-MM-dd HH:mm:ss
|
* @property {string} export_time - 导出时间 yyyy-MM-dd HH:mm:ss
|
||||||
* @property {string} export_app - 导出应用
|
* @property {string} export_app - 导出应用
|
||||||
* @property {string} export_app_version - 导出应用版本
|
* @property {string} export_app_version - 导出应用版本
|
||||||
|
* @property {number} region_time_zone - 时区
|
||||||
* @return Export
|
* @return Export
|
||||||
*/
|
*/
|
||||||
interface Export {
|
interface Export {
|
||||||
@@ -41,6 +42,7 @@ declare namespace TGApp.Plugins.UIGF {
|
|||||||
export_time?: string;
|
export_time?: string;
|
||||||
export_app?: string;
|
export_app?: string;
|
||||||
export_app_version?: string;
|
export_app_version?: string;
|
||||||
|
region_time_zone?: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -1,16 +1,28 @@
|
|||||||
/**
|
/**
|
||||||
* @file utils/UIGF.ts
|
* @file utils/UIGF.ts
|
||||||
* @description UIGF工具类
|
* @description UIGF工具类
|
||||||
* @since Beta v0.3.4
|
* @since Beta v0.3.5
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import { app, fs, path } from "@tauri-apps/api";
|
import { app, fs, path } from "@tauri-apps/api";
|
||||||
|
|
||||||
import { timestampToDate } from "./toolFunc";
|
import { timestampToDate } from "./toolFunc";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @description 获取 UIGF 时区
|
||||||
|
* @since Beta v0.3.5
|
||||||
|
* @param {string} uid - UID
|
||||||
|
* @returns {number} 时区
|
||||||
|
*/
|
||||||
|
function getUigfTimeZone(uid: string): number {
|
||||||
|
if (uid.startsWith("6")) return -5;
|
||||||
|
if (uid.startsWith("7")) return 1;
|
||||||
|
return 8;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @description 获取 UIGF 头部信息
|
* @description 获取 UIGF 头部信息
|
||||||
* @since Beta v0.3.4
|
* @since Beta v0.3.5
|
||||||
* @param {string} uid - UID
|
* @param {string} uid - UID
|
||||||
* @returns {Promise<TGApp.Plugins.UIGF.Export>}
|
* @returns {Promise<TGApp.Plugins.UIGF.Export>}
|
||||||
*/
|
*/
|
||||||
@@ -19,11 +31,12 @@ export async function getUigfHeader(uid: string): Promise<TGApp.Plugins.UIGF.Exp
|
|||||||
return {
|
return {
|
||||||
uid,
|
uid,
|
||||||
lang: "zh-cn",
|
lang: "zh-cn",
|
||||||
uigf_version: "2.3.0",
|
uigf_version: "2.4.0",
|
||||||
export_timestamp: Math.floor(stamp / 1000),
|
export_timestamp: Math.floor(stamp / 1000),
|
||||||
export_time: timestampToDate(stamp),
|
export_time: timestampToDate(stamp),
|
||||||
export_app: "TeyvatGuide",
|
export_app: "TeyvatGuide",
|
||||||
export_app_version: await app.getVersion(),
|
export_app_version: await app.getVersion(),
|
||||||
|
region_time_zone: getUigfTimeZone(uid),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user