mirror of
https://github.com/NapNeko/NapCatQQ.git
synced 2024-11-21 09:36:35 +00:00
feat: reject >100MB video highway upload
This commit is contained in:
parent
2d46e55b9b
commit
b9f2cc5142
@ -105,6 +105,9 @@ export class PacketHighwaySession {
|
|||||||
|
|
||||||
async uploadVideo(peer: Peer, video: PacketMsgVideoElement): Promise<void> {
|
async uploadVideo(peer: Peer, video: PacketMsgVideoElement): Promise<void> {
|
||||||
await this.checkAvailable();
|
await this.checkAvailable();
|
||||||
|
if (+(video.fileSize ?? 0) > 1024 * 1024 * 100) {
|
||||||
|
throw new Error(`[Highway] 视频文件过大: ${(+(video.fileSize ?? 0) / (1024 * 1024)).toFixed(2)} MB > 100 MB,请使用文件上传!`);
|
||||||
|
}
|
||||||
if (peer.chatType === ChatType.KCHATTYPEGROUP) {
|
if (peer.chatType === ChatType.KCHATTYPEGROUP) {
|
||||||
await this.uploadGroupVideoReq(+peer.peerUid, video);
|
await this.uploadGroupVideoReq(+peer.peerUid, video);
|
||||||
} else if (peer.chatType === ChatType.KCHATTYPEC2C) {
|
} else if (peer.chatType === ChatType.KCHATTYPEC2C) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user