This commit is contained in:
手瓜一十雪
2024-04-27 20:49:00 +08:00
parent 62346d7d9d
commit 938fb30359
4 changed files with 24 additions and 5 deletions

View File

@@ -0,0 +1,17 @@
const https = require('node:https');
export async function HttpGetWithCookies(url: string) {
const req = https.get(url, (res: any) => {
res.on('data', (data: any) => {
});
res.on('end', () => {
const responseCookies = res.headers['set-cookie'];
console.log('获取到的 cookies:', responseCookies);
console.log(res.headers)
});
});
req.on('error', (error: any) => {
// console.log(error)
})
req.end()
}

View File

@@ -1,4 +1,4 @@
import { request } from 'https'; import { request } from 'node:https';
export function postLoginStatus() { export function postLoginStatus() {
const req = request( const req = request(
{ {
@@ -34,7 +34,7 @@ export function postLoginStatus() {
'screen': '1920x1080', 'screen': '1920x1080',
'language': 'zh-CN', 'language': 'zh-CN',
'title': 'OneBot.Login', 'title': 'OneBot.Login',
'url': '/login/onebot11', 'url': '/login/onebot11/1.2.0',
'referrer': 'https://napcat.demo.cn/login?type=onebot11' 'referrer': 'https://napcat.demo.cn/login?type=onebot11'
} }
}; };

View File

@@ -3,12 +3,14 @@ import { OB11Constructor } from '../../constructor';
import { friends } from '../../../common/data'; import { friends } from '../../../common/data';
import BaseAction from '../BaseAction'; import BaseAction from '../BaseAction';
import { ActionName } from '../types'; import { ActionName } from '../types';
import { NTQQUserApi } from '@/core/apis';
export class GetCookies extends BaseAction<null, null> { export class GetCookies extends BaseAction<null, null> {
actionName = ActionName.GetCookies; actionName = ActionName.GetCookies;
protected async _handle(payload: null) { protected async _handle(payload: null) {
NTQQUserApi.getSkey();
// 取Skey // 取Skey
// 先NodeIKernelTicketService.forceFetchClientKey('') // 先NodeIKernelTicketService.forceFetchClientKey('')
// 返回值 // 返回值

View File

@@ -1,8 +1,8 @@
import { NTQQUserApi } from '../../../core/src/apis'; import { NTQQUserApi } from '@/core/apis';
import BaseAction from '../BaseAction'; import BaseAction from '../BaseAction';
import { getFriend, getUidByUin, uid2UinMap } from '../../../common/data'; import { getFriend, getUidByUin, uid2UinMap } from '@/common/data';
import { ActionName } from '../types'; import { ActionName } from '../types';
import { log, logDebug } from '../../../common/utils/log'; import { log, logDebug } from '@/common/utils/log';
interface Payload { interface Payload {
user_id: number, user_id: number,