diff --git a/packages/web-app-preview/src/components/Sources/MediaImage.vue b/packages/web-app-preview/src/components/Sources/MediaImage.vue
index 6ad88fce73f..706ab7cf356 100644
--- a/packages/web-app-preview/src/components/Sources/MediaImage.vue
+++ b/packages/web-app-preview/src/components/Sources/MediaImage.vue
@@ -1,15 +1,18 @@
+
diff --git a/packages/web-pkg/package.json b/packages/web-pkg/package.json
index 834fd47d5f5..2b8d560579d 100644
--- a/packages/web-pkg/package.json
+++ b/packages/web-pkg/package.json
@@ -14,7 +14,8 @@
"directory": "packages/web-pkg"
},
"devDependencies": {
- "web-test-helpers": "workspace:*"
+ "web-test-helpers": "workspace:*",
+ "zod": "^3.22.4"
},
"peerDependencies": {
"@ownclouders/web-client": "workspace:*",
diff --git a/packages/web-pkg/src/services/preview/previewService.ts b/packages/web-pkg/src/services/preview/previewService.ts
index 804b3208ebb..039e8979e87 100644
--- a/packages/web-pkg/src/services/preview/previewService.ts
+++ b/packages/web-pkg/src/services/preview/previewService.ts
@@ -112,6 +112,7 @@ export class PreviewService {
scalingup: options.scalingup || 0,
preview: Object.hasOwnProperty.call(options, 'preview') ? options.preview : 1,
a: Object.hasOwnProperty.call(options, 'a') ? options.a : 1,
+ ...(options.processor && { processor: options.processor }),
...(options.etag && { c: options.etag.replaceAll('"', '') }),
...(options.dimensions && options.dimensions[0] && { x: options.dimensions[0] }),
...(options.dimensions && options.dimensions[1] && { y: options.dimensions[1] })
@@ -119,7 +120,7 @@ export class PreviewService {
}
private async privatePreviewBlob(options: LoadPreviewOptions, cached = false): Promise
{
- const { resource, dimensions } = options
+ const { resource, dimensions, processor } = options
if (cached) {
return this.cacheFactory(options)
}
@@ -129,7 +130,7 @@ export class PreviewService {
'remote.php/dav',
encodePath(resource.webDavPath),
'?',
- this.buildQueryString({ etag: resource.etag, dimensions })
+ this.buildQueryString({ etag: resource.etag, dimensions, processor })
].join('')
try {
const { data } = await this.clientService.httpAuthenticated.get(url, {
@@ -140,14 +141,17 @@ export class PreviewService {
}
private async publicPreviewUrl(options: LoadPreviewOptions): Promise {
- const { resource, dimensions } = options
+ const { resource, dimensions, processor } = options
// 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 = [this.buildQueryString({ etag: resource.etag, dimensions }), signedQuery]
+ const combinedQuery = [
+ this.buildQueryString({ etag: resource.etag, dimensions, processor }),
+ signedQuery
+ ]
.filter(Boolean)
.join('&')
diff --git a/packages/web-pkg/src/services/preview/types.ts b/packages/web-pkg/src/services/preview/types.ts
index 6090a45c06b..25ddce0a6ba 100644
--- a/packages/web-pkg/src/services/preview/types.ts
+++ b/packages/web-pkg/src/services/preview/types.ts
@@ -1,4 +1,9 @@
import { Resource, SpaceResource } from '@ownclouders/web-client'
+import { z } from 'zod'
+
+export const ProcessorType = z.enum(['fit', 'resize', 'fill', 'thumbnail'])
+
+export type ProcessorType = z.infer
export interface BuildQueryStringOptions {
preview?: number
@@ -6,12 +11,14 @@ export interface BuildQueryStringOptions {
a?: number
etag?: string
dimensions?: [number, number]
+ processor?: ProcessorType
}
export interface LoadPreviewOptions {
space: SpaceResource
resource: Resource
dimensions?: [number, number]
+ processor?: ProcessorType
}
export interface PreviewCapability {
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
index 26ebe92cc56..14e82c6971f 100644
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -1,9 +1,5 @@
lockfileVersion: '6.0'
-settings:
- autoInstallPeers: true
- excludeLinksFromLockfile: false
-
overrides:
'@uppy/companion-client': https://github.com/owncloud/uppy/releases/download/v3.12.13-owncloud/uppy-companion-client.tgz
'@uppy/core': https://github.com/owncloud/uppy/releases/download/v3.12.13-owncloud/uppy-core.tgz
@@ -853,6 +849,9 @@ importers:
specifier: 4.1.0
version: 4.1.0(vue@3.3.4)
devDependencies:
+ '@panzoom/panzoom':
+ specifier: ^4.5.1
+ version: 4.5.1
web-test-helpers:
specifier: workspace:*
version: link:../web-test-helpers
@@ -1059,6 +1058,9 @@ importers:
web-test-helpers:
specifier: workspace:*
version: link:../web-test-helpers
+ zod:
+ specifier: ^3.22.4
+ version: 3.22.4
packages/web-runtime:
dependencies:
@@ -6163,6 +6165,10 @@ packages:
rimraf: 3.0.2
dev: true
+ /@panzoom/panzoom@4.5.1:
+ resolution: {integrity: sha512-QOr/t7314XTwgAUDazR+RDcTAWSbkpjDnZJddd9f56jSUA8ptUsyDblAb+sp/O5O1o5Fiu9KpWxVHKuhGUgp5w==}
+ dev: true
+
/@playwright/test@1.33.0:
resolution: {integrity: sha512-YunBa2mE7Hq4CfPkGzQRK916a4tuZoVx/EpLjeWlTVOnD4S2+fdaQZE0LJkbfhN5FTSKNLdcl7MoT5XB37bTkg==}
engines: {node: '>=14'}
@@ -22391,6 +22397,10 @@ packages:
readable-stream: 3.6.0
dev: true
+ /zod@3.22.4:
+ resolution: {integrity: sha512-iC+8Io04lddc+mVqQ9AZ7OQ2MrUKGN+oIQyq1vemgt46jwCwLfhq7/pwnBnNXXXZb8VTVLKwp9EDkx+ryxIWmg==}
+ dev: true
+
/zwitch@1.0.5:
resolution: {integrity: sha512-V50KMwwzqJV0NpZIZFwfOD5/lyny3WlSzRiXgA0G7VUnRlqttta1L6UQIHzd6EuBY/cHGfwTIck7w1yH6Q5zUw==}
dev: true
@@ -22599,3 +22609,7 @@ packages:
lodash: 4.17.21
vue: 3.3.4
dev: true
+
+settings:
+ autoInstallPeers: true
+ excludeLinksFromLockfile: false
diff --git a/tests/e2e/support/objects/app-files/resource/actions.ts b/tests/e2e/support/objects/app-files/resource/actions.ts
index 186b871426e..f7edd5131d0 100644
--- a/tests/e2e/support/objects/app-files/resource/actions.ts
+++ b/tests/e2e/support/objects/app-files/resource/actions.ts
@@ -65,7 +65,7 @@ const globalSearchOptions = '#files-global-search-options'
const loadingSpinner = '#files-global-search-options .loading'
const filesViewOptionButton = '#files-view-options-btn'
const hiddenFilesToggleButton = '//*[@data-testid="files-switch-hidden-files"]//button'
-const previewImage = '//main[@id="preview"]//div[contains(@class,"preview-player")]//img'
+const previewImage = '//main[@id="preview"]//div[contains(@class,"stage_media")]//img'
const drawioSaveButton = '.geBigButton >> text=Save'
const drawioIframe = '#drawio-editor'
const externalEditorIframe = '[name="app-iframe"]'