working better

Former-commit-id: 682c7d56814a3c9a35fcf55b540e470b5c66d890 [formerly a603a591938ec8edbe3f703772f86ba978ff92de] [formerly 6d1a11fdeb5d3a00c202e125a0873b263a3787cf [formerly 12c466d2aa]]
Former-commit-id: 4f43bbf0b4f91a9528cdf881f4abbdfc098b82cd [formerly 7fc1e010ac54107ff03762ad729ed54beccca02c]
Former-commit-id: 4d464034e98aefbdce39d142a30bf34aa3fd2d2e
This commit is contained in:
Henrique Dias
2017-07-03 15:19:17 +01:00
parent bae3c341f6
commit 067051ea09
20 changed files with 292 additions and 250 deletions

View File

@@ -16,11 +16,11 @@
<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=true">download it</a>
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=true">
<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>
@@ -30,7 +30,7 @@
<script>
import { mapState } from 'vuex'
import page from '../utils/page'
import url from '@/utils/url'
import InfoButton from './buttons/InfoButton'
import DeleteButton from './buttons/DeleteButton'
import RenameButton from './buttons/RenameButton'
@@ -46,12 +46,19 @@ export default {
},
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.req.url + '?raw=true'
return `${this.download()}&inline=true`
},
back: function (event) {
let url = page.removeLastDir(window.location.pathname) + '/'
page.open(url)
let uri = url.removeLastDir(this.$route.path) + '/'
this.$router.push({ path: uri })
},
allowEdit: function (event) {
return this.$store.state.user.allowEdit