jc3213 / download_with_aria2

The browser extenson for aria2 download utility via JSON-RPC
GNU Lesser General Public License v2.1
66 stars 9 forks source link

Use webRequest API for Firefox to avoid disk I/O #7

Closed jc3213 closed 2 years ago

jc3213 commented 2 years ago

Since the development has reached its edge. I am focused on improving performance.

On Firefox, the downloads.onCreated event is triggered later than download is created. File may be written to the local disk once, then removed because the download is cancelled by this extention.

I want to rewrite capture code based on Aria2-Integration codes, thus solve the problem.

Also, this will break Capture > Download Folder, so this feature will be removed

jc3213 commented 2 years ago

Aria2-Integration judge to capture downloads with response header content-disposition with attachment, or content-type with application. Thus it can not handle with Images. That's a pity though

jc3213 commented 2 years ago

Due to this change, Firefox's exclusive feature has been removed. File Size filter will be added in future

jc3213 commented 2 years ago

@ivysrono 帮忙推一下3.7.7(修改webRequest时抓到一个虫),顺便可以的话帮忙测试一下 3.8.0b1

git1-eipi10 commented 2 years ago

As I understand, we can not choose folder to save any more?

jc3213 commented 2 years ago

As I understand, we can not choose folder to save any more?

For Firefox - Yes

I can add a switch to let user determine which code to use, but it will be harder to deal with the options.

git1-eipi10 commented 2 years ago

I see. I know it would be much harder for you to maintain and improve the code if keeping both, but it's a really nice feature that I think no other aria2 add-ons have it. For me personally, it's also the most important feature that I decided to switch to this from other add-ons.

jc3213 commented 2 years ago

I've brought back the downloads API code in a rather crude way. If you'd like to use the downloads API code.

You need to run these codes in debug console

about:devtools-toolbox?id=firefox%40downloadWithAria2&type=extension

Then run

store['capture_api'] = '0';
store['folder_mode'] = '0'; //'0' Default, '1' Browser, '2' Custom
store['folder_path'] = ''; //Your download folder path
browser.storage.local.set(store);

How to use legacy API

Logging here https://github.com/jc3213/download_with_aria2/blob/ecdc9b7c24b93cfafcff18582786f3ace0518233/Firefox/background.js#L107

jc3213 commented 2 years ago

New UI for switch APIs and legacy options is available in 3.9.5.

More improvement will be shipped, like i18n and channelled options

git1-eipi10 commented 2 years ago

I've just tested version 3.10.0 on firefox but still can't see Safe Mode

image

jc3213 commented 2 years ago

I've just tested version 3.10.0 on firefox but still can't see Safe Mode

It's on about:addons cause it will show a confirm window

Reference: https://github.com/jc3213/download_with_aria2/issues/12#issuecomment-1023981589

git1-eipi10 commented 2 years ago

Oh I see it now. Tks a lot 👍