Many more changes for #89

This commit is contained in:
the-djmaze 2022-01-20 16:38:27 +01:00
parent 3cc3a76b23
commit a7eeeb4f55
18 changed files with 310 additions and 236 deletions

View file

@ -21,8 +21,9 @@ import { AbstractModel } from 'Knoin/AbstractModel';
import PreviewHTML from 'Html/PreviewMessage.html';
const
/*eslint-disable max-len*/
// eslint-disable-next-line max-len
url = /(^|[\s\n]|\/?>)(https:\/\/[-A-Z0-9+\u0026\u2019#/%?=()~_|!:,.;]*[-A-Z0-9+\u0026#/%=~()_|])/gi,
// eslint-disable-next-line max-len
email = /(^|[\s\n]|\/?>)((?:[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*|"(?:[\x21\x23-\x5b\x5d-\x7f]|\\[\x21\x23-\x5b\x5d-\x7f])*")@(?:(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?|\[(?:(?:(2(5[0-5]|[0-4][0-9])|1[0-9][0-9]|[1-9]?[0-9]))\.){3}(?:(2(5[0-5]|[0-4][0-9])|1[0-9][0-9]|[1-9]?[0-9])|[a-z0-9-]*[a-z0-9]:(?:[\x21-\x5a\x53-\x7f]|\\[\x21\x23-\x5b\x5d-\x7f])+)\]))/gi,
// Removes background and color
@ -644,30 +645,4 @@ export class MessageModel extends AbstractModel {
].join(',');
}
pgpDecrypt() {
// const message = self.message();
// message && pgpClickHelper(message.body, message.plain(), message.getEmails(['from', 'to', 'cc']));
/*
pgpEncrypted: () => PgpUserStore.isSupported()
&& MessageUserStore.message() && MessageUserStore.message().isPgpEncrypted(),
*/
}
pgpVerify() {
let params = this.pgpSigned(); // { BodyPartId: "1", SigPartId: "2", MicAlg: "pgp-sha256" }
if (params) {
params.Folder = this.folder;
params.Uid = this.uid;
rl.app.Remote.post('MessagePgpVerify', null, params)
.then(data => {
// TODO
console.dir(data);
})
.catch(error => {
// TODO
console.dir(error);
});
}
}
}

View file

@ -5,20 +5,17 @@ import { AbstractModel } from 'Knoin/AbstractModel';
export class OpenPgpKeyModel extends AbstractModel {
/**
* @param {string} index
* @param {string} guID
* @param {string} ID
* @param {array} IDs
* @param {array} userIDs
* @param {array} emails
* @param {boolean} isPrivate
* @param {string} armor
* @param {string} userID
*/
constructor(index, guID, ID, IDs, userIDs, emails, isPrivate, armor, userID) {
constructor(guID, ID, IDs, userIDs, emails, armor, userID) {
super();
this.index = index;
this.id = ID;
this.ids = arrayLength(IDs) ? IDs : [ID];
this.guid = guID;
@ -27,7 +24,6 @@ export class OpenPgpKeyModel extends AbstractModel {
this.email = '';
this.emails = emails;
this.armor = armor;
this.isPrivate = !!isPrivate;
if (this.users) {
const index = this.users.indexOf(userID);