From 9a33039d73eb6c74fa84eca17af6ae0353a60bdc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=89=8B=E7=93=9C=E4=B8=80=E5=8D=81=E9=9B=AA?= Date: Thu, 5 Dec 2024 14:45:12 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E6=9A=82=E6=97=B6=E7=A7=BB=E9=99=A4=20Q?= =?UTF-8?q?unAlbum?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/core/apis/webapi.ts | 46 ----------------------------------------- 1 file changed, 46 deletions(-) diff --git a/src/core/apis/webapi.ts b/src/core/apis/webapi.ts index 8cb147b1..933a0941 100644 --- a/src/core/apis/webapi.ts +++ b/src/core/apis/webapi.ts @@ -366,50 +366,4 @@ export class NTQQWebApi { return post; } - - async uploadQunAlbumSlice(path: string, session: string, skey: string, pskey: string, uin: string, slice_size: number) { - const img_size = statSync(path).size; - const img_name = basename(path); - let seq = 0; - let offset = 0; - const GTK = this.getBknFromSKey(pskey); - const cookie = `p_uin=${uin}; p_skey=${pskey}; skey=${skey}; uin=${uin}`; - - const stream = createReadStream(path, { highWaterMark: slice_size }); - - for await (const chunk of stream) { - const end = Math.min(offset + chunk.length, img_size); - const boundary = `----WebKitFormBoundary${Math.random().toString(36).substring(2)}`; - const formData = await RequestUtil.createFormData(boundary, path); - - const api = `https://h5.qzone.qq.com/webapp/json/sliceUpload/FileUpload?seq=${seq}&retry=0&offset=${offset}&end=${end}&total=${img_size}&type=form&g_tk=${GTK}`; - const body = { - uin: uin, - appid: "qun", - session: session, - offset: offset, - data: formData, - checksum: "", - check_type: 0, - retry: 0, - seq: seq, - end: end, - cmd: "FileUpload", - slice_size: slice_size, - "biz_req.iUploadType": 0 - }; - - const post = await RequestUtil.HttpGetJson(api, 'POST', body, { - "Cookie": cookie, - "Content-Type": `multipart/form-data; boundary=${boundary}` - }); - - offset += chunk.length; - seq++; - } - } - async uploadQunAlbum(path: string, albumId: string, group: string, skey: string, pskey: string, uin: string) { - const session = (await this.createQunAlbumSession(group, albumId, group, path, skey, pskey, uin) as { data: { session: string } }).data.session; - return await this.uploadQunAlbumSlice(path, session, skey, pskey, uin, 1024 * 1024); - } }