@gallop.software/studio 1.3.0 → 1.3.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -5359,7 +5359,7 @@ function useStudioActions({
5359
5359
  }
5360
5360
  }));
5361
5361
  try {
5362
- const response = await fetch("/api/studio/move-stream", {
5362
+ const response = await fetch("/api/studio/move", {
5363
5363
  method: "POST",
5364
5364
  headers: { "Content-Type": "application/json" },
5365
5365
  body: JSON.stringify({ paths, destination })
@@ -5488,7 +5488,10 @@ function useStudioActions({
5488
5488
  }, [actionState.actionPaths, clearSelection, triggerRefresh, showError, setProgressState]);
5489
5489
  const confirmProcess = useCallback5(async () => {
5490
5490
  const paths = actionState.actionPaths;
5491
- const imageKeys = paths.map((p) => "/" + p.replace(/^public\//, ""));
5491
+ const imageKeys = paths.map((p) => {
5492
+ const key = p.replace(/^public\//, "");
5493
+ return key.startsWith("/") ? key : `/${key}`;
5494
+ });
5492
5495
  setActionState((prev) => ({
5493
5496
  ...prev,
5494
5497
  showProcessConfirm: false,
@@ -5505,7 +5508,7 @@ function useStudioActions({
5505
5508
  abortControllerRef.current = new AbortController();
5506
5509
  const signal = abortControllerRef.current.signal;
5507
5510
  try {
5508
- const response = await fetch("/api/studio/process-stream", {
5511
+ const response = await fetch("/api/studio/reprocess-stream", {
5509
5512
  method: "POST",
5510
5513
  headers: { "Content-Type": "application/json" },
5511
5514
  body: JSON.stringify({ imageKeys }),
@@ -5514,6 +5517,9 @@ function useStudioActions({
5514
5517
  if (!response.ok) {
5515
5518
  const error = await response.json();
5516
5519
  setProgressState({
5520
+ current: 0,
5521
+ total: imageKeys.length,
5522
+ percent: 0,
5517
5523
  status: "error",
5518
5524
  message: error.error || "Processing failed"
5519
5525
  });
@@ -5527,7 +5533,7 @@ function useStudioActions({
5527
5533
  const { done, value } = await reader.read();
5528
5534
  if (done) break;
5529
5535
  buffer += decoder.decode(value, { stream: true });
5530
- const lines = buffer.split("\n");
5536
+ const lines = buffer.split("\n\n");
5531
5537
  buffer = lines.pop() || "";
5532
5538
  for (const line of lines) {
5533
5539
  if (line.startsWith("data: ")) {
@@ -5542,7 +5548,7 @@ function useStudioActions({
5542
5548
  setProgressState({
5543
5549
  current: data.current,
5544
5550
  total: data.total,
5545
- percent: Math.round(data.current / data.total * 100),
5551
+ percent: data.percent,
5546
5552
  status: "processing",
5547
5553
  message: data.message
5548
5554
  });
@@ -5557,8 +5563,8 @@ function useStudioActions({
5557
5563
  current: data.processed,
5558
5564
  total: data.processed,
5559
5565
  percent: 100,
5560
- status: "complete",
5561
- message: `Processed ${data.processed} image${data.processed !== 1 ? "s" : ""}${data.errors > 0 ? `, ${data.errors} error${data.errors !== 1 ? "s" : ""}` : ""}`
5566
+ status: data.errors > 0 ? "error" : "complete",
5567
+ message: data.message
5562
5568
  });
5563
5569
  triggerRefresh();
5564
5570
  } else if (data.type === "error") {
@@ -5585,7 +5591,8 @@ function useStudioActions({
5585
5591
  console.error("Processing error:", error);
5586
5592
  setProgressState({
5587
5593
  current: 0,
5588
- total: 0,
5594
+ total: imageKeys.length,
5595
+ percent: 0,
5589
5596
  status: "error",
5590
5597
  message: "Processing failed. Check console for details."
5591
5598
  });
@@ -6104,4 +6111,4 @@ export {
6104
6111
  StudioUI,
6105
6112
  StudioUI_default as default
6106
6113
  };
6107
- //# sourceMappingURL=StudioUI-K6TIH6LF.mjs.map
6114
+ //# sourceMappingURL=StudioUI-NXJ2QUYQ.mjs.map