mirror of
https://github.com/LibreSign/libresign.git
synced 2025-12-17 21:12:16 +01:00
feat(files-app-integration): create and register stub plugin
Signed-off-by: David Lima <antdavidlima@gmail.com>
This commit is contained in:
parent
46a253bc6c
commit
58e2da193b
6 changed files with 44 additions and 4 deletions
9
.phpactor.json
Normal file
9
.phpactor.json
Normal 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
|
||||
}
|
||||
|
|
@ -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>
|
||||
|
|
|
|||
21
lib/Dav/SignatureStatusPlugin.php
Normal file
21
lib/Dav/SignatureStatusPlugin.php
Normal 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());
|
||||
}
|
||||
}
|
||||
|
|
@ -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,
|
||||
})
|
||||
|
|
|
|||
|
|
@ -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'),
|
||||
|
|
|
|||
|
|
@ -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
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue