mirror of
https://github.com/LLM-Red-Team/kimi-free-api.git
synced 2024-11-01 18:29:19 +08:00
headers补充
This commit is contained in:
parent
2f2f9d0d5d
commit
b4e8b489ec
@ -16,9 +16,18 @@ const MODEL_NAME = 'kimi';
|
||||
const ACCESS_TOKEN_EXPIRES = 300;
|
||||
// 伪装headers
|
||||
const FAKE_HEADERS = {
|
||||
'Accept': '*/*',
|
||||
'Accept-Encoding': 'gzip, deflate, br, zstd',
|
||||
'Accept-Language': 'zh-CN,zh;q=0.9',
|
||||
'Origin': 'https://kimi.moonshot.cn',
|
||||
'Cookie': util.generateCookie(),
|
||||
'R-Timezone': 'Asia/Shanghai',
|
||||
'Sec-Ch-Ua': '"Chromium";v="122", "Not(A:Brand";v="24", "Google Chrome";v="122"',
|
||||
'Sec-Ch-Ua-Mobile': '?0',
|
||||
'Sec-Ch-Ua-Platform': '"Windows"',
|
||||
'Sec-Fetch-Dest': 'empty',
|
||||
'Sec-Fetch-Mode': 'cors',
|
||||
'Sec-Fetch-Site': 'same-origin',
|
||||
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/122.0.0.0 Safari/537.36'
|
||||
};
|
||||
// 文件最大大小
|
||||
|
@ -6,7 +6,6 @@ import "@/lib/initialize.ts";
|
||||
import server from "@/lib/server.ts";
|
||||
import routes from "@/api/routes/index.ts";
|
||||
import logger from "@/lib/logger.ts";
|
||||
import util from "@/lib/util.ts";
|
||||
|
||||
const startupTime = performance.now();
|
||||
|
||||
|
@ -47,6 +47,20 @@ const util = {
|
||||
return value.headers ? (value.headers["content-type"] || value.headers["Content-Type"]) : null;
|
||||
},
|
||||
|
||||
generateCookie() {
|
||||
const timestamp = util.unixTimestamp();
|
||||
const items = [
|
||||
`Hm_lvt_4532beacc312859e0aa3e4a80566b706=${timestamp - Math.round(Math.random() * 2592000)}`,
|
||||
`Hm_lvt_358cae4815e85d48f7e8ab7f3680a74b=${timestamp - Math.round(Math.random() * 2592000)}`,
|
||||
`_ga=GA1.1.${util.generateRandomString({ length: 10, charset: 'numeric' })}.${timestamp - Math.round(Math.random() * 2592000)}`,
|
||||
`_ga_31QPQG2YYD=GS1.1.${timestamp - Math.round(Math.random() * 2592000)}.17.0.${timestamp - Math.round(Math.random() * 2592000)}.0.0.0`,
|
||||
`Hm_lpvt_4532beacc312859e0aa3e4a80566b706=${timestamp - Math.round(Math.random() * 2592000)}`,
|
||||
`Hm_lpvt_358cae4815e85d48f7e8ab7f3680a74b=${timestamp - Math.round(Math.random() * 2592000)}`,
|
||||
`_ga_YXD8W70SZP=GS1.1.${timestamp - Math.round(Math.random() * 2592000)}.35.1.${timestamp - Math.round(Math.random() * 2592000)}.0.0.0`
|
||||
];
|
||||
return items.join('; ');
|
||||
},
|
||||
|
||||
mimeToExtension(value: string) {
|
||||
let extension = mime.getExtension(value);
|
||||
if(extension == "mpga")
|
||||
|
Loading…
Reference in New Issue
Block a user