aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLouis Chemineau <louis@chmn.me>2023-11-08 14:52:50 +0100
committerLouis Chemineau <louis@chmn.me>2023-11-09 22:39:52 +0100
commit1c84139fa6d2803d7b555dbedfda8bba8067a5ed (patch)
treecd856ad1fe482dfe56ecf7a2dfe6b680d3eeff1b
parent397c96967a39b18354ce87a0c81964d3abc7cdc1 (diff)
downloadnextcloud-server-1c84139fa6d2803d7b555dbedfda8bba8067a5ed.tar.gz
nextcloud-server-1c84139fa6d2803d7b555dbedfda8bba8067a5ed.zip
Hide .mov for live photos
Signed-off-by: Louis Chemineau <louis@chmn.me>
-rw-r--r--apps/dav/lib/Connector/Sabre/FilesPlugin.php7
-rw-r--r--apps/files/src/init.ts8
-rw-r--r--apps/files/src/services/LivePhotos.ts (renamed from dist/settings-vue-settings-personal-security.js.LICENSE.txt)27
-rw-r--r--apps/files/src/views/FilesList.vue5
4 files changed, 32 insertions, 15 deletions
diff --git a/apps/dav/lib/Connector/Sabre/FilesPlugin.php b/apps/dav/lib/Connector/Sabre/FilesPlugin.php
index cd188872019..c52805c9548 100644
--- a/apps/dav/lib/Connector/Sabre/FilesPlugin.php
+++ b/apps/dav/lib/Connector/Sabre/FilesPlugin.php
@@ -87,6 +87,7 @@ class FilesPlugin extends ServerPlugin {
public const SUBFOLDER_COUNT_PROPERTYNAME = '{http://nextcloud.org/ns}contained-folder-count';
public const SUBFILE_COUNT_PROPERTYNAME = '{http://nextcloud.org/ns}contained-file-count';
public const FILE_METADATA_PREFIX = '{http://nextcloud.org/ns}metadata-';
+ public const HIDDEN_PROPERTYNAME = '{http://nextcloud.org/ns}hidden';
/** Reference to main server object */
private ?Server $server = null;
@@ -386,6 +387,12 @@ class FilesPlugin extends ServerPlugin {
$propFind->handle(self::FILE_METADATA_PREFIX . $metadataKey, $metadataValue);
}
+ $propFind->handle(self::HIDDEN_PROPERTYNAME, function () use ($node) {
+ $filesMetadataManager = \OCP\Server::get(IFilesMetadataManager::class);
+ $metadata = $filesMetadataManager->getMetadata((int)$node->getFileId(), true);
+ return $metadata->hasKey('files-live-photo') && $node->getFileInfo()->getMimetype() === 'video/quicktime' ? 'true' : 'false';
+ });
+
/**
* Return file/folder name as displayname. The primary reason to
* implement it this way is to avoid costly fallback to
diff --git a/apps/files/src/init.ts b/apps/files/src/init.ts
index 430b17ae7ae..aa855ed69b2 100644
--- a/apps/files/src/init.ts
+++ b/apps/files/src/init.ts
@@ -20,7 +20,7 @@
*
*/
import MenuIcon from '@mdi/svg/svg/sun-compass.svg?raw'
-import { FileAction, addNewFileMenuEntry, registerFileAction } from '@nextcloud/files'
+import { FileAction, addNewFileMenuEntry, registerDavProperty, registerFileAction } from '@nextcloud/files'
import { action as deleteAction } from './actions/deleteAction'
import { action as downloadAction } from './actions/downloadAction'
@@ -41,6 +41,8 @@ import registerPreviewServiceWorker from './services/ServiceWorker.js'
import './init-templates'
+import { initLivePhotos } from './services/LivePhotos'
+
// Register file actions
registerFileAction(deleteAction)
registerFileAction(downloadAction)
@@ -63,3 +65,7 @@ registerRecentView()
// Register preview service worker
registerPreviewServiceWorker()
+
+registerDavProperty('nc:hidden', { nc: 'http://nextcloud.org/ns' })
+
+initLivePhotos()
diff --git a/dist/settings-vue-settings-personal-security.js.LICENSE.txt b/apps/files/src/services/LivePhotos.ts
index 40f5cb7b187..df6c9decd4a 100644
--- a/dist/settings-vue-settings-personal-security.js.LICENSE.txt
+++ b/apps/files/src/services/LivePhotos.ts
@@ -1,18 +1,7 @@
-/*!
- * vue-qrcode v1.0.2
- * https://fengyuanchen.github.io/vue-qrcode
- *
- * Copyright 2018-present Chen Fengyuan
- * Released under the MIT license
- *
- * Date: 2020-01-18T06:04:33.222Z
- */
-
/**
- * @copyright 2019 Christoph Wurst <christoph@winzerhof-wurst.at>
+ * @copyright Copyright (c) 2023 Louis Chmn <louis@chmn.me>
*
- * @author Christoph Wurst <christoph@winzerhof-wurst.at>
- * @author John Molakvoæ <skjnldsv@protonmail.com>
+ * @author Louis Chmn <louis@chmn.me>
*
* @license AGPL-3.0-or-later
*
@@ -30,3 +19,15 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
+import { Node, registerDavProperty } from '@nextcloud/files'
+
+export function initLivePhotos(): void {
+ registerDavProperty('nc:metadata-files-live-photo', { nc: 'http://nextcloud.org/ns' })
+}
+
+/**
+ * @param {Node} node - The node
+ */
+export function isLivePhoto(node: Node): boolean {
+ return node.attributes['metadata-files-live-photo'] !== null
+}
diff --git a/apps/files/src/views/FilesList.vue b/apps/files/src/views/FilesList.vue
index 89ce6aeb7b0..3bc4f27c2a2 100644
--- a/apps/files/src/views/FilesList.vue
+++ b/apps/files/src/views/FilesList.vue
@@ -256,7 +256,10 @@ export default Vue.extend({
},
dirContents(): Node[] {
- return (this.currentFolder?._children || []).map(this.getNode).filter(file => file)
+ return (this.currentFolder?._children || [])
+ .map(this.getNode)
+ .filter(file => file)
+ .filter(file => file?.attributes?.hidden !== true)
},
/**