mirror of
https://github.com/LibreSign/libresign.git
synced 2025-12-18 05:20:45 +01:00
Make compatible with Nextcloud 28
Signed-off-by: Vitor Mattos <vitor@php.rio>
This commit is contained in:
parent
e5614df17f
commit
4579eeca94
6 changed files with 63 additions and 48 deletions
32
package-lock.json
generated
32
package-lock.json
generated
|
|
@ -15,6 +15,7 @@
|
|||
"@nextcloud/axios": "^2.4.0",
|
||||
"@nextcloud/dialogs": "^4.2.1",
|
||||
"@nextcloud/event-bus": "^3.1.0",
|
||||
"@nextcloud/files": "^3.0.0-beta.22",
|
||||
"@nextcloud/initial-state": "^2.1.0",
|
||||
"@nextcloud/l10n": "^2.2.0",
|
||||
"@nextcloud/logger": "^2.7.0",
|
||||
|
|
@ -8970,8 +8971,6 @@
|
|||
"version": "4.0.1",
|
||||
"resolved": "https://registry.npmjs.org/clone-deep/-/clone-deep-4.0.1.tgz",
|
||||
"integrity": "sha512-neHB9xuzh/wk0dIHweyAXv2aPGZIVk3pLMe+/RNzINf17fe0OG96QroktYAUm7SM1PBnzTabaLboqqxDyMU+SQ==",
|
||||
"dev": true,
|
||||
"peer": true,
|
||||
"dependencies": {
|
||||
"is-plain-object": "^2.0.4",
|
||||
"kind-of": "^6.0.2",
|
||||
|
|
@ -8985,8 +8984,6 @@
|
|||
"version": "2.0.4",
|
||||
"resolved": "https://registry.npmjs.org/is-plain-object/-/is-plain-object-2.0.4.tgz",
|
||||
"integrity": "sha512-h5PpgXkWitc38BBMYawTYMWJHFZJVnBquFE57xFpjB8pJFiF6gZ+bU+WyI/yqXiFR5mdLsgYNaPe8uao6Uv9Og==",
|
||||
"dev": true,
|
||||
"peer": true,
|
||||
"dependencies": {
|
||||
"isobject": "^3.0.1"
|
||||
},
|
||||
|
|
@ -8998,8 +8995,6 @@
|
|||
"version": "6.0.3",
|
||||
"resolved": "https://registry.npmjs.org/kind-of/-/kind-of-6.0.3.tgz",
|
||||
"integrity": "sha512-dcS1ul+9tmeD95T+x28/ehLgd9mENa3LsvDTtzm3vyBEO7RPptvAD+t44WVXaUjTBRcrpFeFlC8WCruUR456hw==",
|
||||
"dev": true,
|
||||
"peer": true,
|
||||
"engines": {
|
||||
"node": ">=0.10.0"
|
||||
}
|
||||
|
|
@ -12547,19 +12542,6 @@
|
|||
"resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz",
|
||||
"integrity": "sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw=="
|
||||
},
|
||||
"node_modules/fsevents": {
|
||||
"version": "2.3.3",
|
||||
"resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.3.tgz",
|
||||
"integrity": "sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==",
|
||||
"hasInstallScript": true,
|
||||
"optional": true,
|
||||
"os": [
|
||||
"darwin"
|
||||
],
|
||||
"engines": {
|
||||
"node": "^8.16.0 || ^10.6.0 || >=11.0.0"
|
||||
}
|
||||
},
|
||||
"node_modules/function-bind": {
|
||||
"version": "1.1.1",
|
||||
"resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz",
|
||||
|
|
@ -14125,8 +14107,6 @@
|
|||
"version": "3.0.1",
|
||||
"resolved": "https://registry.npmjs.org/isobject/-/isobject-3.0.1.tgz",
|
||||
"integrity": "sha512-WhB9zCku7EGTj/HQQRz5aUQEUeoQZH2bWcltRErOpymJ4boYE6wL9Tbr23krRPSZ+C5zqNSrSw+Cc7sZZ4b7vg==",
|
||||
"dev": true,
|
||||
"peer": true,
|
||||
"engines": {
|
||||
"node": ">=0.10.0"
|
||||
}
|
||||
|
|
@ -21948,8 +21928,6 @@
|
|||
"version": "3.0.1",
|
||||
"resolved": "https://registry.npmjs.org/shallow-clone/-/shallow-clone-3.0.1.tgz",
|
||||
"integrity": "sha512-/6KqX+GVUdqPuPPd2LxDDxzX6CAbjJehAAOKlNpqqUpAqPM6HeL8f+o3a+JsyGjn2lv0WY8UsTgUJjU9Ok55NA==",
|
||||
"dev": true,
|
||||
"peer": true,
|
||||
"dependencies": {
|
||||
"kind-of": "^6.0.2"
|
||||
},
|
||||
|
|
@ -21961,8 +21939,6 @@
|
|||
"version": "6.0.3",
|
||||
"resolved": "https://registry.npmjs.org/kind-of/-/kind-of-6.0.3.tgz",
|
||||
"integrity": "sha512-dcS1ul+9tmeD95T+x28/ehLgd9mENa3LsvDTtzm3vyBEO7RPptvAD+t44WVXaUjTBRcrpFeFlC8WCruUR456hw==",
|
||||
"dev": true,
|
||||
"peer": true,
|
||||
"engines": {
|
||||
"node": ">=0.10.0"
|
||||
}
|
||||
|
|
@ -25055,8 +25031,6 @@
|
|||
"version": "5.9.0",
|
||||
"resolved": "https://registry.npmjs.org/webpack-merge/-/webpack-merge-5.9.0.tgz",
|
||||
"integrity": "sha512-6NbRQw4+Sy50vYNTw7EyOn41OZItPiXB8GNv3INSoe3PSFaHJEz3SHTrYVaRm2LilNGnFUzh0FAwqPEmU/CwDg==",
|
||||
"dev": true,
|
||||
"peer": true,
|
||||
"dependencies": {
|
||||
"clone-deep": "^4.0.1",
|
||||
"wildcard": "^2.0.0"
|
||||
|
|
@ -25229,9 +25203,7 @@
|
|||
"node_modules/wildcard": {
|
||||
"version": "2.0.1",
|
||||
"resolved": "https://registry.npmjs.org/wildcard/-/wildcard-2.0.1.tgz",
|
||||
"integrity": "sha512-CC1bOL87PIWSBhDcTrdeLo6eGT7mCFtrg0uIJtqJUFyK+eJnzl8A1niH56uu7KMa5XFrtiV+AQuHO3n7DsHnLQ==",
|
||||
"dev": true,
|
||||
"peer": true
|
||||
"integrity": "sha512-CC1bOL87PIWSBhDcTrdeLo6eGT7mCFtrg0uIJtqJUFyK+eJnzl8A1niH56uu7KMa5XFrtiV+AQuHO3n7DsHnLQ=="
|
||||
},
|
||||
"node_modules/wrap-ansi": {
|
||||
"version": "7.0.0",
|
||||
|
|
|
|||
|
|
@ -23,6 +23,7 @@
|
|||
"@nextcloud/axios": "^2.4.0",
|
||||
"@nextcloud/dialogs": "^4.2.1",
|
||||
"@nextcloud/event-bus": "^3.1.0",
|
||||
"@nextcloud/files": "^3.0.0-beta.22",
|
||||
"@nextcloud/initial-state": "^2.1.0",
|
||||
"@nextcloud/l10n": "^2.2.0",
|
||||
"@nextcloud/logger": "^2.7.0",
|
||||
|
|
|
|||
|
|
@ -88,7 +88,7 @@ export default {
|
|||
},
|
||||
isSigned() {
|
||||
return get(this.currentFile, 'status') === 1
|
||||
}
|
||||
},
|
||||
},
|
||||
methods: {
|
||||
hasStatus(item) {
|
||||
|
|
|
|||
54
src/actions/openInLibreSignAction.js
Normal file
54
src/actions/openInLibreSignAction.js
Normal file
|
|
@ -0,0 +1,54 @@
|
|||
/*
|
||||
* @copyright Copyright (c) 2023 Vitor Mattos <vitor@php.rio>
|
||||
*
|
||||
* @author Vitor Mattos <vitor@php.rio>
|
||||
*
|
||||
* @license GNU AGPL version 3 or any later version
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as
|
||||
* published by the Free Software Foundation, either version 3 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
import { registerFileAction, FileAction } from '@nextcloud/files'
|
||||
import { translate as t } from '@nextcloud/l10n'
|
||||
import { loadState } from '@nextcloud/initial-state'
|
||||
// eslint-disable-next-line import/no-unresolved
|
||||
import SvgIcon from '../../img/app-dark.svg?raw'
|
||||
import logger from '../logger.js'
|
||||
|
||||
export const action = new FileAction({
|
||||
id: 'open-in-libresign',
|
||||
displayName: () => t('libresign', 'Open in LibreSign'),
|
||||
iconSvgInline: () => SvgIcon,
|
||||
|
||||
enabled(nodes) {
|
||||
return loadState('libresign', 'certificate_ok')
|
||||
&& nodes.length > 0 && nodes
|
||||
.map(node => node.mime)
|
||||
.every(mime => mime === 'application/pdf')
|
||||
},
|
||||
|
||||
async exec(node) {
|
||||
try {
|
||||
await window.OCA.Files.Sidebar.open(node.path)
|
||||
OCA.Files.Sidebar.setActiveTab('libresign')
|
||||
return null
|
||||
} catch (error) {
|
||||
logger.error('Error while opening sidebar', { error })
|
||||
return false
|
||||
}
|
||||
},
|
||||
|
||||
order: 100,
|
||||
})
|
||||
|
||||
registerFileAction(action)
|
||||
18
src/tab.js
18
src/tab.js
|
|
@ -26,6 +26,7 @@ import Vuex from 'vuex'
|
|||
import { loadState } from '@nextcloud/initial-state'
|
||||
import { translate as t, translatePlural as n } from '@nextcloud/l10n'
|
||||
import LibresignTab from './views/FilesTab/LibresignTab.vue'
|
||||
import './actions/openInLibreSignAction.js'
|
||||
|
||||
import './style/icons.scss'
|
||||
|
||||
|
|
@ -58,23 +59,6 @@ const View = Vue.extend(LibresignTab)
|
|||
let TabInstance = null
|
||||
|
||||
window.addEventListener('DOMContentLoaded', () => {
|
||||
/**
|
||||
* Adds an entry to the menu in file options.
|
||||
*/
|
||||
if (OCA.Files && OCA.Files.fileActions && loadState('libresign', 'certificate_ok')) {
|
||||
OCA.Files.fileActions.registerAction({
|
||||
name: 'libresign',
|
||||
displayName: t('libresign', 'Open in LibreSign'),
|
||||
mime: 'application/pdf',
|
||||
permissions: OC.PERMISSION_READ,
|
||||
iconClass: 'icon-libresign',
|
||||
actionHandler(fileName, context) {
|
||||
OCA.Files.Sidebar.setActiveTab('libresign')
|
||||
OCA.Files.Sidebar.open(context.dir + '/' + fileName)
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
/**
|
||||
* Register a new tab in the sidebar
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -23,6 +23,10 @@ const config = {
|
|||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
resourceQuery: /raw/,
|
||||
type: 'asset/source',
|
||||
},
|
||||
],
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue