🌱 点赞

This commit is contained in:
目棃
2025-02-24 14:39:08 +08:00
parent 0f278ad25e
commit 2bafb6d491
5 changed files with 78 additions and 10 deletions

View File

@@ -103,12 +103,38 @@ async function homeNew(gid: number = 2): Promise<TGApp.BBS.Navigator.Navigator[]
).data.navigator;
}
/**
* @description 点赞
* @since Beta v0.6.10/v0.7.0
* @param {string} id 帖子 ID
* @param {Record<string,string>} cookie 用户 Cookie
* @param {boolean} cancel 是否取消点赞
* @return {Promise<TGApp.BBS.Response.Base>}
*/
async function upVotePost(
id: string,
cookie: Record<string, string>,
cancel: boolean = false,
): Promise<TGApp.BBS.Response.Base> {
const data = { is_cancel: cancel, post_id: id };
const header = {
...getRequestHeader(cookie, "POST", data, "K2", true),
"x-rpc-client_type": "2",
};
return await TGHttp<TGApp.BBS.Response.Base>(`${Mahbu}api/upvotePost`, {
method: "POST",
headers: header,
body: JSON.stringify(data),
});
}
const apiHubReq = {
vote: { info: getVotes, result: getVoteResult },
home: homeNew,
forum: getAllGamesForums,
game: getGameList,
mission: getMissions,
post: { like: upVotePost },
};
export default apiHubReq;

View File

@@ -1,7 +1,7 @@
/**
* @file web/utils/getRequestHeader.ts
* @description 获取请求头
* @since Beta v0.6.8
* @since Beta v0.6.10/v0.7.0
*/
import Md5 from "js-md5";
@@ -24,12 +24,12 @@ const enum SaltType {
/**
* @description salt 值
* @version 2.81.1
* @since Beta v0.6.10
* @version 2.82.0
* @since Beta v0.6.10/v0.7.0
*/
const Salt: Readonly<Record<keyof typeof SaltType, string>> = {
K2: "QVu5OdwEWxkq9ygpYBgDprR5tI471HWQ",
LK2: "aquFmwOjyqev4CAL6GQ2v5mdkxpCVXCY",
K2: "RGcLwIWYOQwTQPJ8Qw41kioel738ch3Z",
LK2: "1M69A7AaPUhTFCdH0D2iMatZ0MTiLmPf",
X4: "xV8v4Qu54lUKrEYFZkJhB8cuOh9Asafs",
X6: "t0qEgfub6cvueAPgR5m9aQWWVciEer7v",
PROD: "t0qEgfub6cvueAPgR5m9aQWWVciEer7v",