mirror of
https://github.com/Ark0N/Codeman.git
synced 2026-10-06 23:49:41 +02:00
feat(mobile): large + multi-image uploads from the camera-roll picker
The mobile copy/paste overlay's "🖼 Image" button (and drag-drop / paste) now handles real-world photo batches: - Up to 20 images per batch, uploaded with bounded concurrency (3) and a live "Uploading N/M…" progress toast; a final summary reports successes, any failures, and whether the 20-cap trimmed the selection (no silent truncation). - Per-file upload limit raised 10MB → 50MB (MAX_PASTE_IMAGE_BYTES in buffer-limits.ts, env-overridable) so full-resolution phone photos and large screenshots aren't rejected. - Very large images are downscaled to <=4096px longest edge before upload: fixes iOS Safari's ~16.7M-px <canvas> limit (which made huge photos fail to re-encode and fall back to an original that tripped the magic-byte check), and keeps batch uploads fast and small. - Fix a latent concurrency bug the batch path exposed: the first parallel uploads to a session raced on `mkdir(.claude-images)` and the EEXIST losers 500'd. mkdir now treats an existing real directory as success (re-verifying it isn't a planted symlink), so concurrent uploads succeed. Verified end-to-end in a real browser (Playwright): downscale, >10MB server acceptance, 20-cap, 20/20 concurrent uploads landing on disk. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
+3
-2
@@ -128,6 +128,7 @@ import {
|
||||
} from '../utils/index.js';
|
||||
import type { EventLoopMonitorHandle } from '../utils/index.js';
|
||||
import { MAX_CONCURRENT_SESSIONS, MAX_SSE_CLIENTS } from '../config/map-limits.js';
|
||||
import { MAX_PASTE_IMAGE_BYTES } from '../config/buffer-limits.js';
|
||||
import { SseEvent } from './sse-events.js';
|
||||
import { getLatestPlanUsage } from './plan-usage-latest.js';
|
||||
import type { ScheduledRun } from './ports/index.js';
|
||||
@@ -679,8 +680,8 @@ export class WebServer extends EventEmitter {
|
||||
// last byte (hard-coded \r\n offsets), and there was no part-count cap.
|
||||
await this.app.register(fastifyMultipart, {
|
||||
limits: {
|
||||
fileSize: 10 * 1024 * 1024, // 10MB per file
|
||||
files: 1, // paste-image only ever sends one file
|
||||
fileSize: MAX_PASTE_IMAGE_BYTES, // per file (default 50MB) — large phone photos / screenshots
|
||||
files: 1, // paste-image sends one file per request (clients batch up to 20 requests)
|
||||
fields: 4, // small headroom for accompanying form fields
|
||||
},
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user