diff --git a/package-lock.json b/package-lock.json index 03f7394..376b759 100644 --- a/package-lock.json +++ b/package-lock.json @@ -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", diff --git a/package.json b/package.json index cec6579..492390f 100644 --- a/package.json +++ b/package.json @@ -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", diff --git a/src/main/constants.ts b/src/main/constants.ts index 4f06d6e..2e2afe2 100644 --- a/src/main/constants.ts +++ b/src/main/constants.ts @@ -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"; diff --git a/src/main/download-manager.ts b/src/main/download-manager.ts index 6c0ef14..949c106 100644 --- a/src/main/download-manager.ts +++ b/src/main/download-manager.ts @@ -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; }