diff --git a/README.md b/README.md index 94e3576..adda005 100644 --- a/README.md +++ b/README.md @@ -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) diff --git a/moz/js/content1.js b/moz/js/content1.js index 8a94a45..5504b58 100644 --- a/moz/js/content1.js +++ b/moz/js/content1.js @@ -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': diff --git a/moz/js/hathitrust1.js b/moz/js/hathitrust1.js index b79fdf3..9578280 100644 --- a/moz/js/hathitrust1.js +++ b/moz/js/hathitrust1.js @@ -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': diff --git a/moz/js/stub.js b/moz/js/stub.js index ef2340c..34a3004 100644 --- a/moz/js/stub.js +++ b/moz/js/stub.js @@ -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); } diff --git a/moz/js/stub1.js b/moz/js/stub1.js index 8a9c0e5..8b12740 100644 --- a/moz/js/stub1.js +++ b/moz/js/stub1.js @@ -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); } diff --git a/moz/js/utils/streamsaver.js b/moz/js/utils/streamsaver.js index 694446b..af9eeb4 100644 --- a/moz/js/utils/streamsaver.js +++ b/moz/js/utils/streamsaver.js @@ -26,6 +26,7 @@ : 'navigate' const streamSaver = { + testSw, createWriteStream, WritableStream: global.WritableStream || ponyfill.WritableStream, supportsTransferable: false, @@ -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 @@ -258,7 +261,7 @@ mitmTransporter.postMessage(...args) }, { once: true }) } - } + } // !useBlobFallback let chunks = [] diff --git a/moz/manifest.json b/moz/manifest.json index 768cb93..a69e083 100644 --- a/moz/manifest.json +++ b/moz/manifest.json @@ -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": { diff --git a/src/js/utils/streamsaver.js b/src/js/utils/streamsaver.js index 694446b..13786ba 100644 --- a/src/js/utils/streamsaver.js +++ b/src/js/utils/streamsaver.js @@ -258,7 +258,7 @@ mitmTransporter.postMessage(...args) }, { once: true }) } - } + } // !useBlobFallback let chunks = []