BREAKING: change API to Android client

This commit is contained in:
Zichao Lin 2023-10-22 14:47:26 +08:00
parent 88d4474728
commit ef7235c006
Signed by: earthjasonlin
GPG Key ID: 406D9913DE2E42FB
2 changed files with 13 additions and 22 deletions

@ -4,11 +4,11 @@ const { default: axios } = require("axios");
const { log } = require("./util"); const { log } = require("./util");
exports.ListNotificationURL = exports.ListNotificationURL =
"https://api-cloudgame.mihoyo.com/hk4e_cg_cn/gamer/api/listNotifications?is_sort=true&source=NotificationSourceUnknown&status=NotificationStatusUnread&type=NotificationTypePopup"; "https://api-cloudgame.mihoyo.com/hk4e_cg_cn/gamer/api/listNotifications?status=NotificationStatusUnread&type=NotificationTypePopup&is_sort=true";
exports.AckNotificationURL = exports.AckNotificationURL =
"https://api-cloudgame.mihoyo.com/hk4e_cg_cn/gamer/api/ackNotification"; "https://api-cloudgame.mihoyo.com/hk4e_cg_cn/gamer/api/ackNotification";
exports.WalletURL = exports.WalletURL =
"https://api-cloudgame.mihoyo.com/hk4e_cg_cn/wallet/wallet/get?cost_method=COST_METHOD_UNSPECIFIED"; "https://api-cloudgame.mihoyo.com/hk4e_cg_cn/wallet/wallet/get?cost_method=0";
exports.AnnouncementURL = exports.AnnouncementURL =
"https://api-cloudgame.mihoyo.com/hk4e_cg_cn/gamer/api/getAnnouncementInfo"; "https://api-cloudgame.mihoyo.com/hk4e_cg_cn/gamer/api/getAnnouncementInfo";
// Here must be an earlier version so that the response won't be null // Here must be an earlier version so that the response won't be null
@ -39,15 +39,7 @@ exports.Wallet = async function (header) {
tmp.StringVersion = JSON.stringify(tmp); tmp.StringVersion = JSON.stringify(tmp);
return tmp; return tmp;
}; };
exports.Announcement = async function (header) {
let tmp = (
await axios(exports.AnnouncementURL, {
headers: header,
})
).data;
tmp.StringVersion = JSON.stringify(tmp);
return tmp;
};
exports.AppVersion = async function () { exports.AppVersion = async function () {
let tmp = (await axios(exports.AppVersionURL)).data; let tmp = (await axios(exports.AppVersionURL)).data;
tmp.StringVersion = JSON.stringify(tmp); tmp.StringVersion = JSON.stringify(tmp);
@ -129,15 +121,14 @@ exports.makeHeader = function (data, appversion) {
"x-rpc-device_model": data.device_model, "x-rpc-device_model": data.device_model,
"x-rpc-app_id": 1953439974, "x-rpc-app_id": 1953439974,
"x-rpc-cg_game_biz": "hk4e_cn", "x-rpc-cg_game_biz": "hk4e_cn",
"x-rpc-preview": 0,
"x-rpc-op_biz": "clgm_cn", "x-rpc-op_biz": "clgm_cn",
"x-rpc-language": "zh-cn", "x-rpc-language": "zh-cn",
"x-rpc-vendor_id": 2, "x-rpc-vendor_id": 1,
Referer: "https://app.mihoyo.com", "x-rpc-cps": "cyydmihoyo",
Host: "api-cloudgame.mihoyo.com", Host: "api-cloudgame.mihoyo.com",
Connection: "Keep-Alive", Connection: "Keep-Alive",
"Accept-Encoding": "gzip, deflate", "Accept-Encoding": "gzip, deflate",
Accept: "*/*", "User-Agent": "okhttp/4.10.0"
}; };
}; };

@ -83,7 +83,7 @@ const nodemailer = require("nodemailer");
let postHeader = header; let postHeader = header;
Object.assign(postHeader, { Object.assign(postHeader, {
"Content-Length": 28, "Content-Length": 28,
"Content-Type": "application/json", "Content-Type": "application/json; charset=UTF-8",
}); });
for (var i = 0; i < NotificationLength; i++) { for (var i = 0; i < NotificationLength; i++) {
AckNotification( AckNotification(