mirror of
https://github.com/kenzok8/small-package
synced 2025-01-08 11:17:34 +08:00
update 2024-12-24 12:23:33
This commit is contained in:
parent
ab44f08c01
commit
a77df09805
@ -95,10 +95,15 @@ local api = require "luci.passwall.api"
|
|||||||
if (!response.ok) {
|
if (!response.ok) {
|
||||||
throw new Error("备份失败!");
|
throw new Error("备份失败!");
|
||||||
}
|
}
|
||||||
const filename = response.headers.get("X-Backup-Filename") || "passwall-backup.tar.gz";
|
const filename = response.headers.get("X-Backup-Filename");
|
||||||
|
if (!filename) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
return response.blob().then(blob => ({ blob, filename }));
|
return response.blob().then(blob => ({ blob, filename }));
|
||||||
})
|
})
|
||||||
.then(({ blob, filename }) => {
|
.then(result => {
|
||||||
|
if (!result) return;
|
||||||
|
const { blob, filename } = result;
|
||||||
const url = window.URL.createObjectURL(blob);
|
const url = window.URL.createObjectURL(blob);
|
||||||
const a = document.createElement("a");
|
const a = document.createElement("a");
|
||||||
a.href = url;
|
a.href = url;
|
||||||
|
Loading…
Reference in New Issue
Block a user