plugins/website/control-panel/request-limits.mjs
2026-11-27 23:43:05 +00:00

11 lines
575 B
JavaScript

export function panelBodyLimit(method,path){
if(method!=='POST')return 65536;
if(path==='/api/internal-mail/messages/send')return 32*1024*1024;
if(path==='/api/items/kitsets')return 128*1024;
// Emblem endpoints enforce their own raster validation and 2 MB image cap.
if(/^\/api\/(?:clan|company)-emblems\/[a-f0-9]{8}(?:-[a-f0-9]{4}){3}-[a-f0-9]{12}$/i.test(path))return 2*1024*1024;
if(path==='/api/ban-evidence')return 7*1024*1024;
// A validated 2 MB image plus bounded multipart headers.
if(path==='/api/account/avatar')return 2*1024*1024+65536;
return 65536;
}