File tree Expand file tree Collapse file tree 3 files changed +20
-1
lines changed
Expand file tree Collapse file tree 3 files changed +20
-1
lines changed Original file line number Diff line number Diff line change 5252<script lang="ts">
5353import type { Node } from ' @nextcloud/files'
5454import type { PropType } from ' vue'
55- import type { UserConfig } from ' ../../types.ts'
55+ import type { UserConfig , PreviewMetadata } from ' ../../types.ts'
5656
5757import { FileType } from ' @nextcloud/files'
5858import { translate as t } from ' @nextcloud/l10n'
@@ -164,6 +164,14 @@ export default defineComponent({
164164 return url .href
165165 }
166166
167+ if (this .source .attributes [' preview-metadata' ]) {
168+ let metadata: PreviewMetadata [] = JSON .parse (this .source .attributes [' preview-metadata' ])
169+ metadata = metadata .filter ((preview ) => preview .height <= 256 && this .cropPreviews === preview .cropped && preview .preview_url )
170+ if (metadata .length > 0 ) {
171+ return metadata [0 ]?.preview_url ;
172+ }
173+ }
174+
167175 try {
168176 const previewUrl = this .source .attributes .previewUrl
169177 || (this .isPublic
Original file line number Diff line number Diff line change @@ -75,5 +75,8 @@ registerPreviewServiceWorker()
7575registerDavProperty ( 'nc:hidden' , { nc : 'http://nextcloud.org/ns' } )
7676registerDavProperty ( 'nc:is-mount-root' , { nc : 'http://nextcloud.org/ns' } )
7777registerDavProperty ( 'nc:metadata-blurhash' , { nc : 'http://nextcloud.org/ns' } )
78+ registerDavProperty ( 'nc:preview-metadata' , { nc : 'http://nextcloud.org/ns' } )
79+ registerDavProperty ( 'nc:download-url-expiration' , { nc : 'http://nextcloud.org/ns' } )
80+ registerDavProperty ( 'oc:downloadURL' , { oc : 'http://owncloud.org/ns' } )
7881
7982initLivePhotos ( )
Original file line number Diff line number Diff line change @@ -147,3 +147,11 @@ export type Capabilities = {
147147 versioning : boolean
148148 }
149149}
150+
151+ export type PreviewMetadata = {
152+ width : int ,
153+ height : int ,
154+ cropped : boolean ,
155+ preview_url : string | null ,
156+ preview_url_expiration : int | null ,
157+ }
You can’t perform that action at this time.
0 commit comments