Skip to content

Commit

Permalink
feat: Pass download dir to AriaNG by match url patterns
Browse files Browse the repository at this point in the history
  • Loading branch information
alexhua committed May 15, 2024
1 parent a63f4ad commit 328571d
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 7 deletions.
4 changes: 4 additions & 0 deletions background.js
Original file line number Diff line number Diff line change
Expand Up @@ -313,6 +313,10 @@ async function launchUI(info) {
if (downloadItem.filename) {
webUiUrl = webUiUrl + "&filename=" + encodeURIComponent(downloadItem.filename);
}
let rpcItem = getRpcServer(downloadItem.url);
if (rpcItem?.pattern && rpcItem.pattern != '*' && rpcItem.location) {
webUiUrl = webUiUrl + "&dir=" + encodeURIComponent(rpcItem.location);
}
} else if (typeof info === "string" && info.startsWith(NID_TASK_STOPPED)) { // launched from task done notification click
const gid = info.slice(NID_TASK_STOPPED.length) || '';
webUiUrl += gid ? "/task/detail/" + gid : "/stopped";
Expand Down
12 changes: 6 additions & 6 deletions js/aria2.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@ const DEFAULT_ARIA2 = { name: "Aria2", rpcUrl: "http://localhost:6800/jsonrpc",
class Aria2 {
static RequestId = 0;

/**
* @param {object} Aria2
* @param {string} Aria2.name
* @param {string} Aria2.rpcUrl
* @param {string} Aria2.secretKey
*/
/**
* @param {object} Aria2
* @param {string} Aria2.name
* @param {string} Aria2.rpcUrl
* @param {string} Aria2.secretKey
*/
constructor(aria2 = DEFAULT_ARIA2) {
Object.assign(this, aria2);
this._isLocalhost = Utils.isLocalhost(this.rpcUrl);
Expand Down
2 changes: 1 addition & 1 deletion manifest.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "__MSG_appName__",
"short_name": "A2E",
"version": "2.4.2",
"version": "2.4.3",
"manifest_version": 3,
"minimum_chrome_version": "100.0.0",
"default_locale": "en",
Expand Down

0 comments on commit 328571d

Please sign in to comment.