From 49c716f009c4ff5abcefe1c5556be0a7ff4f66d5 Mon Sep 17 00:00:00 2001 From: BTMuli Date: Mon, 2 Oct 2023 22:56:12 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=9A=A7=20=E7=BB=A7=E7=BB=AD=E8=B0=83?= =?UTF-8?q?=E8=AF=95=E9=AA=8C=E8=AF=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/func/geetest.ts | 6 +++--- src/components/func/geetest.vue | 8 ++------ src/web/request/operVerification.ts | 11 +++++++---- 3 files changed, 12 insertions(+), 13 deletions(-) diff --git a/src/components/func/geetest.ts b/src/components/func/geetest.ts index cff1f0ad..b5c3de1b 100644 --- a/src/components/func/geetest.ts +++ b/src/components/func/geetest.ts @@ -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 => { +const showGeetest = async (): Promise => { if (geetestInstance) { const boxVue = geetestInstance.component; return boxVue?.exposeProxy?.displayBox(); } else { geetestInstance = renderBox(); - return await showGeetest(props); + return await showGeetest(); } }; diff --git a/src/components/func/geetest.vue b/src/components/func/geetest.vue index 2e74b899..7004274b 100644 --- a/src/components/func/geetest.vue +++ b/src/components/func/geetest.vue @@ -26,10 +26,6 @@ const showInner = ref(false); const userStore = useUserStore(); -export interface GeetestParam { - urlOri: string; -} - const geetestRef = ref(document.getElementById("geetest")); watch(show, () => { @@ -48,7 +44,7 @@ watch(show, () => { } }); -async function displayBox(urlOri: string): Promise { +async function displayBox(): Promise { 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 { 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(() => { diff --git a/src/web/request/operVerification.ts b/src/web/request/operVerification.ts index 0d1fa69a..27547200 100644 --- a/src/web/request/operVerification.ts +++ b/src/web/request/operVerification.ts @@ -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} cookie cookie * @param {TGApp.BBS.Geetest.GeetestValidate} validate 验证码参数 * @return {Promise} 提交结果 */ export async function submitVerification( - urlOri: string, cookie: Record, validate: TGApp.BBS.Geetest.GeetestValidate, ): Promise { @@ -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;