mirror of
https://github.com/filebrowser/filebrowser.git
synced 2025-05-25 19:42:58 +00:00

Former-commit-id: 682c7d56814a3c9a35fcf55b540e470b5c66d890 [formerly a603a591938ec8edbe3f703772f86ba978ff92de] [formerly 6d1a11fdeb5d3a00c202e125a0873b263a3787cf [formerly 12c466d2aafbd07bea83352c03d0ad19347dbea3]] Former-commit-id: 4f43bbf0b4f91a9528cdf881f4abbdfc098b82cd [formerly 7fc1e010ac54107ff03762ad729ed54beccca02c] Former-commit-id: 4d464034e98aefbdce39d142a30bf34aa3fd2d2e
46 lines
1.2 KiB
Vue
46 lines
1.2 KiB
Vue
<template>
|
|
<div class="prompt" id="download">
|
|
<h3>Download files</h3>
|
|
<p>Choose the format you want to download.</p>
|
|
<button @click="download('zip')" autofocus>zip</button>
|
|
<button @click="download('tar')" autofocus>tar</button>
|
|
<button @click="download('targz')" autofocus>tar.gz</button>
|
|
<button @click="download('tarbz2')" autofocus>tar.bz2</button>
|
|
<button @click="download('tarxz')" autofocus>tar.xz</button>
|
|
</div>
|
|
</template>
|
|
|
|
<script>
|
|
import {mapGetters, mapState} from 'vuex'
|
|
|
|
export default {
|
|
name: 'download-prompt',
|
|
computed: {
|
|
...mapState(['selected', 'req']),
|
|
...mapGetters(['selectedCount'])
|
|
},
|
|
methods: {
|
|
download: function (format) {
|
|
let uri = this.$route.params[0]
|
|
uri = this.$store.state.baseURL + '/api/download/' + uri
|
|
uri += `?token=${this.$store.state.jwt}`
|
|
uri += `&format=${format}`
|
|
|
|
if (this.selectedCount > 0) {
|
|
let files = ''
|
|
|
|
for (let i of this.selected) {
|
|
files += this.req.items[i].url.replace(window.location.pathname, '') + ','
|
|
}
|
|
|
|
files = files.substring(0, files.length - 1)
|
|
files = encodeURIComponent(files)
|
|
uri += `&files=${files}`
|
|
}
|
|
|
|
window.open(uri)
|
|
}
|
|
}
|
|
}
|
|
</script>
|