Organisation and reworking stuff
parent
191b31e977
commit
8d891f0d51
|
@ -1,9 +0,0 @@
|
||||||
<template>
|
|
||||||
<div>Files</div>
|
|
||||||
</template>
|
|
||||||
|
|
||||||
<script>
|
|
||||||
export default {
|
|
||||||
name: 'files'
|
|
||||||
}
|
|
||||||
</script>
|
|
|
@ -69,8 +69,8 @@
|
||||||
<script>
|
<script>
|
||||||
import {mapState} from 'vuex'
|
import {mapState} from 'vuex'
|
||||||
import Item from './ListingItem'
|
import Item from './ListingItem'
|
||||||
import webdav from '../utils/webdav'
|
import webdav from '@/utils/webdav'
|
||||||
import page from '../utils/page'
|
import page from '@/utils/page'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'listing',
|
name: 'listing',
|
||||||
|
|
|
@ -28,8 +28,8 @@
|
||||||
import { mapMutations, mapGetters, mapState } from 'vuex'
|
import { mapMutations, mapGetters, mapState } from 'vuex'
|
||||||
import filesize from 'filesize'
|
import filesize from 'filesize'
|
||||||
import moment from 'moment'
|
import moment from 'moment'
|
||||||
import webdav from '../utils/webdav.js'
|
import webdav from '@/utils/webdav.js'
|
||||||
import page from '../utils/page.js'
|
import page from '@/utils/page.js'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'item',
|
name: 'item',
|
||||||
|
@ -107,7 +107,7 @@ export default {
|
||||||
return false
|
return false
|
||||||
},
|
},
|
||||||
open: function (event) {
|
open: function (event) {
|
||||||
page.open(this.url)
|
this.$router.push({path: this.url})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -77,20 +77,20 @@ import Help from './Help'
|
||||||
import Preview from './Preview'
|
import Preview from './Preview'
|
||||||
import Listing from './Listing'
|
import Listing from './Listing'
|
||||||
import Editor from './Editor'
|
import Editor from './Editor'
|
||||||
import InfoButton from './InfoButton'
|
import InfoButton from './buttons/InfoButton'
|
||||||
import InfoPrompt from './InfoPrompt'
|
import InfoPrompt from './prompts/InfoPrompt'
|
||||||
import DeleteButton from './DeleteButton'
|
import DeleteButton from './buttons/DeleteButton'
|
||||||
import DeletePrompt from './DeletePrompt'
|
import DeletePrompt from './prompts/DeletePrompt'
|
||||||
import RenameButton from './RenameButton'
|
import RenameButton from './buttons/RenameButton'
|
||||||
import RenamePrompt from './RenamePrompt'
|
import RenamePrompt from './prompts/RenamePrompt'
|
||||||
import UploadButton from './UploadButton'
|
import UploadButton from './buttons/UploadButton'
|
||||||
import DownloadButton from './DownloadButton'
|
import DownloadButton from './buttons/DownloadButton'
|
||||||
import DownloadPrompt from './DownloadPrompt'
|
import DownloadPrompt from './prompts/DownloadPrompt'
|
||||||
import SwitchButton from './SwitchViewButton'
|
import SwitchButton from './buttons/SwitchViewButton'
|
||||||
import MoveButton from './MoveButton'
|
import MoveButton from './buttons/MoveButton'
|
||||||
import MovePrompt from './MovePrompt'
|
import MovePrompt from './prompts/MovePrompt'
|
||||||
import NewFilePrompt from './NewFilePrompt'
|
import NewFilePrompt from './prompts/NewFilePrompt'
|
||||||
import NewDirPrompt from './NewDirPrompt'
|
import NewDirPrompt from './prompts/NewDirPrompt'
|
||||||
import css from '@/utils/css'
|
import css from '@/utils/css'
|
||||||
import auth from '@/utils/auth'
|
import auth from '@/utils/auth'
|
||||||
import api from '@/utils/api'
|
import api from '@/utils/api'
|
||||||
|
@ -162,7 +162,18 @@ export default {
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
beforeRouteUpdate (to, from, next) {
|
beforeRouteUpdate (to, from, next) {
|
||||||
console.log('hey')
|
this.$store.commit('resetSelected')
|
||||||
|
this.$store.commit('multiple', false)
|
||||||
|
|
||||||
|
api.fetch(to.params[0])
|
||||||
|
.then(() => {
|
||||||
|
next()
|
||||||
|
})
|
||||||
|
.catch(error => {
|
||||||
|
// TODO: 404, 403 and 500!
|
||||||
|
console.log(error)
|
||||||
|
window.alert('Something went wrong. Please reload.')
|
||||||
|
})
|
||||||
},
|
},
|
||||||
mounted () {
|
mounted () {
|
||||||
updateColumnSizes()
|
updateColumnSizes()
|
||||||
|
|
|
@ -31,10 +31,10 @@
|
||||||
<script>
|
<script>
|
||||||
import { mapState } from 'vuex'
|
import { mapState } from 'vuex'
|
||||||
import page from '../utils/page'
|
import page from '../utils/page'
|
||||||
import InfoButton from './InfoButton'
|
import InfoButton from './buttons/InfoButton'
|
||||||
import DeleteButton from './DeleteButton'
|
import DeleteButton from './buttons/DeleteButton'
|
||||||
import RenameButton from './RenameButton'
|
import RenameButton from './buttons/RenameButton'
|
||||||
import DownloadButton from './DownloadButton'
|
import DownloadButton from './buttons/DownloadButton'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'preview',
|
name: 'preview',
|
||||||
|
|
|
@ -12,8 +12,8 @@
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import {mapGetters, mapMutations, mapState} from 'vuex'
|
import {mapGetters, mapMutations, mapState} from 'vuex'
|
||||||
import webdav from '../utils/webdav'
|
import webdav from '@/utils/webdav'
|
||||||
import page from '../utils/page'
|
import page from '@/utils/page'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'delete-prompt',
|
name: 'delete-prompt',
|
|
@ -18,8 +18,8 @@
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { mapState } from 'vuex'
|
import { mapState } from 'vuex'
|
||||||
import page from '../utils/page'
|
import page from '@/utils/page'
|
||||||
import webdav from '../utils/webdav'
|
import webdav from '@/utils/webdav'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'move-prompt',
|
name: 'move-prompt',
|
|
@ -11,8 +11,8 @@
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import page from '../utils/page'
|
import page from '@/utils/page'
|
||||||
import webdav from '../utils/webdav'
|
import webdav from '@/utils/webdav'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'new-dir-prompt',
|
name: 'new-dir-prompt',
|
|
@ -11,8 +11,8 @@
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import page from '../utils/page'
|
import page from '@/utils/page'
|
||||||
import webdav from '../utils/webdav'
|
import webdav from '@/utils/webdav'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'new-file-prompt',
|
name: 'new-file-prompt',
|
|
@ -12,8 +12,8 @@
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { mapState } from 'vuex'
|
import { mapState } from 'vuex'
|
||||||
import page from '../utils/page'
|
import page from '@/utils/page'
|
||||||
import webdav from '../utils/webdav'
|
import webdav from '@/utils/webdav'
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'rename-prompt',
|
name: 'rename-prompt',
|
|
@ -1,7 +1,6 @@
|
||||||
import Vue from 'vue'
|
import Vue from 'vue'
|
||||||
import Router from 'vue-router'
|
import Router from 'vue-router'
|
||||||
import Login from '@/components/Login'
|
import Login from '@/components/Login'
|
||||||
import Files from '@/components/Files'
|
|
||||||
import Main from '@/components/Main'
|
import Main from '@/components/Main'
|
||||||
import auth from '@/utils/auth.js'
|
import auth from '@/utils/auth.js'
|
||||||
|
|
||||||
|
@ -35,8 +34,7 @@ const router = new Router({
|
||||||
children: [
|
children: [
|
||||||
{
|
{
|
||||||
path: '/files*',
|
path: '/files*',
|
||||||
name: 'Files',
|
name: 'Files'
|
||||||
component: Files
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: '/*',
|
path: '/*',
|
||||||
|
|
|
@ -10,7 +10,6 @@ function fetch (url) {
|
||||||
if (request.status === 200) {
|
if (request.status === 200) {
|
||||||
let req = JSON.parse(request.responseText)
|
let req = JSON.parse(request.responseText)
|
||||||
store.commit('updateRequest', req)
|
store.commit('updateRequest', req)
|
||||||
console.log(req)
|
|
||||||
document.title = req.name
|
document.title = req.name
|
||||||
resolve()
|
resolve()
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -1,36 +1,3 @@
|
||||||
import store from '../store/store'
|
|
||||||
|
|
||||||
function open (url, history) {
|
|
||||||
// Reset info
|
|
||||||
store.commit('resetSelected')
|
|
||||||
store.commit('multiple', false)
|
|
||||||
|
|
||||||
let request = new window.XMLHttpRequest()
|
|
||||||
request.open('GET', url, true)
|
|
||||||
request.setRequestHeader('Accept', 'application/json')
|
|
||||||
|
|
||||||
request.onload = () => {
|
|
||||||
if (request.status === 200) {
|
|
||||||
let req = JSON.parse(request.responseText)
|
|
||||||
store.commit('updateRequest', req)
|
|
||||||
|
|
||||||
if (history) {
|
|
||||||
window.history.pushState({
|
|
||||||
name: req.data.name,
|
|
||||||
url: url
|
|
||||||
}, req.data.name, url)
|
|
||||||
|
|
||||||
document.title = req.data.name
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
console.log(request.responseText)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
request.onerror = (error) => { console.log(error) }
|
|
||||||
request.send()
|
|
||||||
}
|
|
||||||
|
|
||||||
function removeLastDir (url) {
|
function removeLastDir (url) {
|
||||||
var arr = url.split('/')
|
var arr = url.split('/')
|
||||||
if (arr.pop() === '') {
|
if (arr.pop() === '') {
|
||||||
|
@ -41,11 +8,5 @@ function removeLastDir (url) {
|
||||||
}
|
}
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
reload: () => {
|
|
||||||
open(window.location.pathname, false)
|
|
||||||
},
|
|
||||||
open: (url) => {
|
|
||||||
open(url, true)
|
|
||||||
},
|
|
||||||
removeLastDir: removeLastDir
|
removeLastDir: removeLastDir
|
||||||
}
|
}
|
||||||
|
|
2
file.go
2
file.go
|
@ -83,7 +83,7 @@ func getInfo(url *url.URL, c *FileManager, u *User) (*file, error) {
|
||||||
var err error
|
var err error
|
||||||
|
|
||||||
i := &file{
|
i := &file{
|
||||||
URL: c.RootURL() + "/files" + url.Path,
|
URL: "/files" + url.Path,
|
||||||
VirtualPath: url.Path,
|
VirtualPath: url.Path,
|
||||||
Path: filepath.Join(string(u.FileSystem), url.Path),
|
Path: filepath.Join(string(u.FileSystem), url.Path),
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue