diff --git a/frontend/src/components/prompts/Share.vue b/frontend/src/components/prompts/Share.vue index 210b2f93..c0c3c083 100644 --- a/frontend/src/components/prompts/Share.vue +++ b/frontend/src/components/prompts/Share.vue @@ -32,6 +32,16 @@ content_paste + + + { + this.$showSuccess(this.$t("success.linkCopied")); + }); }, beforeDestroy() { window.removeEventListener("keydown", this.keyEvent); + this.clip.destroy(); }, computed: { ...mapState(["req", "loading", "multiple", "selected"]), - ...mapGetters(["selectedCount", "selectedCount"]), + ...mapGetters(["selectedCount"]), icon: function () { if (this.req.isDir) return "folder"; if (this.req.type === "image") return "insert_photo"; @@ -300,8 +316,13 @@ export default { toggleMultipleSelection() { this.$store.commit("multiple", !this.multiple); }, + isSingleFile: function () { + return ( + this.selectedCount === 1 && !this.req.items[this.selected[0]].isDir + ); + }, download() { - if (this.selectedCount === 1 && !this.req.items[this.selected[0]].isDir) { + if (this.isSingleFile()) { api.download( null, this.hash, @@ -326,6 +347,14 @@ export default { }, }); }, + linkSelected: function () { + return this.isSingleFile() + ? api.getDownloadURL({ + hash: this.hash, + path: this.req.items[this.selected[0]].path, + }) + : ""; + }, }, }; diff --git a/frontend/src/views/files/Preview.vue b/frontend/src/views/files/Preview.vue index d08ac5aa..7a731458 100644 --- a/frontend/src/views/files/Preview.vue +++ b/frontend/src/views/files/Preview.vue @@ -167,7 +167,6 @@ export default { nextLink: "", listing: null, name: "", - subtitles: [], fullSize: false, showNav: true, navTimeout: null, @@ -201,6 +200,12 @@ export default { isResizeEnabled() { return resizePreview; }, + subtitles() { + if (this.req.subtitles) { + return api.getSubtitlesURL(this.req); + } + return []; + }, }, watch: { $route: function () { @@ -266,10 +271,6 @@ export default { this.autoPlay = false; } - if (this.req.subtitles) { - this.subtitles = api.getSubtitlesURL(this.req); - } - let dirs = this.$route.fullPath.split("/"); this.name = decodeURIComponent(dirs[dirs.length - 1]);