mirror of
https://github.com/EverythingPublic/firefox-ext-dl.git
synced 2026-01-14 08:38:35 +00:00
feat: update index.html
This commit is contained in:
@@ -110,8 +110,9 @@
|
|||||||
.then(res => res.ok ? res.json() : Promise.reject(new Error(`Server responded ${res.status}`)))
|
.then(res => res.ok ? res.json() : Promise.reject(new Error(`Server responded ${res.status}`)))
|
||||||
.then(data => (status.textContent = 'Downloading file...', fetch(data.current_version.file.url).then(res => res.ok ? res.blob() : Promise.reject(new Error(`File download failed: ${res.status}`))).then(blob => ({blob, url: data.current_version.file.url}))))
|
.then(data => (status.textContent = 'Downloading file...', fetch(data.current_version.file.url).then(res => res.ok ? res.blob() : Promise.reject(new Error(`File download failed: ${res.status}`))).then(blob => ({blob, url: data.current_version.file.url}))))
|
||||||
.then(({blob, url}) => {
|
.then(({blob, url}) => {
|
||||||
const a = document.createElement('a'), fileName = url.split('/').pop().replace(/\.xpi$/, '.zip');
|
const zipBlob = new Blob([blob], { type: 'application/zip' }), fileName = url.split('/').pop().replace(/\.xpi$/, '.zip');
|
||||||
a.href = URL.createObjectURL(blob);
|
const a = document.createElement('a');
|
||||||
|
a.href = URL.createObjectURL(zipBlob);
|
||||||
a.download = fileName;
|
a.download = fileName;
|
||||||
document.body.appendChild(a).click();
|
document.body.appendChild(a).click();
|
||||||
URL.revokeObjectURL(a.href);
|
URL.revokeObjectURL(a.href);
|
||||||
|
|||||||
Reference in New Issue
Block a user