mirror of
https://github.com/mealie-recipes/mealie.git
synced 2025-07-31 14:34:42 -04:00
bug/backup-download (#245)
* fix blocked download * + download blocked Co-authored-by: hay-kot <hay-kot@pm.me>
This commit is contained in:
parent
4799fffc93
commit
c61906e480
@ -9,4 +9,5 @@
|
|||||||
- Fix Tags/Categories render problems on recipes
|
- Fix Tags/Categories render problems on recipes
|
||||||
- Tags redirect to new tag pages
|
- Tags redirect to new tag pages
|
||||||
- Categories redirect to category pages
|
- Categories redirect to category pages
|
||||||
|
- Fix Backup download blocked by authentication
|
||||||
|
|
||||||
|
@ -37,7 +37,12 @@
|
|||||||
<v-divider></v-divider>
|
<v-divider></v-divider>
|
||||||
|
|
||||||
<v-card-actions>
|
<v-card-actions>
|
||||||
<v-btn color="accent" text :href="`/api/backups/${name}/download`">
|
<v-btn
|
||||||
|
color="accent"
|
||||||
|
text
|
||||||
|
:loading="downloading"
|
||||||
|
@click="downloadFile(`/api/backups/${name}/download`)"
|
||||||
|
>
|
||||||
{{ $t("general.download") }}
|
{{ $t("general.download") }}
|
||||||
</v-btn>
|
</v-btn>
|
||||||
<v-spacer></v-spacer>
|
<v-spacer></v-spacer>
|
||||||
@ -61,6 +66,7 @@
|
|||||||
|
|
||||||
<script>
|
<script>
|
||||||
import ImportOptions from "@/components/Admin/Backup/ImportOptions";
|
import ImportOptions from "@/components/Admin/Backup/ImportOptions";
|
||||||
|
import axios from "axios";
|
||||||
export default {
|
export default {
|
||||||
components: { ImportOptions },
|
components: { ImportOptions },
|
||||||
props: {
|
props: {
|
||||||
@ -83,6 +89,7 @@ export default {
|
|||||||
dialog: false,
|
dialog: false,
|
||||||
forceImport: false,
|
forceImport: false,
|
||||||
rebaseImport: false,
|
rebaseImport: false,
|
||||||
|
downloading: false,
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
@ -109,6 +116,23 @@ export default {
|
|||||||
this.close();
|
this.close();
|
||||||
this.$emit(event, eventData);
|
this.$emit(event, eventData);
|
||||||
},
|
},
|
||||||
|
async downloadFile(downloadURL) {
|
||||||
|
this.downloading = true;
|
||||||
|
const response = await axios({
|
||||||
|
url: downloadURL,
|
||||||
|
method: "GET",
|
||||||
|
responseType: "blob", // important
|
||||||
|
});
|
||||||
|
|
||||||
|
const url = window.URL.createObjectURL(new Blob([response.data]));
|
||||||
|
const link = document.createElement("a");
|
||||||
|
link.href = url;
|
||||||
|
link.setAttribute("download", `${this.name}.zip`);
|
||||||
|
document.body.appendChild(link);
|
||||||
|
link.click();
|
||||||
|
|
||||||
|
this.downloading = false;
|
||||||
|
},
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user