Fix extraction recovery edge cases and release v1.1.27
Some checks are pending
Build and Release / build (push) Waiting to run
Some checks are pending
Build and Release / build (push) Waiting to run
This commit is contained in:
parent
3525ecb569
commit
88eb6dff5d
4
package-lock.json
generated
4
package-lock.json
generated
@ -1,12 +1,12 @@
|
||||
{
|
||||
"name": "real-debrid-downloader",
|
||||
"version": "1.1.26",
|
||||
"version": "1.1.27",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "real-debrid-downloader",
|
||||
"version": "1.1.26",
|
||||
"version": "1.1.27",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"adm-zip": "^0.5.16",
|
||||
|
||||
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "real-debrid-downloader",
|
||||
"version": "1.1.26",
|
||||
"version": "1.1.27",
|
||||
"description": "Real-Debrid Downloader Desktop (Electron + React + TypeScript)",
|
||||
"main": "build/main/main/main.js",
|
||||
"author": "Sucukdeluxe",
|
||||
|
||||
@ -3,7 +3,7 @@ import os from "node:os";
|
||||
import { AppSettings } from "../shared/types";
|
||||
|
||||
export const APP_NAME = "Debrid Download Manager";
|
||||
export const APP_VERSION = "1.1.26";
|
||||
export const APP_VERSION = "1.1.27";
|
||||
export const API_BASE_URL = "https://api.real-debrid.com/rest/1.0";
|
||||
|
||||
export const DCRYPT_UPLOAD_URL = "https://dcrypt.it/decrypt/upload";
|
||||
|
||||
@ -87,31 +87,6 @@ function isPathInsideDir(filePath: string, dirPath: string): boolean {
|
||||
return file.startsWith(withSep);
|
||||
}
|
||||
|
||||
function directoryHasFiles(dirPath: string): boolean {
|
||||
if (!fs.existsSync(dirPath)) {
|
||||
return false;
|
||||
}
|
||||
const stack = [dirPath];
|
||||
while (stack.length > 0) {
|
||||
const current = stack.pop() as string;
|
||||
let entries: fs.Dirent[] = [];
|
||||
try {
|
||||
entries = fs.readdirSync(current, { withFileTypes: true });
|
||||
} catch {
|
||||
continue;
|
||||
}
|
||||
for (const entry of entries) {
|
||||
if (entry.isFile()) {
|
||||
return true;
|
||||
}
|
||||
if (entry.isDirectory()) {
|
||||
stack.push(path.join(current, entry.name));
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
export class DownloadManager extends EventEmitter {
|
||||
private settings: AppSettings;
|
||||
|
||||
@ -676,26 +651,14 @@ export class DownloadManager extends EventEmitter {
|
||||
}
|
||||
|
||||
if (this.settings.autoExtract && failed === 0 && success > 0) {
|
||||
if (this.settings.createExtractSubfolder && directoryHasFiles(pkg.extractDir)) {
|
||||
for (const item of items) {
|
||||
if (item.status === "completed" && item.fullStatus !== "Entpackt") {
|
||||
item.fullStatus = "Entpackt";
|
||||
item.updatedAt = nowMs();
|
||||
changed = true;
|
||||
}
|
||||
}
|
||||
if (pkg.status !== "completed") {
|
||||
pkg.status = "completed";
|
||||
pkg.updatedAt = nowMs();
|
||||
changed = true;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
const needsPostProcess = pkg.status !== "completed"
|
||||
|| items.some((item) => item.status === "completed" && item.fullStatus !== "Entpackt");
|
||||
if (needsPostProcess) {
|
||||
void this.runPackagePostProcessing(packageId);
|
||||
} else if (pkg.status !== "completed") {
|
||||
pkg.status = "completed";
|
||||
pkg.updatedAt = nowMs();
|
||||
changed = true;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user