Skip to content

Commit

Permalink
Rebase on master, remove obsolete loadPreviews action
Browse files Browse the repository at this point in the history
  • Loading branch information
pascalwengerter committed Jun 10, 2021
1 parent 1779cad commit fa3cc36
Show file tree
Hide file tree
Showing 4 changed files with 62 additions and 99 deletions.
10 changes: 1 addition & 9 deletions packages/web-app-files/src/components/AppBar.vue
Original file line number Diff line number Diff line change
Expand Up @@ -273,7 +273,6 @@ export default {
...mapActions('Files', [
'updateFileProgress',
'removeFilesFromTrashbin',
'loadPreviews',
'loadIndicators'
]),
...mapActions(['openFile', 'showMessage', 'createModal', 'setModalInputErrorMessage']),
Expand Down Expand Up @@ -510,14 +509,7 @@ export default {
})
}
this.loadPreviews({
resources: [resource],
isPublic: this.publicPage(),
mediaSource: this.mediaSource,
encodePath: this.encodePath
})
const user = await this.$client.users.getUser(this.user.id)
const user = await this.$client.users.getUser(this.user.id)
this.SET_QUOTA(user.quota)
} catch (error) {
Expand Down
79 changes: 0 additions & 79 deletions packages/web-app-files/src/store/actions.js
Original file line number Diff line number Diff line change
Expand Up @@ -585,84 +585,5 @@ export default {
resource.preview = preview
commit('UPDATE_RESOURCE', resource)
}
},

