Skip to content

Commit

Permalink
Unify preview urls with the files app
Browse files Browse the repository at this point in the history
This has two advantages:

* Increase the probability of browser cache hits
* With the imaginary pipeline PR, requesting a preview of 250x250 is faster
  since there is less intermediate steps

Signed-off-by: Carl Schwan <carl@carlschwan.eu>
  • Loading branch information
CarlSchwan committed Feb 28, 2022
1 parent 7c8b1bf commit d2a0a7f
Show file tree
Hide file tree
Showing 16 changed files with 436 additions and 20 deletions.
4 changes: 2 additions & 2 deletions js/photos-main.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion js/photos-main.js.map

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

415 changes: 415 additions & 0 deletions js/photos-src_components_FolderTagPreview_vue.js

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions js/photos-src_components_FolderTagPreview_vue.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions js/photos-src_patchedRequest_js-src_views_Tags_vue.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion js/photos-src_patchedRequest_js-src_views_Tags_vue.js.map

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions js/photos-src_views_Albums_vue.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion js/photos-src_views_Albums_vue.js.map

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/components/File.vue
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ export default {
return this.item.injected.mime.startsWith('image')
},
src() {
return generateUrl(`/core/preview?fileId=${this.item.injected.fileid}&x=${256}&y=${256}&a=${!this.croppedLayout}&v=${this.item.injected.etag}`)
return generateUrl(`/core/preview?fileId=${this.item.injected.fileid}&c=${this.item.injected.etag.replace('&quot;', '').replace('&quot;', '')}&x=${250}&y=${250}&forceIcon=0&a=${this.croppedLayout ? '0' : '1'}`)
},
},

Expand Down
2 changes: 1 addition & 1 deletion src/components/FolderTagPreview.vue
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ export default {
methods: {
generateImgSrc({ fileid, etag }) {
// use etag to force cache reload if file changed
return generateUrl(`/core/preview?fileId=${fileid}&x=${256}&y=${256}&a=true&v=${etag}`)
return generateUrl(`/core/preview?fileId=${fileid}&c=${etag}&x=${250}&y=${250}&forceIcon=0&a=0`)
},
onPreviewFail({ fileid }) {
this.failed.push(fileid)
Expand Down

0 comments on commit d2a0a7f

Please sign in to comment.