mirror of
https://github.com/BTMuli/TeyvatGuide.git
synced 2025-12-12 09:18:14 +08:00
🎨 微调逻辑
This commit is contained in:
@@ -460,10 +460,9 @@ async function confirmUpdateDevice(): Promise<void> {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
await TGRequest.Device.getFp();
|
appStore.deviceInfo = await TGRequest.Device.getFp(appStore.deviceInfo);
|
||||||
appStore.deviceInfo.device_fp = getDeviceInfo("device_fp");
|
|
||||||
showSnackbar({
|
showSnackbar({
|
||||||
text: "设备信息已更新! DeviceFp: " + getDeviceInfo("device_fp"),
|
text: "设备信息已更新! DeviceFp: " + appStore.deviceInfo.device_fp,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ import type { Event } from "@tauri-apps/api/event";
|
|||||||
import { WebviewWindow } from "@tauri-apps/api/window";
|
import { WebviewWindow } from "@tauri-apps/api/window";
|
||||||
|
|
||||||
import { getDeviceInfo } from "./toolFunc";
|
import { getDeviceInfo } from "./toolFunc";
|
||||||
|
import { useAppStore } from "../store/modules/app";
|
||||||
import { useUserStore } from "../store/modules/user";
|
import { useUserStore } from "../store/modules/user";
|
||||||
import TGConstant from "../web/constant/TGConstant";
|
import TGConstant from "../web/constant/TGConstant";
|
||||||
import TGRequest from "../web/request/TGRequest";
|
import TGRequest from "../web/request/TGRequest";
|
||||||
@@ -328,13 +329,16 @@ class TGClient {
|
|||||||
*/
|
*/
|
||||||
async getHTTPRequestHeaders(callback: string): Promise<void> {
|
async getHTTPRequestHeaders(callback: string): Promise<void> {
|
||||||
const localFp = getDeviceInfo("device_fp");
|
const localFp = getDeviceInfo("device_fp");
|
||||||
if (localFp === "0000000000000") await TGRequest.Device.getFp();
|
let deviceInfo = useAppStore().deviceInfo;
|
||||||
|
if (localFp === "0000000000000") {
|
||||||
|
deviceInfo = await TGRequest.Device.getFp(deviceInfo);
|
||||||
|
}
|
||||||
const data = {
|
const data = {
|
||||||
"user-agent": TGConstant.BBS.UA_MOBILE,
|
"user-agent": TGConstant.BBS.UA_MOBILE,
|
||||||
"x-rpc-client_type": "5",
|
"x-rpc-client_type": "5",
|
||||||
"x-rpc-device_id": getDeviceInfo("device_id"),
|
"x-rpc-device_id": deviceInfo.device_id,
|
||||||
"x-rpc-app_version": TGConstant.BBS.VERSION,
|
"x-rpc-app_version": TGConstant.BBS.VERSION,
|
||||||
"x-rpc-device_fp": getDeviceInfo("device_fp"),
|
"x-rpc-device_fp": deviceInfo.device_fp,
|
||||||
};
|
};
|
||||||
await this.callback(callback, data);
|
await this.callback(callback, data);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,10 +12,13 @@ import TGConstant from "../constant/TGConstant";
|
|||||||
/**
|
/**
|
||||||
* @description 获取设备指纹
|
* @description 获取设备指纹
|
||||||
* @since Beta v0.3.6
|
* @since Beta v0.3.6
|
||||||
* @returns {Promise<TGApp.BBS.Response.getDeviceFp>} 设备指纹
|
* @param {TGApp.App.Device.DeviceInfo} Info - 设备信息
|
||||||
|
* @returns {Promise<string>} 设备指纹
|
||||||
*/
|
*/
|
||||||
export async function getDeviceFp(): Promise<void> {
|
export async function getDeviceFp(
|
||||||
const info = getInitDeviceInfo();
|
Info?: TGApp.App.Device.DeviceInfo,
|
||||||
|
): Promise<TGApp.App.Device.DeviceInfo> {
|
||||||
|
const info = Info ?? getInitDeviceInfo();
|
||||||
const deviceFPHeader = {
|
const deviceFPHeader = {
|
||||||
cpuType: "arm64-v8a",
|
cpuType: "arm64-v8a",
|
||||||
romCapacity: "512",
|
romCapacity: "512",
|
||||||
@@ -78,5 +81,5 @@ export async function getDeviceFp(): Promise<void> {
|
|||||||
if (res.data.data.code === 200) return res.data.data.device_fp;
|
if (res.data.data.code === 200) return res.data.data.device_fp;
|
||||||
return "0000000000000";
|
return "0000000000000";
|
||||||
});
|
});
|
||||||
localStorage.setItem("deviceInfo", JSON.stringify({ deviceInfo: info }));
|
return info;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user