diff --git a/frontend/src/api/files.js b/frontend/src/api/files.js
index 2b5cf540..d12a4237 100644
--- a/frontend/src/api/files.js
+++ b/frontend/src/api/files.js
@@ -58,7 +58,7 @@ export async function put (url, content = '') {
}
export function download (format, ...files) {
- let url = `${baseURL}/api/raw`
+ let url = store.getters['isSharing'] ? `${baseURL}/api/public/dl/${store.state.hash}` : `${baseURL}/api/raw`
if (files.length === 1) {
url += removePrefix(files[0]) + '?'
diff --git a/frontend/src/api/utils.js b/frontend/src/api/utils.js
index 617e2258..68337d10 100644
--- a/frontend/src/api/utils.js
+++ b/frontend/src/api/utils.js
@@ -36,6 +36,8 @@ export async function fetchJSON (url, opts) {
export function removePrefix (url) {
if (url.startsWith('/files')) {
url = url.slice(6)
+ } else if (store.getters['isSharing']) {
+ url = url.slice(7 + store.state.hash.length)
}
if (url === '') url = '/'
diff --git a/frontend/src/components/Header.vue b/frontend/src/components/Header.vue
index b9278d10..6d9a1270 100644
--- a/frontend/src/components/Header.vue
+++ b/frontend/src/components/Header.vue
@@ -8,8 +8,8 @@
-
-
-
+
{{ selectedCount }} selected
@@ -37,13 +37,13 @@
-
+
-
+
check_circle
{{ $t('buttons.select') }}
@@ -110,7 +110,8 @@ export default {
'isEditor',
'isPreview',
'isListing',
- 'isLogged'
+ 'isLogged',
+ 'isSharing'
]),
...mapState([
'req',
@@ -128,7 +129,7 @@ export default {
return this.isListing && this.user.perm.create
},
showDownloadButton () {
- return this.isFiles && this.user.perm.download
+ return (this.isFiles && this.user.perm.download) || (this.isSharing && this.selectedCount > 0)
},
showDeleteButton () {
return this.isFiles && (this.isListing
@@ -156,7 +157,7 @@ export default {
: this.user.perm.create)
},
showMore () {
- return this.isFiles && this.$store.state.show === 'more'
+ return (this.isFiles || this.isSharing) && this.$store.state.show === 'more'
},
showOverlay () {
return this.showMore
diff --git a/frontend/src/components/buttons/Download.vue b/frontend/src/components/buttons/Download.vue
index 8f6aba6b..3798771f 100644
--- a/frontend/src/components/buttons/Download.vue
+++ b/frontend/src/components/buttons/Download.vue
@@ -14,11 +14,11 @@ export default {
name: 'download-button',
computed: {
...mapState(['req', 'selected']),
- ...mapGetters(['isListing', 'selectedCount'])
+ ...mapGetters(['isListing', 'selectedCount', 'isSharing'])
},
methods: {
download: function () {
- if (!this.isListing) {
+ if (!this.isListing && !this.isSharing) {
api.download(null, this.$route.path)
return
}
diff --git a/frontend/src/components/files/ListingItem.vue b/frontend/src/components/files/ListingItem.vue
index 8dabb418..596ce736 100644
--- a/frontend/src/components/files/ListingItem.vue
+++ b/frontend/src/components/files/ListingItem.vue
@@ -13,7 +13,7 @@
:aria-label="name"
:aria-selected="isSelected">
-
![]()
+
{{ icon }}
@@ -47,8 +47,12 @@ export default {
},
props: ['name', 'isDir', 'url', 'type', 'size', 'modified', 'index'],
computed: {
- ...mapState(['user', 'selected', 'req', 'user', 'jwt']),
- ...mapGetters(['selectedCount']),
+ ...mapState(['user', 'selected', 'req', 'jwt']),
+ ...mapGetters(['selectedCount', 'isSharing']),
+ singleClick () {
+ if (this.isSharing) return false
+ return this.user.singleClick
+ },
isSelected () {
return (this.selected.indexOf(this.index) !== -1)
},
@@ -60,10 +64,10 @@ export default {
return 'insert_drive_file'
},
isDraggable () {
- return this.user.perm.rename
+ return !this.isSharing && this.user.perm.rename
},
canDrop () {
- if (!this.isDir) return false
+ if (!this.isDir || this.isSharing) return false
for (let i of this.selected) {
if (this.req.items[i].url === this.url) {
@@ -171,11 +175,11 @@ export default {
action(overwrite, rename)
},
itemClick: function(event) {
- if (this.user.singleClick && !this.$store.state.multiple) this.open()
+ if (this.singleClick && !this.$store.state.multiple) this.open()
else this.click(event)
},
click: function (event) {
- if (!this.user.singleClick && this.selectedCount !== 0) event.preventDefault()
+ if (!this.singleClick && this.selectedCount !== 0) event.preventDefault()
if (this.$store.state.selected.indexOf(this.index) !== -1) {
this.removeSelected(this.index)
return
@@ -202,11 +206,11 @@ export default {
return
}
- if (!this.user.singleClick && !event.ctrlKey && !event.metaKey && !this.$store.state.multiple) this.resetSelected()
+ if (!this.singleClick && !event.ctrlKey && !event.metaKey && !this.$store.state.multiple) this.resetSelected()
this.addSelected(this.index)
},
dblclick: function () {
- if (!this.user.singleClick) this.open()
+ if (!this.singleClick) this.open()
},
touchstart () {
setTimeout(() => {
diff --git a/frontend/src/css/_share.css b/frontend/src/css/_share.css
index 9e1b3528..967d91d5 100644
--- a/frontend/src/css/_share.css
+++ b/frontend/src/css/_share.css
@@ -49,7 +49,7 @@
}
.share__box__items #listing.list .item {
- cursor: auto;
+ cursor: pointer;
border-left: 0;
border-right: 0;
border-bottom: 0;
@@ -57,5 +57,9 @@
}
.share__box__items #listing.list .item .name {
- width: auto;
+ width: 50%;
+}
+
+.share__box__items #listing.list .item .modified {
+ width: 25%;
}
\ No newline at end of file
diff --git a/frontend/src/i18n/en.json b/frontend/src/i18n/en.json
index aaa2381f..f4670092 100644
--- a/frontend/src/i18n/en.json
+++ b/frontend/src/i18n/en.json
@@ -248,6 +248,7 @@
},
"download": {
"downloadFile": "Download File",
- "downloadFolder": "Download Folder"
+ "downloadFolder": "Download Folder",
+ "downloadSelected": "Download Selected"
}
}
diff --git a/frontend/src/i18n/zh-cn.json b/frontend/src/i18n/zh-cn.json
index cb62494d..fe5d4125 100644
--- a/frontend/src/i18n/zh-cn.json
+++ b/frontend/src/i18n/zh-cn.json
@@ -245,6 +245,7 @@
},
"download": {
"downloadFile": "下载文件",
- "downloadFolder": "下载文件夹"
+ "downloadFolder": "下载文件夹",
+ "downloadSelected": "下载已选"
}
}
\ No newline at end of file
diff --git a/frontend/src/store/getters.js b/frontend/src/store/getters.js
index 11ad60ab..70c9cd0e 100644
--- a/frontend/src/store/getters.js
+++ b/frontend/src/store/getters.js
@@ -4,6 +4,7 @@ const getters = {
isListing: (state, getters) => getters.isFiles && state.req.isDir,
isEditor: (state, getters) => getters.isFiles && (state.req.type === 'text' || state.req.type === 'textImmutable'),
isPreview: state => state.previewMode,
+ isSharing: state => !state.loading && state.route.name === 'Share',
selectedCount: state => state.selected.length,
progress : state => {
if (state.upload.progress.length == 0) {
diff --git a/frontend/src/store/index.js b/frontend/src/store/index.js
index 40b56df4..199d09ca 100644
--- a/frontend/src/store/index.js
+++ b/frontend/src/store/index.js
@@ -24,7 +24,8 @@ const state = {
showShell: false,
showMessage: null,
showConfirm: null,
- previewMode: false
+ previewMode: false,
+ hash: ''
}
export default new Vuex.Store({
diff --git a/frontend/src/store/mutations.js b/frontend/src/store/mutations.js
index 46aad6e6..923ee503 100644
--- a/frontend/src/store/mutations.js
+++ b/frontend/src/store/mutations.js
@@ -86,7 +86,8 @@ const mutations = {
},
setPreviewMode(state, value) {
state.previewMode = value
- }
+ },
+ setHash: (state, value) => (state.hash = value),
}
export default mutations
diff --git a/frontend/src/views/Share.vue b/frontend/src/views/Share.vue
index 8c2b0cb7..0cfea28d 100644
--- a/frontend/src/views/Share.vue
+++ b/frontend/src/views/Share.vue
@@ -1,107 +1,223 @@
-
-
-
-
- {{ file.isDir ? 'folder' : 'insert_drive_file'}}
-
-
- {{ $t('prompts.displayName') }} {{ file.name }}
-
-
- {{ $t('prompts.lastModified') }}: {{ humanTime }}
-
-
- {{ $t('prompts.size') }}: {{ humanSize }}
-
-
-
-
-
+
+
+
+ home
+
+
+
+ keyboard_arrow_right
+ {{ link.name }}
+
-
-