mirror of
https://github.com/BTMuli/TeyvatGuide.git
synced 2025-12-13 09:28:14 +08:00
🚧 继续调试验证
This commit is contained in:
@@ -5,7 +5,7 @@
|
||||
*/
|
||||
|
||||
import { h, render, type VNode } from "vue";
|
||||
import geetest, { type GeetestParam } from "./geetest.vue";
|
||||
import geetest from "./geetest.vue";
|
||||
|
||||
const geetestId = "tg-func-geetest";
|
||||
|
||||
@@ -20,13 +20,13 @@ const renderBox = (): VNode => {
|
||||
|
||||
let geetestInstance: VNode;
|
||||
|
||||
const showGeetest = async (props: GeetestParam): Promise<string | boolean> => {
|
||||
const showGeetest = async (): Promise<boolean> => {
|
||||
if (geetestInstance) {
|
||||
const boxVue = geetestInstance.component;
|
||||
return boxVue?.exposeProxy?.displayBox();
|
||||
} else {
|
||||
geetestInstance = renderBox();
|
||||
return await showGeetest(props);
|
||||
return await showGeetest();
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -26,10 +26,6 @@ const showInner = ref<boolean>(false);
|
||||
|
||||
const userStore = useUserStore();
|
||||
|
||||
export interface GeetestParam {
|
||||
urlOri: string;
|
||||
}
|
||||
|
||||
const geetestRef = ref<HTMLElement>(<HTMLElement>document.getElementById("geetest"));
|
||||
|
||||
watch(show, () => {
|
||||
@@ -48,7 +44,7 @@ watch(show, () => {
|
||||
}
|
||||
});
|
||||
|
||||
async function displayBox(urlOri: string): Promise<boolean> {
|
||||
async function displayBox(): Promise<boolean> {
|
||||
const cookie = userStore.getCookieGroup3();
|
||||
const res = await TGRequest.User.verification.get(cookie.ltoken, cookie.ltuid);
|
||||
if ("retcode" in res) {
|
||||
@@ -76,7 +72,7 @@ async function displayBox(urlOri: string): Promise<boolean> {
|
||||
captchaObj.appendTo("#geetest");
|
||||
captchaObj.onSuccess(async () => {
|
||||
const validate = captchaObj.getValidate();
|
||||
const res = TGRequest.User.verification.verify(urlOri, userStore.cookie, validate);
|
||||
const res = TGRequest.User.verification.verify(userStore.cookie, validate);
|
||||
resolve(res);
|
||||
});
|
||||
captchaObj.onClose(() => {
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
import TGUtils from "../utils/TGUtils";
|
||||
import { http } from "@tauri-apps/api";
|
||||
import showSnackbar from "../../components/func/snackbar";
|
||||
import TGConstant from "../constant/TGConstant";
|
||||
|
||||
/**
|
||||
* @description 发起验证请求
|
||||
@@ -41,13 +42,11 @@ export async function getVerification(
|
||||
* @description 将验证完的参数提交给米游社
|
||||
* @since Beta v0.3.3
|
||||
* @todo 待测试
|
||||
* @param {string} urlOri 原始 url
|
||||
* @param {Record<string, string>} cookie cookie
|
||||
* @param {TGApp.BBS.Geetest.GeetestValidate} validate 验证码参数
|
||||
* @return {Promise<boolean>} 提交结果
|
||||
*/
|
||||
export async function submitVerification(
|
||||
urlOri: string,
|
||||
cookie: Record<string, string>,
|
||||
validate: TGApp.BBS.Geetest.GeetestValidate,
|
||||
): Promise<boolean> {
|
||||
@@ -59,13 +58,16 @@ export async function submitVerification(
|
||||
};
|
||||
const data = JSON.stringify(dataRaw);
|
||||
const header = TGUtils.User.getHeader(cookie, "POST", data, "common", false);
|
||||
header["x-rpc-client_type"] = "2";
|
||||
const reqHeader = {
|
||||
...header,
|
||||
"x-rpc-challenge_game": "2",
|
||||
"x-rpc-app_id": TGConstant.BBS.APP_ID,
|
||||
"x-rpc-challenge": validate.geetest_challenge,
|
||||
"x-rpc-validate": validate.geetest_validate,
|
||||
"x-rpc-seccode": validate.geetest_seccode,
|
||||
"x-rpc-challenge_path": urlOri,
|
||||
"x-rpc-game_biz": "hk4e_cn",
|
||||
"x-rpc-sdk_version": "1.3.1.2",
|
||||
"x-rpc-device_id": "FA47BE878C143D2FE18785B660EF114A",
|
||||
};
|
||||
console.log(reqHeader);
|
||||
return await http
|
||||
@@ -81,6 +83,7 @@ export async function submitVerification(
|
||||
text: `[${res.data.retcode}] ${res.data.message}`,
|
||||
color: "error",
|
||||
});
|
||||
console.log(res.data);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
|
||||
Reference in New Issue
Block a user