Skip to content
This repository has been archived by the owner on Nov 2, 2023. It is now read-only.

Commit

Permalink
Merge pull request #65 from takayama-lily/dev
Browse files Browse the repository at this point in the history
-
  • Loading branch information
takayama-lily authored Oct 6, 2020
2 parents 3d124c9 + f706b0b commit adb71c4
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 14 deletions.
1 change: 1 addition & 0 deletions lib/message/builder.js
Original file line number Diff line number Diff line change
Expand Up @@ -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};

Expand Down
26 changes: 14 additions & 12 deletions lib/message/service.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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);
Expand Down Expand Up @@ -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", {
Expand All @@ -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;
}
Expand Down Expand Up @@ -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 = [];
Expand All @@ -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);
}
});
}
Expand All @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion package-lock.json

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

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "oicq",
"version": "1.8.9",
"version": "1.8.10",
"description": "QQ protocol!",
"main": "client.js",
"scripts": {
Expand Down

0 comments on commit adb71c4

Please sign in to comment.