mirror of
https://github.com/marty-oehme/scripts.git
synced 2024-12-22 07:58:08 +00:00
added more scripts
This commit is contained in:
parent
3c7e487d6c
commit
8248fe6bda
4 changed files with 124 additions and 0 deletions
52
encryption-keybase/encryption-keybase.qml
Normal file
52
encryption-keybase/encryption-keybase.qml
Normal file
|
@ -0,0 +1,52 @@
|
||||||
|
import QtQml 2.0
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This script will encrypt and decrypt notes with https://keybase.io
|
||||||
|
*
|
||||||
|
* You have to use your keybase user instead of "pbek"
|
||||||
|
*/
|
||||||
|
QtObject {
|
||||||
|
property string kaybasePath;
|
||||||
|
property string kaybaseUser;
|
||||||
|
|
||||||
|
// register your settings variables so the user can set them in the script settings
|
||||||
|
property variant settingsVariables: [
|
||||||
|
{
|
||||||
|
"identifier": "kaybasePath",
|
||||||
|
"name": "Keybase executable path",
|
||||||
|
"description": "Please select the path to your <code>keybase</code> executable:",
|
||||||
|
"type": "file",
|
||||||
|
"default": "/usr/bin/keybase",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"identifier": "kaybaseUser",
|
||||||
|
"name": "Keybase user",
|
||||||
|
"description": "Please enter your Keybase user name:",
|
||||||
|
"type": "string",
|
||||||
|
"default": "pbek",
|
||||||
|
},
|
||||||
|
];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This is called when the script is loaded by QOwnNotes
|
||||||
|
*/
|
||||||
|
function init() {
|
||||||
|
// disable the password dialog
|
||||||
|
script.encryptionDisablePassword();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This function is called when text has to be encrypted or decrypted
|
||||||
|
*
|
||||||
|
* @param text string the text to encrypt or descrypt
|
||||||
|
* @param password string the password
|
||||||
|
* @param decrypt bool if false encryption is demanded, if true decryption is demanded
|
||||||
|
* @return the exncrypted or decrypted text
|
||||||
|
*/
|
||||||
|
function encryptionHook(text, password, decrypt) {
|
||||||
|
// encrypt or decrypt text with keybase.io for user pbek
|
||||||
|
var param = decrypt ? ["decrypt"] : ["encrypt", kaybaseUser];
|
||||||
|
var result = script.startSynchronousProcess(kaybasePath, param, text);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
}
|
9
encryption-keybase/info.json
Normal file
9
encryption-keybase/info.json
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
{
|
||||||
|
"name": "Keybase Encryption",
|
||||||
|
"identifier": "encryption-keybase",
|
||||||
|
"script": "encryption-keybase.qml",
|
||||||
|
"authors": ["@pbek"],
|
||||||
|
"version": "0.0.1",
|
||||||
|
"minAppVersion": "17.05.7",
|
||||||
|
"description" : "This script will encrypt and decrypt notes with <a href='https://keybase.io/>Keybase</a>."
|
||||||
|
}
|
54
encryption-pgp/encryption-pgp.qml
Normal file
54
encryption-pgp/encryption-pgp.qml
Normal file
|
@ -0,0 +1,54 @@
|
||||||
|
import QtQml 2.0
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This script will encrypt and decrypt notes with PGP
|
||||||
|
*
|
||||||
|
* You have to use your own public key instead of "F5161BD3"
|
||||||
|
* Decryption will only work if you don't have to enter a password
|
||||||
|
*/
|
||||||
|
QtObject {
|
||||||
|
property string gpgPath;
|
||||||
|
property string publicKey;
|
||||||
|
|
||||||
|
// register your settings variables so the user can set them in the script settings
|
||||||
|
property variant settingsVariables: [
|
||||||
|
{
|
||||||
|
"identifier": "gpgPath",
|
||||||
|
"name": "GPG path",
|
||||||
|
"description": "Please select the path to your <code>gpg</code> executable:",
|
||||||
|
"type": "file",
|
||||||
|
"default": "/usr/bin/gpg",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"identifier": "publicKey",
|
||||||
|
"name": "Public PGP Key",
|
||||||
|
"description": "Please enter your public pgp key",
|
||||||
|
"type": "string",
|
||||||
|
"default": "F5161BD3",
|
||||||
|
},
|
||||||
|
];
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This is called when the script is loaded by QOwnNotes
|
||||||
|
*/
|
||||||
|
function init() {
|
||||||
|
// disable the password dialog
|
||||||
|
script.encryptionDisablePassword();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This function is called when text has to be encrypted or decrypted
|
||||||
|
*
|
||||||
|
* @param text string the text to encrypt or descrypt
|
||||||
|
* @param password string the password
|
||||||
|
* @param decrypt bool if false encryption is demanded, if true decryption is demanded
|
||||||
|
* @return the exncrypted or decrypted text
|
||||||
|
*/
|
||||||
|
function encryptionHook(text, password, decrypt) {
|
||||||
|
// encrypt the text for public key or decrypt with gpg
|
||||||
|
// decryption will only work if you don't have to enter a password
|
||||||
|
var param = decrypt ? ["--decrypt"] : ["--encrypt", "--armor", "-r", publicKey];
|
||||||
|
var result = script.startSynchronousProcess(gpgPath, param, text);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
}
|
9
encryption-pgp/info.json
Normal file
9
encryption-pgp/info.json
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
{
|
||||||
|
"name": "PGP Encryption",
|
||||||
|
"identifier": "encryption-pgp",
|
||||||
|
"script": "encryption-pgp.qml",
|
||||||
|
"authors": ["@pbek"],
|
||||||
|
"version": "0.0.1",
|
||||||
|
"minAppVersion": "17.05.7",
|
||||||
|
"description" : "This script will encrypt and decrypt notes with PGP.\n\nDecryption will only work if you don't have to enter a password."
|
||||||
|
}
|
Loading…
Reference in a new issue