diff --git a/frontend/src/dialog/photo/files.vue b/frontend/src/dialog/photo/files.vue index 19db01737..c0624b8c4 100644 --- a/frontend/src/dialog/photo/files.vue +++ b/frontend/src/dialog/photo/files.vue @@ -61,7 +61,7 @@ Name - {{ file.Name }} + {{ file.Name }} @@ -172,6 +172,9 @@ openFile(file) { this.$viewer.show([Thumb.fromFile(this.model, file)], 0); }, + download(file) { + file.download(); + }, ungroup(file) { this.model.ungroupFile(file.UID); }, diff --git a/frontend/src/model/file.js b/frontend/src/model/file.js index ba23ace3e..6cf1b4bca 100644 --- a/frontend/src/model/file.js +++ b/frontend/src/model/file.js @@ -112,6 +112,18 @@ export class File extends RestModel { return "/api/v1/dl/" + this.Hash + "?t=" + config.downloadToken(); } + download() { + if (!this.Hash) { + console.warn("no file hash found for download", this); + return; + } + + let link = document.createElement("a"); + link.href = this.getDownloadUrl() + link.download = this.baseName(this.Name); + link.click(); + } + thumbnailSrcset() { const result = [];