feat: reject >100MB video highway upload

This commit is contained in:
pk5ls20 2024-10-25 08:59:56 +08:00
parent 2d46e55b9b
commit b9f2cc5142
No known key found for this signature in database
GPG Key ID: 6370ED7A169F493A

View File

@ -105,6 +105,9 @@ export class PacketHighwaySession {
async uploadVideo(peer: Peer, video: PacketMsgVideoElement): Promise<void> {
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) {
await this.uploadGroupVideoReq(+peer.peerUid, video);
} else if (peer.chatType === ChatType.KCHATTYPEC2C) {