@gallop.software/studio 2.3.18 → 2.3.20
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.
package/dist/client/index.html
CHANGED
|
@@ -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-
|
|
14
|
+
<script type="module" crossorigin src="/assets/index-CGxpFOZc.js"></script>
|
|
15
15
|
</head>
|
|
16
16
|
<body>
|
|
17
17
|
<div id="root"></div>
|
package/dist/server/index.js
CHANGED
|
@@ -1501,6 +1501,17 @@ async function handleMoveStream(request) {
|
|
|
1501
1501
|
import { promises as fs7 } from "fs";
|
|
1502
1502
|
import path7 from "path";
|
|
1503
1503
|
import { S3Client as S3Client2, PutObjectCommand as PutObjectCommand2, DeleteObjectCommand as DeleteObjectCommand2 } from "@aws-sdk/client-s3";
|
|
1504
|
+
var cancelledOperations = /* @__PURE__ */ new Set();
|
|
1505
|
+
function cancelOperation(operationId) {
|
|
1506
|
+
cancelledOperations.add(operationId);
|
|
1507
|
+
setTimeout(() => cancelledOperations.delete(operationId), 6e4);
|
|
1508
|
+
}
|
|
1509
|
+
function isOperationCancelled(operationId) {
|
|
1510
|
+
return cancelledOperations.has(operationId);
|
|
1511
|
+
}
|
|
1512
|
+
function clearCancelledOperation(operationId) {
|
|
1513
|
+
cancelledOperations.delete(operationId);
|
|
1514
|
+
}
|
|
1504
1515
|
async function handleSync(request) {
|
|
1505
1516
|
const accountId = process.env.CLOUDFLARE_R2_ACCOUNT_ID;
|
|
1506
1517
|
const accessKeyId = process.env.CLOUDFLARE_R2_ACCESS_KEY_ID;
|
|
@@ -1862,11 +1873,10 @@ async function handleReprocessStream(request) {
|
|
|
1862
1873
|
});
|
|
1863
1874
|
}
|
|
1864
1875
|
async function handleDownloadStream(request) {
|
|
1865
|
-
const { imageKeys } = await request.json();
|
|
1876
|
+
const { imageKeys, operationId } = await request.json();
|
|
1866
1877
|
if (!imageKeys || !Array.isArray(imageKeys) || imageKeys.length === 0) {
|
|
1867
1878
|
return jsonResponse({ error: "No image keys provided" }, { status: 400 });
|
|
1868
1879
|
}
|
|
1869
|
-
const abortSignal = request.signal;
|
|
1870
1880
|
const stream = new ReadableStream({
|
|
1871
1881
|
async start(controller) {
|
|
1872
1882
|
const encoder = new TextEncoder();
|
|
@@ -1882,11 +1892,13 @@ async function handleDownloadStream(request) {
|
|
|
1882
1892
|
const downloaded = [];
|
|
1883
1893
|
const skipped = [];
|
|
1884
1894
|
const errors = [];
|
|
1895
|
+
const isCancelled = () => operationId ? isOperationCancelled(operationId) : false;
|
|
1885
1896
|
try {
|
|
1886
1897
|
const meta = await loadMeta();
|
|
1887
1898
|
for (let i = 0; i < imageKeys.length; i++) {
|
|
1888
|
-
if (
|
|
1899
|
+
if (isCancelled()) {
|
|
1889
1900
|
await saveMeta(meta);
|
|
1901
|
+
if (operationId) clearCancelledOperation(operationId);
|
|
1890
1902
|
sendEvent({
|
|
1891
1903
|
type: "stopped",
|
|
1892
1904
|
downloaded: downloaded.length,
|
|
@@ -1909,8 +1921,9 @@ async function handleDownloadStream(request) {
|
|
|
1909
1921
|
}
|
|
1910
1922
|
try {
|
|
1911
1923
|
const imageBuffer = await downloadFromCdn(imageKey);
|
|
1912
|
-
if (
|
|
1924
|
+
if (isCancelled()) {
|
|
1913
1925
|
await saveMeta(meta);
|
|
1926
|
+
if (operationId) clearCancelledOperation(operationId);
|
|
1914
1927
|
sendEvent({
|
|
1915
1928
|
type: "stopped",
|
|
1916
1929
|
downloaded: downloaded.length,
|
|
@@ -2109,6 +2122,19 @@ async function handlePushUpdatesStream(request) {
|
|
|
2109
2122
|
}
|
|
2110
2123
|
});
|
|
2111
2124
|
}
|
|
2125
|
+
async function handleCancelStreamOperation(request) {
|
|
2126
|
+
try {
|
|
2127
|
+
const { operationId } = await request.json();
|
|
2128
|
+
if (!operationId || typeof operationId !== "string") {
|
|
2129
|
+
return jsonResponse({ error: "No operation ID provided" }, { status: 400 });
|
|
2130
|
+
}
|
|
2131
|
+
cancelOperation(operationId);
|
|
2132
|
+
return jsonResponse({ success: true, operationId });
|
|
2133
|
+
} catch (error) {
|
|
2134
|
+
console.error("Failed to cancel operation:", error);
|
|
2135
|
+
return jsonResponse({ error: "Failed to cancel operation" }, { status: 500 });
|
|
2136
|
+
}
|
|
2137
|
+
}
|
|
2112
2138
|
async function handleCancelUpdates(request) {
|
|
2113
2139
|
try {
|
|
2114
2140
|
const { paths } = await request.json();
|
|
@@ -2722,6 +2748,7 @@ async function startServer(options) {
|
|
|
2722
2748
|
app.post("/api/studio/download-stream", wrapHandler(handleDownloadStream, true));
|
|
2723
2749
|
app.post("/api/studio/push-updates-stream", wrapHandler(handlePushUpdatesStream, true));
|
|
2724
2750
|
app.post("/api/studio/cancel-updates", wrapHandler(handleCancelUpdates));
|
|
2751
|
+
app.post("/api/studio/cancel-stream", wrapHandler(handleCancelStreamOperation));
|
|
2725
2752
|
app.post("/api/studio/scan", wrapHandler(handleScanStream, true));
|
|
2726
2753
|
app.post("/api/studio/delete-orphans", wrapHandler(handleDeleteOrphans));
|
|
2727
2754
|
app.post("/api/studio/import", wrapHandler(handleImportUrls, true));
|