Skip to content

Commit

Permalink
patch for firefox 133.0
Browse files Browse the repository at this point in the history
  • Loading branch information
elementdavv committed Nov 29, 2024
1 parent 26cd573 commit f3de5e5
Show file tree
Hide file tree
Showing 8 changed files with 11 additions and 9 deletions.
5 changes: 0 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -84,10 +84,5 @@ Please read carefully the [Extension Privacy Policy](Privacy.md).
## Disclaimer
The project is for study purpose only. Users should recognize that downloading borrowed limited period books is prohibited. All books downloaded using this project should be deleted within 48 hours. The project is provided on an "as is" basis. Use of the project is at user's own risk. The owner does not guarantee or assume responsibility for any damages to user's computer system, mobile device, loss of data or legal risks that results from using the project.

## License
[AGPL3](LICENSE) ©Element Davv

Any questions and/or suggestions are appreciatiated.

## Donation
If you want to support my work you could donate to [![donate](resources/logo/paypal-logo.png)](https://paypal.me/timelegend)
1 change: 1 addition & 0 deletions moz/js/content1.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ export default function(){
switch(data.cmd) {
case 'init':
br = JSON.parse(data.br);
if (sw) streamSaver.testSw(br.swInNavigator);
await init();
break;
case 'begin':
Expand Down
1 change: 1 addition & 0 deletions moz/js/hathitrust1.js
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ export default function(){
switch(data.cmd) {
case 'init':
br = JSON.parse(data.manifest);
if (sw) streamSaver.testSw(br.swInNavigator);
await init();
break;
case 'begin':
Expand Down
1 change: 1 addition & 0 deletions moz/js/stub.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
br.server = window.br.server;
br.data = window.br.data.flat();
br.protected = window.br.protected;
br.swInNavigator = navigator.serviceWorker != null;
return JSON.stringify(br);
}

Expand Down
1 change: 1 addition & 0 deletions moz/js/stub1.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
manifest.firstPageSeq = window.manifest.firstPageSeq;
manifest.totalSeq = window.manifest.totalSeq;
manifest.defaultImage = window.manifest.defaultImage;
manifest.swInNavigator = navigator.serviceWorker != null;
return JSON.stringify(manifest);
}

Expand Down
7 changes: 5 additions & 2 deletions moz/js/utils/streamsaver.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
: 'navigate'

const streamSaver = {
testSw,
createWriteStream,
WritableStream: global.WritableStream || ponyfill.WritableStream,
supportsTransferable: false,
Expand Down Expand Up @@ -92,15 +93,17 @@
return popup
}

function testSw(swInNavigator) {
try {
// We can't look for service worker since it may still work on http
new Response(new ReadableStream())
if (isSecureContext && !('serviceWorker' in navigator)) {
if (isSecureContext && !('serviceWorker' in navigator || swInNavigator)) {
useBlobFallback = true
}
} catch (err) {
useBlobFallback = true
}
}

test(() => {
// Transferable stream was first enabled in chrome v73 behind a flag
Expand Down Expand Up @@ -258,7 +261,7 @@
mitmTransporter.postMessage(...args)
}, { once: true })
}
}
} // !useBlobFallback

let chunks = []

Expand Down
2 changes: 1 addition & 1 deletion moz/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
, "description": "__MSG_description__"
, "homepage_url": "https://github.com/elementdavv/internet_archive_downloader"
, "name": "Internet Archive Downloader"
, "version": "1.0.0"
, "version": "1.0.1"
, "default_locale": "en"
, "browser_specific_settings": {
"gecko": {
Expand Down
2 changes: 1 addition & 1 deletion src/js/utils/streamsaver.js
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,7 @@
mitmTransporter.postMessage(...args)
}, { once: true })
}
}
} // !useBlobFallback

let chunks = []

Expand Down

0 comments on commit f3de5e5

Please sign in to comment.