@gallop.software/studio 2.3.63 → 2.3.65

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.
@@ -11,7 +11,7 @@
11
11
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
12
12
  }
13
13
  </style>
14
- <script type="module" crossorigin src="/assets/index-B_wl32tp.js"></script>
14
+ <script type="module" crossorigin src="/assets/index-0gernUn0.js"></script>
15
15
  </head>
16
16
  <body>
17
17
  <div id="root"></div>
@@ -3463,17 +3463,21 @@ async function handleImportUrls(request) {
3463
3463
  const stream = new ReadableStream({
3464
3464
  async start(controller) {
3465
3465
  const sendEvent = (data) => {
3466
- controller.enqueue(encoder.encode(`data: ${JSON.stringify(data)}
3466
+ try {
3467
+ controller.enqueue(encoder.encode(`data: ${JSON.stringify(data)}
3467
3468
 
3468
3469
  `));
3470
+ } catch {
3471
+ }
3469
3472
  };
3470
3473
  try {
3471
- const { urls } = await request.json();
3474
+ const { urls, operationId } = await request.json();
3472
3475
  if (!urls || !Array.isArray(urls) || urls.length === 0) {
3473
3476
  sendEvent({ type: "error", message: "No URLs provided" });
3474
3477
  controller.close();
3475
3478
  return;
3476
3479
  }
3480
+ const isCancelled = () => operationId ? isOperationCancelled(operationId) : false;
3477
3481
  const meta = await loadMeta();
3478
3482
  const added = [];
3479
3483
  const skipped = [];
@@ -3481,6 +3485,20 @@ async function handleImportUrls(request) {
3481
3485
  const total = urls.length;
3482
3486
  sendEvent({ type: "start", total });
3483
3487
  for (let i = 0; i < urls.length; i++) {
3488
+ if (isCancelled()) {
3489
+ await saveMeta(meta);
3490
+ if (operationId) clearCancelledOperation(operationId);
3491
+ sendEvent({
3492
+ type: "complete",
3493
+ added: added.length,
3494
+ skipped: skipped.length,
3495
+ errors: errors.length,
3496
+ message: `Stopped. Imported ${added.length} URL${added.length !== 1 ? "s" : ""}.`,
3497
+ cancelled: true
3498
+ });
3499
+ controller.close();
3500
+ return;
3501
+ }
3484
3502
  const url = urls[i].trim();
3485
3503
  if (!url) continue;
3486
3504
  try {
@@ -3505,6 +3523,7 @@ async function handleImportUrls(request) {
3505
3523
  b: imageData.b,
3506
3524
  c: cdnIndex
3507
3525
  });
3526
+ await saveMeta(meta);
3508
3527
  added.push(path10);
3509
3528
  sendEvent({
3510
3529
  type: "progress",
@@ -3528,6 +3547,7 @@ async function handleImportUrls(request) {
3528
3547
  }
3529
3548
  }
3530
3549
  await saveMeta(meta);
3550
+ if (operationId) clearCancelledOperation(operationId);
3531
3551
  sendEvent({
3532
3552
  type: "complete",
3533
3553
  added: added.length,