From 58e2da193bdfde652bc63071540d53f8db11fd3a Mon Sep 17 00:00:00 2001 From: David Lima Date: Tue, 15 Jul 2025 20:28:52 -0300 Subject: [PATCH] feat(files-app-integration): create and register stub plugin Signed-off-by: David Lima --- .phpactor.json | 9 +++++++++ appinfo/info.xml | 8 ++++++++ lib/Dav/SignatureStatusPlugin.php | 21 +++++++++++++++++++++ src/actions/showStatusInlineAction.js | 4 ++-- src/init.js | 4 +++- src/tab.js | 2 +- 6 files changed, 44 insertions(+), 4 deletions(-) create mode 100644 .phpactor.json create mode 100644 lib/Dav/SignatureStatusPlugin.php diff --git a/.phpactor.json b/.phpactor.json new file mode 100644 index 000000000..b275a14b8 --- /dev/null +++ b/.phpactor.json @@ -0,0 +1,9 @@ +{ + "indexer.stub_paths": [ + "/home/david/Devel/librecode/nextcloud-dev/server" + ], + "phpunit.enabled": true, + "language_server_psalm.enabled": true, + "behat.enabled": true, + "language_server_php_cs_fixer.enabled": true +} diff --git a/appinfo/info.xml b/appinfo/info.xml index e882e04d8..c5e0d8d83 100644 --- a/appinfo/info.xml +++ b/appinfo/info.xml @@ -94,4 +94,12 @@ Developed with ❤️ by [LibreCode](https://librecode.coop). Help us transform libresign.page.index + + + OCA\Libresign\Dav\SignatureStatusPlugin + + + + + diff --git a/lib/Dav/SignatureStatusPlugin.php b/lib/Dav/SignatureStatusPlugin.php new file mode 100644 index 000000000..49e40ecb7 --- /dev/null +++ b/lib/Dav/SignatureStatusPlugin.php @@ -0,0 +1,21 @@ +server = $server; + $server->on('propFind', [$this, 'propFind']); + } + + public function propFind(PropFind $propFind, INode $node) { + $propFind->handle('{http://nextcloud.org/ns}node-name', $node->getName()); + } +} diff --git a/src/actions/showStatusInlineAction.js b/src/actions/showStatusInlineAction.js index afe13e9f7..0a7c937be 100644 --- a/src/actions/showStatusInlineAction.js +++ b/src/actions/showStatusInlineAction.js @@ -54,8 +54,8 @@ const action = new FileAction({ enabled: (nodes) => { return loadState('libresign', 'certificate_ok') && nodes.length > 0 && nodes - .map(node => node.mime) - .every(mime => mime === 'application/pdf') + .map(node => node.mime) + .every(mime => mime === 'application/pdf') }, order: -1, }) diff --git a/src/init.js b/src/init.js index 94851e5a9..ea344ff9c 100644 --- a/src/init.js +++ b/src/init.js @@ -6,7 +6,7 @@ import Vue from 'vue' import axios from '@nextcloud/axios' -import { addNewFileMenuEntry, Permission } from '@nextcloud/files' +import { addNewFileMenuEntry, Permission, registerDavProperty } from '@nextcloud/files' import { translate, translatePlural } from '@nextcloud/l10n' import { generateOcsUrl } from '@nextcloud/router' import { getUploader } from '@nextcloud/upload' @@ -21,6 +21,8 @@ Vue.prototype.n = translatePlural Vue.prototype.OC = OC Vue.prototype.OCA = OCA +registerDavProperty('nc:node-name', { nc: 'http://nextcloud.org/ns' }) + addNewFileMenuEntry({ id: 'libresign-request', displayName: t('libresign', 'New signature request'), diff --git a/src/tab.js b/src/tab.js index 37825f719..bbdd3d371 100644 --- a/src/tab.js +++ b/src/tab.js @@ -28,7 +28,7 @@ Vue.use(PiniaVuePlugin) const pinia = createPinia() -const isEnabled = function(fileInfo) { +const isEnabled = function (fileInfo) { if (fileInfo?.isDirectory() || !loadState('libresign', 'certificate_ok')) { return false }