mirror of
https://github.com/hydralauncher/hydra.git
synced 2025-02-09 03:37:45 +03:00
feat: remove aria2 (again)
This commit is contained in:
parent
f3f78248ef
commit
4a149aa62d
1
.gitignore
vendored
1
.gitignore
vendored
@ -1,7 +1,6 @@
|
|||||||
.vscode
|
.vscode
|
||||||
node_modules
|
node_modules
|
||||||
hydra-download-manager/
|
hydra-download-manager/
|
||||||
aria2/
|
|
||||||
fastlist.exe
|
fastlist.exe
|
||||||
__pycache__
|
__pycache__
|
||||||
dist
|
dist
|
||||||
|
@ -3,7 +3,6 @@ productName: Hydra
|
|||||||
directories:
|
directories:
|
||||||
buildResources: build
|
buildResources: build
|
||||||
extraResources:
|
extraResources:
|
||||||
- aria2
|
|
||||||
- hydra-download-manager
|
- hydra-download-manager
|
||||||
- seeds
|
- seeds
|
||||||
- from: node_modules/create-desktop-shortcuts/src/windows.vbs
|
- from: node_modules/create-desktop-shortcuts/src/windows.vbs
|
||||||
|
@ -23,7 +23,7 @@
|
|||||||
"start": "electron-vite preview",
|
"start": "electron-vite preview",
|
||||||
"dev": "electron-vite dev",
|
"dev": "electron-vite dev",
|
||||||
"build": "npm run typecheck && electron-vite build",
|
"build": "npm run typecheck && electron-vite build",
|
||||||
"postinstall": "electron-builder install-app-deps && node ./postinstall.cjs",
|
"postinstall": "electron-builder install-app-deps",
|
||||||
"build:unpack": "npm run build && electron-builder --dir",
|
"build:unpack": "npm run build && electron-builder --dir",
|
||||||
"build:win": "electron-vite build && electron-builder --win",
|
"build:win": "electron-vite build && electron-builder --win",
|
||||||
"build:mac": "electron-vite build && electron-builder --mac",
|
"build:mac": "electron-vite build && electron-builder --mac",
|
||||||
@ -42,7 +42,6 @@
|
|||||||
"@vanilla-extract/css": "^1.14.2",
|
"@vanilla-extract/css": "^1.14.2",
|
||||||
"@vanilla-extract/dynamic": "^2.1.1",
|
"@vanilla-extract/dynamic": "^2.1.1",
|
||||||
"@vanilla-extract/recipes": "^0.5.2",
|
"@vanilla-extract/recipes": "^0.5.2",
|
||||||
"aria2": "^4.1.2",
|
|
||||||
"auto-launch": "^5.0.6",
|
"auto-launch": "^5.0.6",
|
||||||
"axios": "^1.6.8",
|
"axios": "^1.6.8",
|
||||||
"better-sqlite3": "^9.5.0",
|
"better-sqlite3": "^9.5.0",
|
||||||
|
@ -1,50 +0,0 @@
|
|||||||
const { default: axios } = require("axios");
|
|
||||||
const util = require("node:util");
|
|
||||||
const fs = require("node:fs");
|
|
||||||
|
|
||||||
const exec = util.promisify(require("node:child_process").exec);
|
|
||||||
|
|
||||||
const downloadAria2 = async () => {
|
|
||||||
if (fs.existsSync("aria2")) {
|
|
||||||
console.log("Aria2 already exists, skipping download...");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
const file =
|
|
||||||
process.platform === "win32"
|
|
||||||
? "aria2-1.37.0-win-64bit-build1.zip"
|
|
||||||
: "aria2-1.37.0-1-x86_64.pkg.tar.zst";
|
|
||||||
|
|
||||||
const downloadUrl =
|
|
||||||
process.platform === "win32"
|
|
||||||
? `https://github.com/aria2/aria2/releases/download/release-1.37.0/${file}`
|
|
||||||
: "https://archlinux.org/packages/extra/x86_64/aria2/download/";
|
|
||||||
|
|
||||||
console.log(`Downloading ${file}...`);
|
|
||||||
|
|
||||||
const response = await axios.get(downloadUrl, { responseType: "stream" });
|
|
||||||
|
|
||||||
const stream = response.data.pipe(fs.createWriteStream(file));
|
|
||||||
|
|
||||||
stream.on("finish", async () => {
|
|
||||||
console.log(`Downloaded ${file}, extracting...`);
|
|
||||||
|
|
||||||
if (process.platform === "win32") {
|
|
||||||
await exec(`npx extract-zip ${file}`);
|
|
||||||
console.log("Extracted. Renaming folder...");
|
|
||||||
|
|
||||||
fs.renameSync(file.replace(".zip", ""), "aria2");
|
|
||||||
} else {
|
|
||||||
await exec(`tar --zstd -xvf ${file} usr/bin/aria2c`);
|
|
||||||
console.log("Extracted. Copying binary file...");
|
|
||||||
fs.mkdirSync("aria2");
|
|
||||||
fs.copyFileSync("usr/bin/aria2c", "aria2/aria2c");
|
|
||||||
fs.rmSync("usr", { recursive: true });
|
|
||||||
}
|
|
||||||
|
|
||||||
console.log(`Extracted ${file}, removing compressed downloaded file...`);
|
|
||||||
fs.rmSync(file);
|
|
||||||
});
|
|
||||||
};
|
|
||||||
|
|
||||||
downloadAria2();
|
|
80
src/main/declaration.d.ts
vendored
80
src/main/declaration.d.ts
vendored
@ -1,80 +0,0 @@
|
|||||||
declare module "aria2" {
|
|
||||||
export type Aria2Status =
|
|
||||||
| "active"
|
|
||||||
| "waiting"
|
|
||||||
| "paused"
|
|
||||||
| "error"
|
|
||||||
| "complete"
|
|
||||||
| "removed";
|
|
||||||
|
|
||||||
export interface StatusResponse {
|
|
||||||
gid: string;
|
|
||||||
status: Aria2Status;
|
|
||||||
totalLength: string;
|
|
||||||
completedLength: string;
|
|
||||||
uploadLength: string;
|
|
||||||
bitfield: string;
|
|
||||||
downloadSpeed: string;
|
|
||||||
uploadSpeed: string;
|
|
||||||
infoHash?: string;
|
|
||||||
numSeeders?: string;
|
|
||||||
seeder?: boolean;
|
|
||||||
pieceLength: string;
|
|
||||||
numPieces: string;
|
|
||||||
connections: string;
|
|
||||||
errorCode?: string;
|
|
||||||
errorMessage?: string;
|
|
||||||
followedBy?: string[];
|
|
||||||
following: string;
|
|
||||||
belongsTo: string;
|
|
||||||
dir: string;
|
|
||||||
files: {
|
|
||||||
path: string;
|
|
||||||
length: string;
|
|
||||||
completedLength: string;
|
|
||||||
selected: string;
|
|
||||||
}[];
|
|
||||||
bittorrent?: {
|
|
||||||
announceList: string[][];
|
|
||||||
comment: string;
|
|
||||||
creationDate: string;
|
|
||||||
mode: "single" | "multi";
|
|
||||||
info: {
|
|
||||||
name: string;
|
|
||||||
verifiedLength: string;
|
|
||||||
verifyIntegrityPending: string;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
export default class Aria2 {
|
|
||||||
constructor(options: any);
|
|
||||||
open: () => Promise<void>;
|
|
||||||
call(
|
|
||||||
method: "addUri",
|
|
||||||
uris: string[],
|
|
||||||
options: { dir: string }
|
|
||||||
): Promise<string>;
|
|
||||||
call(
|
|
||||||
method: "tellStatus",
|
|
||||||
gid: string,
|
|
||||||
keys?: string[]
|
|
||||||
): Promise<StatusResponse>;
|
|
||||||
call(method: "pause", gid: string): Promise<string>;
|
|
||||||
call(method: "forcePause", gid: string): Promise<string>;
|
|
||||||
call(method: "unpause", gid: string): Promise<string>;
|
|
||||||
call(method: "remove", gid: string): Promise<string>;
|
|
||||||
call(method: "forceRemove", gid: string): Promise<string>;
|
|
||||||
call(method: "pauseAll"): Promise<string>;
|
|
||||||
call(method: "forcePauseAll"): Promise<string>;
|
|
||||||
listNotifications: () => [
|
|
||||||
"onDownloadStart",
|
|
||||||
"onDownloadPause",
|
|
||||||
"onDownloadStop",
|
|
||||||
"onDownloadComplete",
|
|
||||||
"onDownloadError",
|
|
||||||
"onBtDownloadComplete",
|
|
||||||
];
|
|
||||||
on: (event: string, callback: (params: any) => void) => void;
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,20 +0,0 @@
|
|||||||
import path from "node:path";
|
|
||||||
import { spawn } from "node:child_process";
|
|
||||||
import { app } from "electron";
|
|
||||||
|
|
||||||
export const startAria2 = () => {
|
|
||||||
const binaryPath = app.isPackaged
|
|
||||||
? path.join(process.resourcesPath, "aria2", "aria2c")
|
|
||||||
: path.join(__dirname, "..", "..", "aria2", "aria2c");
|
|
||||||
|
|
||||||
return spawn(
|
|
||||||
binaryPath,
|
|
||||||
[
|
|
||||||
"--enable-rpc",
|
|
||||||
"--rpc-listen-all",
|
|
||||||
"--file-allocation=none",
|
|
||||||
"--allow-overwrite=true",
|
|
||||||
],
|
|
||||||
{ stdio: "inherit", windowsHide: true }
|
|
||||||
);
|
|
||||||
};
|
|
15
yarn.lock
15
yarn.lock
@ -2677,14 +2677,6 @@ aria-query@^5.3.0:
|
|||||||
dependencies:
|
dependencies:
|
||||||
dequal "^2.0.3"
|
dequal "^2.0.3"
|
||||||
|
|
||||||
aria2@^4.1.2:
|
|
||||||
version "4.1.2"
|
|
||||||
resolved "https://registry.yarnpkg.com/aria2/-/aria2-4.1.2.tgz#0ecbc50beea82856c88b4de71dac336154f67362"
|
|
||||||
integrity sha512-qTBr2RY8RZQmiUmbj2KXFvkErNxU4aTHZszszzwhE8svy2PEVX+IYR/c4Rp9Tuw4QkeU8cylGy6McV6Yl8i7Qw==
|
|
||||||
dependencies:
|
|
||||||
node-fetch "^2.6.1"
|
|
||||||
ws "^7.4.0"
|
|
||||||
|
|
||||||
array-buffer-byte-length@^1.0.1:
|
array-buffer-byte-length@^1.0.1:
|
||||||
version "1.0.1"
|
version "1.0.1"
|
||||||
resolved "https://registry.npmjs.org/array-buffer-byte-length/-/array-buffer-byte-length-1.0.1.tgz"
|
resolved "https://registry.npmjs.org/array-buffer-byte-length/-/array-buffer-byte-length-1.0.1.tgz"
|
||||||
@ -5833,7 +5825,7 @@ node-domexception@^1.0.0:
|
|||||||
resolved "https://registry.npmjs.org/node-domexception/-/node-domexception-1.0.0.tgz"
|
resolved "https://registry.npmjs.org/node-domexception/-/node-domexception-1.0.0.tgz"
|
||||||
integrity sha512-/jKZoMpw0F8GRwl4/eLROPA3cfcXtLApP0QzLmUT/HuPCZWyB7IY9ZrMeKw2O/nFIqPQB3PVM9aYm0F312AXDQ==
|
integrity sha512-/jKZoMpw0F8GRwl4/eLROPA3cfcXtLApP0QzLmUT/HuPCZWyB7IY9ZrMeKw2O/nFIqPQB3PVM9aYm0F312AXDQ==
|
||||||
|
|
||||||
node-fetch@^2.6.1, node-fetch@^2.6.7:
|
node-fetch@^2.6.7:
|
||||||
version "2.7.0"
|
version "2.7.0"
|
||||||
resolved "https://registry.yarnpkg.com/node-fetch/-/node-fetch-2.7.0.tgz#d0f0fa6e3e2dc1d27efcd8ad99d550bda94d187d"
|
resolved "https://registry.yarnpkg.com/node-fetch/-/node-fetch-2.7.0.tgz#d0f0fa6e3e2dc1d27efcd8ad99d550bda94d187d"
|
||||||
integrity sha512-c4FRfUm/dbcWZ7U+1Wq0AwCyFL+3nt2bEw05wfxSz+DWpWsitgmSgYmy2dQdWyKC1694ELPqMs/YzUSNozLt8A==
|
integrity sha512-c4FRfUm/dbcWZ7U+1Wq0AwCyFL+3nt2bEw05wfxSz+DWpWsitgmSgYmy2dQdWyKC1694ELPqMs/YzUSNozLt8A==
|
||||||
@ -7629,11 +7621,6 @@ wrappy@1:
|
|||||||
resolved "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz"
|
resolved "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz"
|
||||||
integrity sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==
|
integrity sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==
|
||||||
|
|
||||||
ws@^7.4.0:
|
|
||||||
version "7.5.10"
|
|
||||||
resolved "https://registry.yarnpkg.com/ws/-/ws-7.5.10.tgz#58b5c20dc281633f6c19113f39b349bd8bd558d9"
|
|
||||||
integrity sha512-+dbF1tHwZpXcbOJdVOkzLDxZP1ailvSxM6ZweXTegylPny803bFhA+vqBYw4s31NSAk4S2Qz+AKXK9a4wkdjcQ==
|
|
||||||
|
|
||||||
ws@^8.16.0:
|
ws@^8.16.0:
|
||||||
version "8.17.0"
|
version "8.17.0"
|
||||||
resolved "https://registry.npmjs.org/ws/-/ws-8.17.0.tgz"
|
resolved "https://registry.npmjs.org/ws/-/ws-8.17.0.tgz"
|
||||||
|
Loading…
Reference in New Issue
Block a user