markpdfdown 0.4.5 → 0.4.6
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.
|
@@ -71129,6 +71129,7 @@ function mapCloudTasksToTasks(cloudTasks) {
|
|
|
71129
71129
|
}
|
|
71130
71130
|
const { Text: Text$4 } = Typography;
|
|
71131
71131
|
const CLOUD_MODEL_TIERS$1 = ["lite", "pro", "ultra"];
|
|
71132
|
+
const cloudProgressCache = /* @__PURE__ */ new Map();
|
|
71132
71133
|
const List = () => {
|
|
71133
71134
|
const { message: message2, modal } = App$1.useApp();
|
|
71134
71135
|
const { t: t2 } = useTranslation("list");
|
|
@@ -71228,7 +71229,50 @@ const List = () => {
|
|
|
71228
71229
|
combinedList.sort((a2, b) => getTimestamp(b) - getTimestamp(a2));
|
|
71229
71230
|
const startIndex = (page - 1) * pageSize;
|
|
71230
71231
|
const paginatedList = combinedList.slice(startIndex, startIndex + pageSize);
|
|
71231
|
-
setData(
|
|
71232
|
+
setData((prevData) => {
|
|
71233
|
+
const existingMap = /* @__PURE__ */ new Map();
|
|
71234
|
+
for (const item of prevData) {
|
|
71235
|
+
if (item.isCloud && item.id) {
|
|
71236
|
+
existingMap.set(item.id, item);
|
|
71237
|
+
}
|
|
71238
|
+
}
|
|
71239
|
+
return paginatedList.map((task) => {
|
|
71240
|
+
if (task.isCloud && task.id) {
|
|
71241
|
+
const fromState = existingMap.get(task.id);
|
|
71242
|
+
const fromCache = cloudProgressCache.get(task.id);
|
|
71243
|
+
const maxProgress = Math.max(
|
|
71244
|
+
task.progress || 0,
|
|
71245
|
+
fromState?.progress || 0,
|
|
71246
|
+
fromCache?.progress || 0
|
|
71247
|
+
);
|
|
71248
|
+
const maxCompleted = Math.max(
|
|
71249
|
+
task.completed_count || 0,
|
|
71250
|
+
fromState?.completed_count || 0,
|
|
71251
|
+
fromCache?.completed_count || 0
|
|
71252
|
+
);
|
|
71253
|
+
const maxFailed = Math.max(
|
|
71254
|
+
task.failed_count || 0,
|
|
71255
|
+
fromState?.failed_count || 0,
|
|
71256
|
+
fromCache?.failed_count || 0
|
|
71257
|
+
);
|
|
71258
|
+
cloudProgressCache.set(task.id, {
|
|
71259
|
+
progress: maxProgress,
|
|
71260
|
+
completed_count: maxCompleted,
|
|
71261
|
+
failed_count: maxFailed,
|
|
71262
|
+
status: task.status ?? fromCache?.status ?? 0
|
|
71263
|
+
});
|
|
71264
|
+
if (maxProgress > (task.progress || 0) || maxCompleted > (task.completed_count || 0)) {
|
|
71265
|
+
return {
|
|
71266
|
+
...task,
|
|
71267
|
+
progress: maxProgress,
|
|
71268
|
+
completed_count: maxCompleted,
|
|
71269
|
+
failed_count: maxFailed
|
|
71270
|
+
};
|
|
71271
|
+
}
|
|
71272
|
+
}
|
|
71273
|
+
return task;
|
|
71274
|
+
});
|
|
71275
|
+
});
|
|
71232
71276
|
setPagination((prev2) => ({
|
|
71233
71277
|
...prev2,
|
|
71234
71278
|
current: page,
|
|
@@ -71321,9 +71365,13 @@ const List = () => {
|
|
|
71321
71365
|
case "page_completed": {
|
|
71322
71366
|
const pageNumber = data2.page;
|
|
71323
71367
|
const totalPages = data2.total_pages || task.pages || 1;
|
|
71324
|
-
|
|
71325
|
-
|
|
71326
|
-
|
|
71368
|
+
if (task.status === 8) {
|
|
71369
|
+
task.completed_count = (task.completed_count || 0) + 1;
|
|
71370
|
+
task.failed_count = Math.max(0, (task.failed_count || 0) - 1);
|
|
71371
|
+
} else {
|
|
71372
|
+
task.completed_count = Math.max(task.completed_count || 0, pageNumber || 0);
|
|
71373
|
+
}
|
|
71374
|
+
task.progress = Math.round((task.completed_count || 0) / totalPages * 100);
|
|
71327
71375
|
task.status = 3;
|
|
71328
71376
|
break;
|
|
71329
71377
|
}
|
|
@@ -71356,6 +71404,19 @@ const List = () => {
|
|
|
71356
71404
|
return prevData;
|
|
71357
71405
|
}
|
|
71358
71406
|
newData[index2] = task;
|
|
71407
|
+
if (task.id) {
|
|
71408
|
+
const terminalStatuses = [0, 6, 7, 8];
|
|
71409
|
+
if (terminalStatuses.includes(task.status ?? -1)) {
|
|
71410
|
+
cloudProgressCache.delete(task.id);
|
|
71411
|
+
} else {
|
|
71412
|
+
cloudProgressCache.set(task.id, {
|
|
71413
|
+
progress: task.progress || 0,
|
|
71414
|
+
completed_count: task.completed_count || 0,
|
|
71415
|
+
failed_count: task.failed_count || 0,
|
|
71416
|
+
status: task.status ?? 0
|
|
71417
|
+
});
|
|
71418
|
+
}
|
|
71419
|
+
}
|
|
71359
71420
|
return newData;
|
|
71360
71421
|
});
|
|
71361
71422
|
};
|
|
@@ -126300,13 +126361,20 @@ const CloudPreview = () => {
|
|
|
126300
126361
|
}
|
|
126301
126362
|
return [...prev2, { page, status: 2, status_name: "COMPLETED", markdown: markdown2, width_mm: 210, height_mm: 297 }];
|
|
126302
126363
|
});
|
|
126303
|
-
setTask((prev2) =>
|
|
126304
|
-
|
|
126305
|
-
|
|
126306
|
-
|
|
126364
|
+
setTask((prev2) => {
|
|
126365
|
+
if (!prev2) return null;
|
|
126366
|
+
const updates = {
|
|
126367
|
+
pages_completed: (prev2.pages_completed || 0) + 1
|
|
126368
|
+
};
|
|
126369
|
+
if (prev2.status === 8) {
|
|
126370
|
+
updates.pages_failed = Math.max(0, (prev2.pages_failed || 0) - 1);
|
|
126371
|
+
}
|
|
126372
|
+
return { ...prev2, ...updates };
|
|
126373
|
+
});
|
|
126307
126374
|
break;
|
|
126308
126375
|
}
|
|
126309
|
-
case "page_started":
|
|
126376
|
+
case "page_started":
|
|
126377
|
+
case "page_retry_started": {
|
|
126310
126378
|
const { page } = event.data;
|
|
126311
126379
|
setPages((prev2) => {
|
|
126312
126380
|
const idx = prev2.findIndex((p2) => p2.page === page);
|
|
@@ -126344,6 +126412,9 @@ const CloudPreview = () => {
|
|
|
126344
126412
|
pages_completed: data.pages_completed,
|
|
126345
126413
|
pages_failed: data.pages_failed
|
|
126346
126414
|
} : null);
|
|
126415
|
+
if (data.pages_failed === 0) {
|
|
126416
|
+
setPages((prev2) => prev2.map((p2) => p2.status !== 2 ? { ...p2, status: 2, status_name: "COMPLETED" } : p2));
|
|
126417
|
+
}
|
|
126347
126418
|
break;
|
|
126348
126419
|
}
|
|
126349
126420
|
case "error": {
|
package/dist/renderer/index.html
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
|
|
6
6
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
7
7
|
<title>MarkPDFdown</title>
|
|
8
|
-
<script type="module" crossorigin src="./assets/index-
|
|
8
|
+
<script type="module" crossorigin src="./assets/index-CFJUTNAj.js"></script>
|
|
9
9
|
<link rel="stylesheet" crossorigin href="./assets/index-DXcyx2Q8.css">
|
|
10
10
|
</head>
|
|
11
11
|
<body>
|