diff --git a/lib/message/builder.js b/lib/message/builder.js index 9b6f3413..707fb71d 100644 --- a/lib/message/builder.js +++ b/lib/message/builder.js @@ -152,6 +152,7 @@ async function buildImageMessage(chain, cq, group_id, is_flash = false) { downloadPath: "", pbReserve: Buffer.from([0x78, 0x02]), flag: BUF4, + oldPicMd5: false, } const elem = group_id ? {customFace: nest} : {notOnlineImage: nest}; diff --git a/lib/message/service.js b/lib/message/service.js index c5ad9eb5..ba4f5fb8 100644 --- a/lib/message/service.js +++ b/lib/message/service.js @@ -41,7 +41,7 @@ function buildHighwayUploadRequestPackets(uin, o, cmd, seq = common.rand()) { uin: uin, command: "PicUp.DataUp", seq: seq++, - appid: 537062409, + appid: 537062845, dataflag: 4096, commandId: cmd, localeId: 2052, @@ -53,8 +53,7 @@ function buildHighwayUploadRequestPackets(uin, o, cmd, seq = common.rand()) { serviceticket: o.key, md5: common.md5(chunk), fileMd5: o.md5, - }, - reqExtendinfo: BUF0, + } }); offset += limit; const _ = Buffer.alloc(9); @@ -149,9 +148,7 @@ async function offPicUp(user_id, images) { imgOriginal: 1, imgType: 1000, buildVer: "8.2.7.4410", - fileIndex: BUF0, srvUpload: 1, - transferUrl: BUF0, }); } const body = pb.encode("OffPicUpReqBody", { @@ -169,7 +166,7 @@ async function uploadImages(target, images, is_group) { if (v.boolFileExit || !images[i].buf) continue; const index = i % v.uint32UpIp.length; v.md5 = images[i].md5, v.buf = images[i].buf, v.key = v.upUkey; - highwayUpload(this.uin, v.uint32UpIp[index], v.uint32UpPort[index], v, 2); + highwayUpload(this.uin, v.uint32UpIp[index], v.uint32UpPort[index], v, is_group?2:1); } return resp; } @@ -352,11 +349,11 @@ async function downloadFromWeb(url, timeout, mime_type, maxsize = MAX_UPLOAD_SIZ try { protocol.get(url, {timeout}, (res)=>{ if (mime_type && (!res.headers["content-type"] || !res.headers["content-type"].includes(mime_type))) { - reject(); + reject(url + " 不是合法的"+mime_type+"文件。"); return; } if (res.headers["content-length"] && res.headers["content-length"] > maxsize) { - reject(); + reject(url + " 文件体积太大。"); return; } let data = []; @@ -366,13 +363,15 @@ async function downloadFromWeb(url, timeout, mime_type, maxsize = MAX_UPLOAD_SIZ res.on("end", ()=>{ data = Buffer.concat(data); if (data.length > maxsize) - reject(); + reject(url + " 文件体积太大。"); else resolve(data); }); - }).on("error", reject); + }).on("error", (e)=>{ + reject(e.message); + }); } catch (e) { - reject(); + reject(e.message); } }); } @@ -383,7 +382,10 @@ async function downloadWebImage(url) { const mime_type = "image"; try { return await downloadFromWeb.call(this, url, timeout, mime_type); - } catch (e) {return} + } catch (e) { + this.logger.warn(e); + return; + } } async function downloadWebRecord(url) { const config = process.OICQ.config; diff --git a/package-lock.json b/package-lock.json index 675e5b98..5b7503d5 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "oicq", - "version": "1.8.9", + "version": "1.8.10", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index a2dce084..7906b923 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "oicq", - "version": "1.8.9", + "version": "1.8.10", "description": "QQ protocol!", "main": "client.js", "scripts": {