@gallop.software/studio 2.3.53 → 2.3.55

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-DL1OJIw8.js"></script>
14
+ <script type="module" crossorigin src="/assets/index-C-xFymfG.js"></script>
15
15
  </head>
16
16
  <body>
17
17
  <div id="root"></div>
@@ -1228,15 +1228,18 @@ async function handleUnprocessStream(request) {
1228
1228
  const publicUrl = process.env.CLOUDFLARE_R2_PUBLIC_URL?.replace(/\/\s*$/, "");
1229
1229
  const encoder = new TextEncoder();
1230
1230
  let imageKeys;
1231
+ let operationId;
1231
1232
  try {
1232
1233
  const body = await request.json();
1233
1234
  imageKeys = body.imageKeys;
1235
+ operationId = body.operationId;
1234
1236
  if (!imageKeys || !Array.isArray(imageKeys) || imageKeys.length === 0) {
1235
1237
  return jsonResponse({ error: "No image keys provided" }, { status: 400 });
1236
1238
  }
1237
1239
  } catch {
1238
1240
  return jsonResponse({ error: "Invalid request body" }, { status: 400 });
1239
1241
  }
1242
+ const isCancelled = () => operationId ? isOperationCancelled(operationId) : false;
1240
1243
  const stream = new ReadableStream({
1241
1244
  async start(controller) {
1242
1245
  const sendEvent = (data) => {
@@ -1253,6 +1256,13 @@ async function handleUnprocessStream(request) {
1253
1256
  const total = imageKeys.length;
1254
1257
  sendEvent({ type: "start", total });
1255
1258
  for (let i = 0; i < imageKeys.length; i++) {
1259
+ if (isCancelled()) {
1260
+ await saveMeta(meta);
1261
+ if (operationId) clearCancelledOperation(operationId);
1262
+ sendEvent({ type: "complete", processed: removed.length, errors: errors.length, message: `Stopped. Removed thumbnails for ${removed.length} image${removed.length !== 1 ? "s" : ""}.`, cancelled: true });
1263
+ controller.close();
1264
+ return;
1265
+ }
1256
1266
  let imageKey = imageKeys[i];
1257
1267
  if (!imageKey.startsWith("/")) {
1258
1268
  imageKey = `/${imageKey}`;
@@ -1360,15 +1370,18 @@ async function handleReprocessStream(request) {
1360
1370
  const publicUrl = process.env.CLOUDFLARE_R2_PUBLIC_URL?.replace(/\/\s*$/, "");
1361
1371
  const encoder = new TextEncoder();
1362
1372
  let imageKeys;
1373
+ let operationId;
1363
1374
  try {
1364
1375
  const body = await request.json();
1365
1376
  imageKeys = body.imageKeys;
1377
+ operationId = body.operationId;
1366
1378
  if (!imageKeys || !Array.isArray(imageKeys) || imageKeys.length === 0) {
1367
1379
  return jsonResponse({ error: "No image keys provided" }, { status: 400 });
1368
1380
  }
1369
1381
  } catch {
1370
1382
  return jsonResponse({ error: "Invalid request body" }, { status: 400 });
1371
1383
  }
1384
+ const isCancelled = () => operationId ? isOperationCancelled(operationId) : false;
1372
1385
  const stream = new ReadableStream({
1373
1386
  async start(controller) {
1374
1387
  const sendEvent = (data) => {
@@ -1384,6 +1397,13 @@ async function handleReprocessStream(request) {
1384
1397
  const total = imageKeys.length;
1385
1398
  sendEvent({ type: "start", total });
1386
1399
  for (let i = 0; i < imageKeys.length; i++) {
1400
+ if (isCancelled()) {
1401
+ await saveMeta(meta);
1402
+ if (operationId) clearCancelledOperation(operationId);
1403
+ sendEvent({ type: "complete", processed: processed.length, errors: errors.length, message: `Stopped. Generated thumbnails for ${processed.length} image${processed.length !== 1 ? "s" : ""}.`, cancelled: true });
1404
+ controller.close();
1405
+ return;
1406
+ }
1387
1407
  let imageKey = imageKeys[i];
1388
1408
  if (!imageKey.startsWith("/")) {
1389
1409
  imageKey = `/${imageKey}`;