You've already forked filebrowser
mirror of
https://github.com/filebrowser/filebrowser.git
synced 2025-11-26 14:25:26 +08:00
Former-commit-id: 682c7d56814a3c9a35fcf55b540e470b5c66d890 [formerly a603a591938ec8edbe3f703772f86ba978ff92de] [formerly 6d1a11fdeb5d3a00c202e125a0873b263a3787cf [formerly 12c466d2aa]]
Former-commit-id: 4f43bbf0b4f91a9528cdf881f4abbdfc098b82cd [formerly 7fc1e010ac54107ff03762ad729ed54beccca02c]
Former-commit-id: 4d464034e98aefbdce39d142a30bf34aa3fd2d2e
69 lines
2.0 KiB
Vue
69 lines
2.0 KiB
Vue
<template>
|
|
<div id="previewer">
|
|
<div class="bar">
|
|
<button @click="back" class="action" aria-label="Close Preview" id="close">
|
|
<i class="material-icons">close</i>
|
|
</button>
|
|
|
|
<rename-button v-if="allowEdit()"></rename-button>
|
|
<delete-button v-if="allowEdit()"></delete-button>
|
|
<download-button></download-button>
|
|
<info-button></info-button>
|
|
</div>
|
|
|
|
<div class="preview">
|
|
<img v-if="req.type == 'image'" :src="raw()">
|
|
<audio v-else-if="req.type == 'audio'" :src="raw()" controls></audio>
|
|
<video v-else-if="req.type == 'video'" :src="raw()" controls>
|
|
Sorry, your browser doesn't support embedded videos,
|
|
but don't worry, you can <a :href="download()">download it</a>
|
|
and watch it with your favorite video player!
|
|
</video>
|
|
<object v-else-if="req.extension == '.pdf'" class="pdf" :data="raw()"></object>
|
|
<a v-else-if="req.type == 'blob'" :href="download()">
|
|
<h2 class="message">Download <i class="material-icons">file_download</i></h2>
|
|
</a>
|
|
<pre v-else >{{ req.content }}</pre>
|
|
</div>
|
|
</div>
|
|
</template>
|
|
|
|
<script>
|
|
import { mapState } from 'vuex'
|
|
import url from '@/utils/url'
|
|
import InfoButton from './buttons/InfoButton'
|
|
import DeleteButton from './buttons/DeleteButton'
|
|
import RenameButton from './buttons/RenameButton'
|
|
import DownloadButton from './buttons/DownloadButton'
|
|
|
|
export default {
|
|
name: 'preview',
|
|
components: {
|
|
InfoButton,
|
|
DeleteButton,
|
|
RenameButton,
|
|
DownloadButton
|
|
},
|
|
computed: mapState(['req']),
|
|
methods: {
|
|
download: function () {
|
|
let url = `${this.$store.state.baseURL}/api/download/`
|
|
url += this.req.url.slice(6)
|
|
url += `?token=${this.$store.state.jwt}`
|
|
|
|
return url
|
|
},
|
|
raw: function () {
|
|
return `${this.download()}&inline=true`
|
|
},
|
|
back: function (event) {
|
|
let uri = url.removeLastDir(this.$route.path) + '/'
|
|
this.$router.push({ path: uri })
|
|
},
|
|
allowEdit: function (event) {
|
|
return this.$store.state.user.allowEdit
|
|
}
|
|
}
|
|
}
|
|
</script>
|