mirror of
https://github.com/lWolvesl/antigravity-usage-monitor.git
synced 2026-11-27 01:19:25 +08:00
feat(panel): add formula-safe CSV/Markdown export, compact vertical action menus, and local file export with reveal toast
This commit is contained in:
@@ -71,6 +71,7 @@ const overlayMethods = Object.fromEntries(
|
||||
);
|
||||
|
||||
const BRIDGE_MAX_BODY_BYTES = 64 * 1024;
|
||||
const BRIDGE_MAX_EXPORT_BODY_BYTES = 8 * 1024 * 1024;
|
||||
const ALLOWED_BRIDGE_PATHS = new Set(BRIDGE_API_PATHS);
|
||||
|
||||
/**
|
||||
@@ -1342,12 +1343,16 @@ export function createWindowBridgeController(options) {
|
||||
return;
|
||||
}
|
||||
|
||||
const maxBodyBytes =
|
||||
parsedUrl.pathname === '/api/export-file'
|
||||
? BRIDGE_MAX_EXPORT_BODY_BYTES
|
||||
: BRIDGE_MAX_BODY_BYTES;
|
||||
const chunks = [];
|
||||
let totalBytes = 0;
|
||||
let aborted = false;
|
||||
req.on('data', (chunk) => {
|
||||
totalBytes += chunk.length;
|
||||
if (totalBytes > BRIDGE_MAX_BODY_BYTES) {
|
||||
if (totalBytes > maxBodyBytes) {
|
||||
aborted = true;
|
||||
res.writeHead(413, { 'Content-Type': 'application/json' });
|
||||
res.end(JSON.stringify({ error: 'Payload too large' }));
|
||||
|
||||
Reference in New Issue
Block a user