feat(files-app-integration): create and register stub plugin

Signed-off-by: David Lima <antdavidlima@gmail.com>
This commit is contained in:
David Lima 2025-07-15 20:28:52 -03:00 committed by Vitor Mattos
parent 46a253bc6c
commit 58e2da193b
No known key found for this signature in database
GPG key ID: 6FECE2AD4809003A
6 changed files with 44 additions and 4 deletions

9
.phpactor.json Normal file
View file

@ -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
}

View file

@ -94,4 +94,12 @@ Developed with ❤️ by [LibreCode](https://librecode.coop). Help us transform
<route>libresign.page.index</route>
</navigation>
</navigations>
<sabre>
<plugins>
<plugin>OCA\Libresign\Dav\SignatureStatusPlugin</plugin>
</plugins>
</sabre>
<types>
<dav/>
</types>
</info>

View file

@ -0,0 +1,21 @@
<?php
namespace OCA\Libresign\Dav;
use Sabre\DAV\INode;
use Sabre\DAV\PropFind;
use Sabre\DAV\Server;
use Sabre\DAV\ServerPlugin;
class SignatureStatusPlugin extends ServerPlugin {
protected $server;
public function initialize(Server $server) {
$this->server = $server;
$server->on('propFind', [$this, 'propFind']);
}
public function propFind(PropFind $propFind, INode $node) {
$propFind->handle('{http://nextcloud.org/ns}node-name', $node->getName());
}
}

View file

@ -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,
})

View file

@ -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'),

View file

@ -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
}