mirror of
https://github.com/snapotter-hq/SnapOtter.git
synced 2026-08-03 07:46:42 +02:00
fix: add progress bar and batch download to vectorize tool
The vectorize tool had a custom processing flow that bypassed the standard useToolProcessor hook -- no progress indication, no server-side batch, and the Download All ZIP relied on a client-side sequential loop. Backend: extract core logic into vectorizeBuffer(), register via registerToolProcessFn() so the /batch endpoint works with p-queue concurrency and SSE progress events. Frontend: replace custom fetch loop with useToolProcessor hook and ProgressCard, giving upload progress, per-file batch status, and automatic Download All ZIP via the existing tool-page infrastructure. Also set image/svg+xml MIME type on SVG blobs during batch ZIP extraction to ensure reliable rendering in <img> tags across browsers.
This commit is contained in:
@@ -392,7 +392,11 @@ export function useToolProcessor(toolId: string) {
|
||||
for (let i = 0; i < entries.length; i++) {
|
||||
const processedName = fileResults[String(i)];
|
||||
if (processedName && extracted[processedName]) {
|
||||
const blob = new Blob([extracted[processedName] as BlobPart]);
|
||||
const blobType = processedName.endsWith(".svg") ? "image/svg+xml" : undefined;
|
||||
const blob = new Blob(
|
||||
[extracted[processedName] as BlobPart],
|
||||
blobType ? { type: blobType } : undefined,
|
||||
);
|
||||
updateEntry(i, {
|
||||
processedUrl: URL.createObjectURL(blob),
|
||||
processedFilename: processedName,
|
||||
|
||||
Reference in New Issue
Block a user