feat(whatsapp): add configurable media max size
- Add whatsapp.mediaMaxMb config option (default: 50MB) - Increases default from previous 5MB hardcoded limit - Allows receiving larger documents/media files - Per-account override via whatsapp.accounts.*.mediaMaxMb Fixes #<issue-number> (if applicable)
This commit is contained in:
committed by
Peter Steinberger
parent
da2323f80e
commit
3026367c1b
@@ -83,6 +83,7 @@ export async function monitorWebInbox(options: {
|
||||
accountId: string;
|
||||
authDir: string;
|
||||
onMessage: (msg: WebInboundMessage) => Promise<void>;
|
||||
mediaMaxMb?: number;
|
||||
}) {
|
||||
const inboundLogger = getChildLogger({ module: "web-inbound" });
|
||||
const inboundConsoleLog = createSubsystemLogger(
|
||||
@@ -375,9 +376,12 @@ export async function monitorWebInbox(options: {
|
||||
try {
|
||||
const inboundMedia = await downloadInboundMedia(msg, sock);
|
||||
if (inboundMedia) {
|
||||
const maxBytes = (options.mediaMaxMb ?? 50) * 1024 * 1024;
|
||||
const saved = await saveMediaBuffer(
|
||||
inboundMedia.buffer,
|
||||
inboundMedia.mimetype,
|
||||
"inbound",
|
||||
maxBytes,
|
||||
);
|
||||
mediaPath = saved.path;
|
||||
mediaType = inboundMedia.mimetype;
|
||||
|
||||
Reference in New Issue
Block a user