Skip to content

Commit

Permalink
Merge branch 'refs/heads/rainbowcat' into feat/napcat
Browse files Browse the repository at this point in the history
# Conflicts:
#	main/src/utils/urls.ts
  • Loading branch information
clansty committed Jul 11, 2024
2 parents 75f22b0 + f8c5907 commit 747b4de
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion main/src/models/posthog.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ else {

export default {
capture(event: string, properties: Record<string, any>) {
if (typeof properties?.error === 'object' && properties.error.stack) {
if (typeof properties?.error === 'object' && properties.error.stack && JSON.stringify(properties.error) === '{}') {
properties.error = properties.error.stack;
}
properties.repo = env.REPO;
Expand Down
6 changes: 6 additions & 0 deletions main/src/utils/urls.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import axios from 'axios';
import { Friend, Group } from '../client/QQClient';
import * as https from 'node:https';

export function getAvatarUrl(room: number | bigint | Friend | Group): string {
if (!room) return '';
Expand All @@ -22,9 +23,14 @@ export function getBigFaceUrl(file: string) {
return `https://gxh.vip.qq.com/club/item/parcel/item/${file.substring(0, 2)}/${file.substring(0, 32)}/300x300.png`;
}

const httpsAgent = new https.Agent({
rejectUnauthorized: false,
});

export async function fetchFile(url: string): Promise<Buffer> {
const res = await axios.get(url, {
responseType: 'arraybuffer',
httpsAgent,
});
return res.data;
}
Expand Down

0 comments on commit 747b4de

Please sign in to comment.