Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
MliKiowa committed Apr 28, 2024
1 parent 36e1317 commit 93ab9d1
Show file tree
Hide file tree
Showing 95 changed files with 207 additions and 166 deletions.
4 changes: 2 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
3. 支持了好友添加上报事件 - 新增 Event: AddFriend
4. 重构了商城表情URL拼接 - 重构 API: /
5. 重构了Core日志与服务调用部分 - 重构 SYS: Log
6. 适配最新版Win 9.9.9 23159 提升了兼容性 - 修复 SYS: Listener
7. 表情回应api和上报 - 新增 Event/API
6. 适配最新版Win 9.9.9 23159 提升了兼容性 - 修复 SYS: Listener Proxy
7. 新增表情回应api和上报 - 新增 Event/API
8. 支持获取Cookies 实现更加稳定 - 新增 API: /get_cookies
9. 新增wsHost和httpHost配置 - 新增 CONFIG: New
10. 新增获取官方Bot账号范围 - 新增 API: /get_robot_uin_range
Expand Down
96 changes: 48 additions & 48 deletions src/common/utils/request.ts
Original file line number Diff line number Diff line change
@@ -1,57 +1,57 @@
const https = require('node:https');
export async function HttpGetWithCookies(url: string): Promise<Map<string, string>> {
return new Promise((resolve, reject) => {
let result: Map<string, string> = new Map<string, string>();
const req = https.get(url, (res: any) => {
res.on('data', (data: any) => {
});
res.on('end', () => {
try {
const responseCookies = res.headers['set-cookie'];
for (const line of responseCookies) {
const parts = line.split(';');
const [key, value] = parts[0].split('=');
result.set(key, value);
}
} catch (e) {
}
resolve(result);
return new Promise((resolve, reject) => {
const result: Map<string, string> = new Map<string, string>();
const req = https.get(url, (res: any) => {
res.on('data', (data: any) => {
});
res.on('end', () => {
try {
const responseCookies = res.headers['set-cookie'];
for (const line of responseCookies) {
const parts = line.split(';');
const [key, value] = parts[0].split('=');
result.set(key, value);
}
} catch (e) {
}
resolve(result);

});
});
req.on('error', (error: any) => {
resolve(result);
// console.log(error)
})
req.end()
})
});
});
req.on('error', (error: any) => {
resolve(result);
// console.log(error)
});
req.end();
});

}
export async function HttpPostCookies(url: string): Promise<Map<string, string>> {
return new Promise((resolve, reject) => {
let result: Map<string, string> = new Map<string, string>();
const req = https.get(url, (res: any) => {
res.on('data', (data: any) => {
});
res.on('end', () => {
try {
const responseCookies = res.headers['set-cookie'];
for (const line of responseCookies) {
const parts = line.split(';');
const [key, value] = parts[0].split('=');
result.set(key, value);
}
} catch (e) {
}
resolve(result);
return new Promise((resolve, reject) => {
const result: Map<string, string> = new Map<string, string>();
const req = https.get(url, (res: any) => {
res.on('data', (data: any) => {
});
res.on('end', () => {
try {
const responseCookies = res.headers['set-cookie'];
for (const line of responseCookies) {
const parts = line.split(';');
const [key, value] = parts[0].split('=');
result.set(key, value);
}
} catch (e) {
}
resolve(result);

});
});
req.on('error', (error: any) => {
resolve(result);
// console.log(error)
})
req.end()
})
});
});
req.on('error', (error: any) => {
resolve(result);
// console.log(error)
});
req.end();
});

}
2 changes: 1 addition & 1 deletion src/core.lib/src/adapters/NodeIDependsAdapter.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion src/core.lib/src/adapters/NodeIDispatcherAdapter.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion src/core.lib/src/adapters/NodeIGlobalAdapter.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion src/core.lib/src/adapters/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 93ab9d1

Please sign in to comment.