diff --git a/frontend/src/api/files.js b/frontend/src/api/files.js
index 08f0d84a..a06469a7 100644
--- a/frontend/src/api/files.js
+++ b/frontend/src/api/files.js
@@ -58,7 +58,8 @@ export async function put (url, content = '') {
}
export function download (format, ...files) {
- let url = `${baseURL}/api/raw`
+ const isSharing = store.getters['isSharing']
+ let url = isSharing ? `${baseURL}/api/public/dl/${store.state.shared.hash}` : `${baseURL}/api/raw`
if (files.length === 1) {
url += removePrefix(files[0]) + '?'
@@ -78,7 +79,9 @@ export function download (format, ...files) {
url += `algo=${format}&`
}
- url += `auth=${store.state.jwt}`
+ if (!isSharing) {
+ url += `auth=${store.state.jwt}`
+ }
window.open(url)
}
diff --git a/frontend/src/api/utils.js b/frontend/src/api/utils.js
index 617e2258..b6c41037 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.shared.hash.length)
}
if (url === '') url = '/'
diff --git a/frontend/src/components/Header.vue b/frontend/src/components/Header.vue
index b9278d10..7829fa7d 100644
--- a/frontend/src/components/Header.vue
+++ b/frontend/src/components/Header.vue
@@ -28,7 +28,7 @@
-
+
@@ -49,6 +49,17 @@
+
+
+
+
+
+
+
+
@@ -110,14 +121,17 @@ export default {
'isEditor',
'isPreview',
'isListing',
- 'isLogged'
+ 'isLogged',
+ 'isSharing',
+ 'sharedSelectedCount'
]),
...mapState([
'req',
'user',
'loading',
'reload',
- 'multiple'
+ 'multiple',
+ 'shared'
]),
logoURL: () => logoURL,
isExecEnabled: () => enableExec,
@@ -156,7 +170,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
@@ -176,6 +190,10 @@ export default {
this.$store.commit('multiple', !this.multiple)
this.resetPrompts()
},
+ toggleSharedMultipleSelection () {
+ this.$store.commit('sharedMultiple', !this.shared.multiple)
+ this.resetPrompts()
+ },
resetPrompts () {
this.$store.commit('closeHovers')
}
diff --git a/frontend/src/components/buttons/Download.vue b/frontend/src/components/buttons/Download.vue
index 8f6aba6b..42b018c0 100644
--- a/frontend/src/components/buttons/Download.vue
+++ b/frontend/src/components/buttons/Download.vue
@@ -3,6 +3,7 @@
file_download
{{ $t('buttons.download') }}
{{ selectedCount }}
+
{{ sharedSelectedCount }}
@@ -13,12 +14,12 @@ import { files as api } from '@/api'
export default {
name: 'download-button',
computed: {
- ...mapState(['req', 'selected']),
- ...mapGetters(['isListing', 'selectedCount'])
+ ...mapState(['req', 'selected', 'shared']),
+ ...mapGetters(['isListing', 'selectedCount', 'isSharing', 'sharedSelectedCount'])
},
methods: {
download: function () {
- if (!this.isListing) {
+ if (!this.isListing && !this.isSharing) {
api.download(null, this.$route.path)
return
}
@@ -28,6 +29,11 @@ export default {
return
}
+ if (this.sharedSelectedCount === 1 && !this.shared.req.items[this.shared.selected[0]].isDir) {
+ api.download(null, this.shared.req.items[this.shared.selected[0]].url)
+ return
+ }
+
this.$store.commit('showHover', 'download')
}
}
diff --git a/frontend/src/components/prompts/Download.vue b/frontend/src/components/prompts/Download.vue
index fa129590..07deb904 100644
--- a/frontend/src/components/prompts/Download.vue
+++ b/frontend/src/components/prompts/Download.vue
@@ -25,12 +25,20 @@ import { files as api } from '@/api'
export default {
name: 'download',
computed: {
- ...mapState(['selected', 'req']),
- ...mapGetters(['selectedCount'])
+ ...mapState(['selected', 'req', 'shared']),
+ ...mapGetters(['selectedCount', 'isSharing' ,'sharedSelectedCount'])
},
methods: {
download: function (format) {
- if (this.selectedCount === 0) {
+ if (this.isSharing) {
+ let files = []
+
+ for (let i of this.shared.selected) {
+ files.push(this.shared.req.items[i].url)
+ }
+
+ api.download(format, ...files)
+ } else if (this.selectedCount === 0) {
api.download(format, this.$route.path)
} else {
let files = []
diff --git a/frontend/src/css/mobile.css b/frontend/src/css/mobile.css
index 556ca033..c34dc9d8 100644
--- a/frontend/src/css/mobile.css
+++ b/frontend/src/css/mobile.css
@@ -28,7 +28,7 @@
height: 100%;
background-color: rgba(0, 0, 0, 0.1);
}
- #dropdown {
+ .dropdown {
position: fixed;
top: 1em;
right: 1em;
@@ -40,23 +40,23 @@
transform-origin: top right;
z-index: 99999;
}
- #dropdown > div {
+ .dropdown > div {
display: block;
}
- #dropdown.active {
+ .dropdown.active {
transform: scale(1);
}
- #dropdown .action {
+ .dropdown .action {
display: flex;
align-items: center;
border-radius: 0;
width: 100%;
}
- #dropdown .action span:not(.counter) {
+ .dropdown .action span:not(.counter) {
display: inline-block;
padding: .4em;
}
- #dropdown .counter {
+ .dropdown .counter {
left: 2.25em;
}
#file-selection {
diff --git a/frontend/src/store/getters.js b/frontend/src/store/getters.js
index 61ff7ab3..b2e971f1 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.shared.loaded && 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 e454c511..6670c7f8 100644
--- a/frontend/src/store/index.js
+++ b/frontend/src/store/index.js
@@ -26,6 +26,9 @@ const state = {
showConfirm: null,
previewMode: false,
shared: {
+ req: {},
+ hash: '',
+ loaded: false,
selected: [],
multiple: false
}
diff --git a/frontend/src/store/mutations.js b/frontend/src/store/mutations.js
index 302e2bf0..65e8714f 100644
--- a/frontend/src/store/mutations.js
+++ b/frontend/src/store/mutations.js
@@ -27,8 +27,12 @@ const mutations = {
state.show = 'success'
state.showMessage = value
},
- setLoading: (state, value) => { state.loading = value },
- setReload: (state, value) => { state.reload = value },
+ setLoading: (state, value) => {
+ state.loading = value
+ },
+ setReload: (state, value) => {
+ state.reload = value
+ },
setUser: (state, value) => {
if (value === null) {
state.user = null
@@ -96,7 +100,10 @@ const mutations = {
resetSharedSelected: (state) => {
state.shared.selected = []
},
- sharedMultiple: (state, value) => (state.shared.multiple = value)
+ sharedMultiple: (state, value) => (state.shared.multiple = value),
+ updateSharedRequest: (state, value) => (state.shared.req = value),
+ setSharedHash: (state, value) => (state.shared.hash = value),
+ toggleSharedLoaded: (state, value) => (state.shared.loaded = value)
}
export default mutations
diff --git a/frontend/src/views/Share.vue b/frontend/src/views/Share.vue
index 8e5f8b22..7084d874 100644
--- a/frontend/src/views/Share.vue
+++ b/frontend/src/views/Share.vue
@@ -1,7 +1,7 @@
-
+
-
+
home
@@ -13,13 +13,13 @@
{{ icon }}
- {{ $t('prompts.displayName') }} {{ file.name }}
+ {{ $t('prompts.displayName') }} {{ shared.req.name }}
{{ $t('prompts.lastModified') }}: {{ humanTime }}
@@ -33,19 +33,13 @@
-
-
-
-
-