aboutsummaryrefslogtreecommitdiffstats
path: root/apps/files_trashbin
diff options
context:
space:
mode:
authorJohn Molakvoæ <skjnldsv@protonmail.com>2023-02-05 11:22:50 +0100
committerJohn Molakvoæ <skjnldsv@protonmail.com>2023-04-06 14:49:30 +0200
commit2ff1c00f556633c9c36a9328d4eb77eba2dd25e7 (patch)
tree06759b005be00891a5709f43de3ec97a0b7e83eb /apps/files_trashbin
parent638b3dffa3de2c948b966e0575b9af85a3ed54d0 (diff)
downloadnextcloud-server-2ff1c00f556633c9c36a9328d4eb77eba2dd25e7.tar.gz
nextcloud-server-2ff1c00f556633c9c36a9328d4eb77eba2dd25e7.zip
fix(files_trashbin): previews crop support
Signed-off-by: John Molakvoæ <skjnldsv@protonmail.com>
Diffstat (limited to 'apps/files_trashbin')
-rw-r--r--apps/files_trashbin/lib/Controller/PreviewController.php7
-rw-r--r--apps/files_trashbin/src/services/trashbin.ts5
2 files changed, 8 insertions, 4 deletions
diff --git a/apps/files_trashbin/lib/Controller/PreviewController.php b/apps/files_trashbin/lib/Controller/PreviewController.php
index 22ca56d8f36..652570dccd7 100644
--- a/apps/files_trashbin/lib/Controller/PreviewController.php
+++ b/apps/files_trashbin/lib/Controller/PreviewController.php
@@ -89,8 +89,9 @@ class PreviewController extends Controller {
*/
public function getPreview(
int $fileId = -1,
- int $x = 128,
- int $y = 128
+ int $x = 32,
+ int $y = 32,
+ bool $a = false,
) {
if ($fileId === -1 || $x === 0 || $y === 0) {
return new DataResponse([], Http::STATUS_BAD_REQUEST);
@@ -118,7 +119,7 @@ class PreviewController extends Controller {
$mimeType = $this->mimeTypeDetector->detectPath($file->getName());
}
- $f = $this->previewManager->getPreview($file, $x, $y, true, IPreview::MODE_FILL, $mimeType);
+ $f = $this->previewManager->getPreview($file, $x, $y, $a, IPreview::MODE_FILL, $mimeType);
$response = new Http\FileDisplayResponse($f, Http::STATUS_OK, ['Content-Type' => $f->getMimeType()]);
// Cache previews for 24H
diff --git a/apps/files_trashbin/src/services/trashbin.ts b/apps/files_trashbin/src/services/trashbin.ts
index 2070cfc92b0..2be4c39dbfc 100644
--- a/apps/files_trashbin/src/services/trashbin.ts
+++ b/apps/files_trashbin/src/services/trashbin.ts
@@ -22,7 +22,7 @@
/* eslint-disable */
import { getCurrentUser } from '@nextcloud/auth'
import { File, Folder, parseWebdavPermissions } from '@nextcloud/files'
-import { generateRemoteUrl } from '@nextcloud/router'
+import { generateRemoteUrl, generateUrl } from '@nextcloud/router'
import type { FileStat, ResponseDataDetailed } from 'webdav'
import type { ContentsWithRoot } from '../../../files/src/services/Navigation'
@@ -49,9 +49,11 @@ const data = `<?xml version="1.0"?>
</d:prop>
</d:propfind>`
+
const resultToNode = function(node: FileStat): File | Folder {
const permissions = parseWebdavPermissions(node.props?.permissions)
const owner = getCurrentUser()?.uid as string
+ const previewUrl = generateUrl('/apps/files_trashbin/preview?fileId={fileid}', node.props)
const nodeData = {
id: node.props?.fileid as number || 0,
@@ -67,6 +69,7 @@ const resultToNode = function(node: FileStat): File | Folder {
...node.props,
// Override displayed name on the list
displayName: node.props?.['trashbin-filename'],
+ previewUrl,
},
}