From fb75aae55f9d89d3d4548e739eb9bdcf8796e70b Mon Sep 17 00:00:00 2001 From: Louis Chemineau Date: Mon, 13 Nov 2023 16:00:36 +0100 Subject: [PATCH] Add overlay on live photo And hide the .mov file Signed-off-by: Louis Chemineau --- lib/Sabre/PropFindPlugin.php | 15 ++++++---- src/components/File.vue | 7 +++-- src/services/DavRequest.js | 2 ++ src/services/collectionFetcher.js | 2 ++ src/services/fileFetcher.js | 2 ++ src/store/files.js | 48 ++++++++++++++++--------------- 6 files changed, 46 insertions(+), 30 deletions(-) diff --git a/lib/Sabre/PropFindPlugin.php b/lib/Sabre/PropFindPlugin.php index c2627ea3c..9490f8eb0 100644 --- a/lib/Sabre/PropFindPlugin.php +++ b/lib/Sabre/PropFindPlugin.php @@ -32,7 +32,7 @@ use OCA\Photos\Sabre\Place\PlaceRoot; use OCP\Files\DavUtil; use OCP\Files\NotFoundException; -use OCP\IConfig; +use OCP\FilesMetadata\IFilesMetadataManager; use OCP\IPreview; use Sabre\DAV\INode; use Sabre\DAV\PropFind; @@ -52,17 +52,15 @@ class PropFindPlugin extends ServerPlugin { public const COLLABORATORS_PROPERTYNAME = '{http://nextcloud.org/ns}collaborators'; public const PERMISSIONS_PROPERTYNAME = '{http://owncloud.org/ns}permissions'; - private IConfig $config; private IPreview $previewManager; private ?Tree $tree; private AlbumMapper $albumMapper; public function __construct( - IConfig $config, IPreview $previewManager, - AlbumMapper $albumMapper + AlbumMapper $albumMapper, + private IFilesMetadataManager $filesMetadataManager, ) { - $this->config = $config; $this->previewManager = $previewManager; $this->albumMapper = $albumMapper; } @@ -119,6 +117,13 @@ public function propFind(PropFind $propFind, INode $node): void { foreach ($node->getFileInfo()->getMetadata() as $metadataKey => $metadataValue) { $propFind->handle(FilesPlugin::FILE_METADATA_PREFIX.$metadataKey, $metadataValue); } + + + $propFind->handle(FilesPlugin::HIDDEN_PROPERTYNAME, function () use ($node) { + $metadata = $this->filesMetadataManager->getMetadata((int)$node->getFileInfo()->getFileId(), true); + return $metadata->hasKey('files-live-photo') && $node->getFileInfo()->getMimetype() === 'video/quicktime' ? 'true' : 'false'; + }); + } if ($node instanceof AlbumRoot) { diff --git a/src/components/File.vue b/src/components/File.vue index 79e39d885..64f56be3d 100644 --- a/src/components/File.vue +++ b/src/components/File.vue @@ -31,7 +31,8 @@
- + + @@ -84,6 +85,7 @@