async loadPreviews({ commit, rootGetters }, { resources, isPublic, mediaSource, encodePath }) {
let dimensions

switch (true) {
case window.innerWidth <= 1024:
dimensions = 1024
break
case window.innerWidth <= 1280:
dimensions = 1280
break
case window.innerWidth <= 1920:
dimensions = 1920
break
case window.innerWidth <= 2160:
dimensions = 2160
break
default:
dimensions = 3840
}

const davUrl = rootGetters.configuration.server + 'remote.php/dav/files/' + rootGetters.user.id

const query = {
x: dimensions,
y: dimensions,
scalingup: 0,
preview: 1,
a: 1
}

for (const resource of resources) {
if (
resource.type === 'folder' ||
!resource.extension ||
(rootGetters.previewFileExtensions.length &&
!rootGetters.previewFileExtensions.includes(resource.extension))
) {
continue
}

const etag = (resource.etag || '').replaceAll('"', '')
if (etag) {
query.c = etag
}

if (isPublic) {
try {
// In a public context, i.e. public shares, the downloadURL contains a pre-signed url to
// download the file.
const [url, signedQuery] = resource.downloadURL.split('?')

// Since the pre-signed url contains query parameters and the caller of this method
// can also provide query parameters we have to combine them.
const combinedQuery = [queryString.stringify(query), signedQuery]
.filter(Boolean)
.join('&')

const previewUrl = [url, combinedQuery].filter(Boolean).join('?')
const exists = await fetch(previewUrl, { method: 'HEAD' })

if (exists.status === 404) {
continue
}

resource.preview = previewUrl
commit('UPDATE_RESOURCE', resource)

continue
} catch (ignored) {}
}

const previewUrl = davUrl + encodePath(resource.path) + '?' + queryString.stringify(query)
try {
resource.preview = await mediaSource(previewUrl, 'url')
commit('UPDATE_RESOURCE', resource)
} catch (ignored) {}
}
}
}
2 changes: 1 addition & 1 deletion packages/web-app-files/src/views/Personal.vue
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ export default {
watch: {
$route: {
handler: function() {
handler: function(to, from) {
if (isNil(this.$route.params.item)) {
this.$router.push({
name: 'files-personal',
Expand Down
70 changes: 60 additions & 10 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -898,6 +898,13 @@
core-js-pure "^3.0.0"
regenerator-runtime "^0.13.4"

"@babel/runtime@^7.10.2":
version "7.14.5"
resolved "https://registry.yarnpkg.com/@babel/runtime/-/runtime-7.14.5.tgz#665450911c6031af38f81db530f387ec04cd9a98"
integrity sha512-121rumjddw9c3NCQ55KGkyE1h/nzWhU/owjhw0l4mQrkzz4x9SGS1X8gFLraHwX7td3Yo4QTL+qj0NcIzN87BA==
dependencies:
regenerator-runtime "^0.13.4"

"@babel/runtime@^7.14.0", "@babel/runtime@^7.8.4":
version "7.14.0"
resolved "https://registry.yarnpkg.com/@babel/runtime/-/runtime-7.14.0.tgz#46794bc20b612c5f75e62dd071e24dfd95f1cbe6"
Expand Down Expand Up @@ -1226,6 +1233,14 @@
dependencies:
"@rollup/pluginutils" "^3.0.8"

"@rollup/plugin-typescript@^8.2.1":
version "8.2.1"
resolved "https://registry.yarnpkg.com/@rollup/plugin-typescript/-/plugin-typescript-8.2.1.tgz#f1a32d4030cc83432ce36a80a922280f0f0b5d44"
integrity sha512-Qd2E1pleDR4bwyFxqbjt4eJf+wB0UKVMLc7/BAFDGVdAXQMCsD4DUv5/7/ww47BZCYxWtJqe1Lo0KVNswBJlRw==
dependencies:
"@rollup/pluginutils" "^3.1.0"
resolve "^1.17.0"

"@rollup/pluginutils@^3.0.8", "@rollup/pluginutils@^3.1.0":
version "3.1.0"
resolved "https://registry.yarnpkg.com/@rollup/pluginutils/-/pluginutils-3.1.0.tgz#706b4524ee6dc8b103b3c995533e5ad680c02b9b"
Expand Down Expand Up @@ -1356,7 +1371,15 @@
dependencies:
"@types/istanbul-lib-report" "*"

"@types/jest@^26.0.23":
"@types/jest-axe@^3.5.1":
version "3.5.1"
resolved "https://registry.yarnpkg.com/@types/jest-axe/-/jest-axe-3.5.1.tgz#122c3864e361c8d699e60814a6a7f6851101d263"
integrity sha512-yelGgELc6iJEPShJ3/XEu6uUr5rCGi/Md0QzMuoo53y0WpR2lyFM3mjdpo8Q+PPd3onHOpIw6BBzEAIU65ZFSA==
dependencies:
"@types/jest" "*"
axe-core "^3.5.5"

"@types/jest@*", "@types/jest@^26.0.23":
version "26.0.23"
resolved "https://registry.yarnpkg.com/@types/jest/-/jest-26.0.23.tgz#a1b7eab3c503b80451d019efb588ec63522ee4e7"
integrity sha512-ZHLmWMJ9jJ9PTiT58juykZpL7KjwJywFN3Rr2pTSkyQfydf/rk22yS7W8p5DaVUMQ2BQC7oYiU3FjbTM/mYrOA==
Expand Down Expand Up @@ -2094,6 +2117,16 @@ aws4@^1.8.0:
resolved "https://registry.yarnpkg.com/aws4/-/aws4-1.11.0.tgz#d61f46d83b2519250e2784daf5b09479a8b41c59"
integrity sha512-xh1Rl34h6Fi1DC2WWKfxUTVqRsNnr6LsKz2+hfwDxQJWmrx8+c7ylaqBMcHfl1U1r2dsifOvKX3LQuLNZ+XSvA==

axe-core@^3.5.5:
version "3.5.5"
resolved "https://registry.yarnpkg.com/axe-core/-/axe-core-3.5.5.tgz#84315073b53fa3c0c51676c588d59da09a192227"
integrity sha512-5P0QZ6J5xGikH780pghEdbEKijCTrruK9KxtPZCFWUpef0f6GipO+xEZ5GKCb020mmqgbiNO6TcA55CriL784Q==

axe-core@^4.0.1, axe-core@^4.2.0:
version "4.2.2"
resolved "https://registry.yarnpkg.com/axe-core/-/axe-core-4.2.2.tgz#0c987d82c8b82b4b9b7a945f1b5ef0d8fed586ed"
integrity sha512-OKRkKM4ojMEZRJ5UNJHmq9tht7cEnRnqKG6KyB/trYws00Xtkv12mHtlJ0SK7cmuNbrU8dPUova3ELTuilfBbw==

axios@^0.21.1:
version "0.21.1"
resolved "https://registry.yarnpkg.com/axios/-/axios-0.21.1.tgz#22563481962f4d6bde9a76d516ef0e5d3c09b2b8"
Expand Down Expand Up @@ -2872,15 +2905,6 @@ cli-table3@^0.5.1:
optionalDependencies:
colors "^1.1.2"

clipboard@^2.0.0:
version "2.0.8"
resolved "https://registry.yarnpkg.com/clipboard/-/clipboard-2.0.8.tgz#ffc6c103dd2967a83005f3f61976aa4655a4cdba"
integrity sha512-Y6WO0unAIQp5bLmk1zdThRhgJt/x3ks6f30s3oE3H1mgIEU33XyQjEf8gsf6DxC7NPX8Y1SsNWjUjL/ywLnnbQ==
dependencies:
good-listener "^1.2.2"
select "^1.1.2"
tiny-emitter "^2.0.0"

cliui@^5.0.0:
version "5.0.0"
resolved "https://registry.yarnpkg.com/cliui/-/cliui-5.0.0.tgz#deefcfdb2e800784aa34f46fa08e06851c7bbbc5"
Expand Down Expand Up @@ -4292,6 +4316,15 @@ eslint-plugin-vue@^6.2.2:
semver "^5.6.0"
vue-eslint-parser "^7.0.0"

eslint-plugin-vuejs-accessibility@^0.6.1:
version "0.6.2"
resolved "https://registry.yarnpkg.com/eslint-plugin-vuejs-accessibility/-/eslint-plugin-vuejs-accessibility-0.6.2.tgz#cb2c389d58b944388097bb01f7a9093ef91eb0e3"
integrity sha512-AvWOba3NvxEqTBN/NcCYKeJkmJ+66tRLihuzQaad/ay2+cf8M+R+uibyHtbHP2kz+LVnvWp6ApBIqW37MexvKA==
dependencies:
aria-query "^4.2.2"
emoji-regex "^9.0.0"
vue-eslint-parser "^7.0.0"

eslint-scope@^5.0.0, eslint-scope@^5.1.1:
version "5.1.1"
resolved "https://registry.yarnpkg.com/eslint-scope/-/eslint-scope-5.1.1.tgz#e786e59a66cb92b3f6c1fb0d508aab174848f48c"
Expand Down Expand Up @@ -4800,6 +4833,18 @@ flow-remove-types@^2.135.0:
pirates "^3.0.2"
vlq "^0.2.1"

focus-trap-vue@^1.1.1:
version "1.1.1"
resolved "https://registry.yarnpkg.com/focus-trap-vue/-/focus-trap-vue-1.1.1.tgz#d29d2de3c64457cc708657682a6670af73982355"
integrity sha512-N+M4d4uYymCogct417gUL7wWSMIW/oUcCicfg3eRdo+gz7jlQnIGwUwViFxPkKV7iyzpc81g6JeSxRWiYWU3eQ==

focus-trap@^6.4.0:
version "6.5.0"
resolved "https://registry.yarnpkg.com/focus-trap/-/focus-trap-6.5.0.tgz#d99fdf5f3da07c08e7f5b9cad33746db2b215f97"
integrity sha512-mezVantxaWNMrcJcrdw/bDfW3rVkl0xcdHKiHbNZzJ2R+KfcW9S6j48wFUAu7C52GFeQDGEWgDEIAvk9PxFvZw==
dependencies:
tabbable "^5.2.0"

follow-redirects@^1.10.0:
version "1.14.1"
resolved "https://registry.yarnpkg.com/follow-redirects/-/follow-redirects-1.14.1.tgz#d9114ded0a1cfdd334e164e6662ad02bfd91ff43"
Expand Down Expand Up @@ -10219,6 +10264,11 @@ symbol-tree@^3.2.4:
resolved "https://registry.yarnpkg.com/symbol-tree/-/symbol-tree-3.2.4.tgz#430637d248ba77e078883951fb9aa0eed7c63fa2"
integrity sha512-9QNk5KwDF+Bvz+PyObkmSYjI5ksVUYtjW7AU22r2NKcfLJcXp96hkDWU3+XndOsUb+AQ9QhfzfCT2O+CNWT5Tw==

tabbable@^5.2.0:
version "5.2.0"
resolved "https://registry.yarnpkg.com/tabbable/-/tabbable-5.2.0.tgz#4fba60991d8bb89d06e5d9455c92b453acf88fb2"
integrity sha512-0uyt8wbP0P3T4rrsfYg/5Rg3cIJ8Shl1RJ54QMqYxm1TLdWqJD1u6+RQjr2Lor3wmfT7JRHkirIwy99ydBsyPg==

table@^6.0.9:
version "6.7.1"
resolved "https://registry.yarnpkg.com/table/-/table-6.7.1.tgz#ee05592b7143831a8c94f3cee6aae4c1ccef33e2"
Expand Down

0 comments on commit fa3cc36

Please sign in to comment.