Merge branch 'the-djmaze:master' into master

This commit is contained in:
cm-schl 2023-03-14 14:48:42 +01:00 committed by GitHub
commit 00a507ff97
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
246 changed files with 4471 additions and 9935 deletions

View file

@ -32,8 +32,6 @@
</svg>`;
};
let isMobile;
const
size = 50,
getEl = id => document.getElementById(id),
@ -63,11 +61,11 @@
.slice(0,2)
.toUpperCase(),
setIdenticon = (from, fn) => hash(from.email).then(hash =>
fn('data:image/svg+xml;base64,' + btoa(window.identiconSvg(
fn('data:image/svg+xml;base64,' + btoa(unescape(encodeURIComponent(window.identiconSvg(
hash,
fromChars(from),
window.getComputedStyle(getEl('rl-app'), null).getPropertyValue('font-family')
)))
)))))
),
addQueue = (msg, fn) => {
msg.from?.[0] && setIdenticon(msg.from[0], fn);
@ -171,11 +169,9 @@
fn = url=>{element.src = url};
if (url) {
fn(url);
} else if (msg.avatar || isMobile()) {
} else if (msg.avatar) {
if (msg.avatar?.startsWith('data:')) {
fn(msg.avatar);
} else if (isMobile()) {
setIdenticon(from, fn);
} else {
element.onerror = () => setIdenticon(from, fn);
fn(`?Avatar/${'pass' == from.dkimStatus ? 1 : 0}/${msg.avatar}`);
@ -231,7 +227,6 @@
}
if ('MailMessageList' === e.detail.viewModelTemplateID) {
isMobile = e.detail.isMobile;
getEl('MailMessageList').content.querySelectorAll('.messageCheckbox')
.forEach(el => el.append(Element.fromHTML(`<img class="fromPic" data-bind="fromPic:$data" loading="lazy">`)));
}

View file

@ -10,8 +10,8 @@ class AvatarsPlugin extends \RainLoop\Plugins\AbstractPlugin
NAME = 'Avatars',
AUTHOR = 'SnappyMail',
URL = 'https://snappymail.eu/',
VERSION = '1.9',
RELEASE = '2023-02-01',
VERSION = '1.11',
RELEASE = '2023-02-23',
REQUIRED = '2.25.0',
CATEGORY = 'Contacts',
LICENSE = 'MIT',

View file

@ -6,9 +6,9 @@ class LoginExternalPlugin extends \RainLoop\Plugins\AbstractPlugin
NAME = 'Login External',
AUTHOR = 'SnappyMail',
URL = 'https://snappymail.eu/',
VERSION = '1.1',
RELEASE = '2022-12-24',
REQUIRED = '2.21.0',
VERSION = '1.2',
RELEASE = '2023-03-14',
REQUIRED = '2.27.0',
CATEGORY = 'Login',
LICENSE = 'MIT',
DESCRIPTION = 'Login with $_POST["Email"] and $_POST["Password"] from anywhere';
@ -60,7 +60,7 @@ class LoginExternalPlugin extends \RainLoop\Plugins\AbstractPlugin
}
echo \json_encode($aResult);
} else {
$oActions->Location('./');
\MailSo\Base\Http::Location('./');
}
return true;
}

View file

@ -6,9 +6,9 @@ class LoginRemotePlugin extends \RainLoop\Plugins\AbstractPlugin
NAME = 'Login Remote',
AUTHOR = 'SnappyMail',
URL = 'https://snappymail.eu/',
VERSION = '1.2',
RELEASE = '2022-11-24',
REQUIRED = '2.21.0',
VERSION = '1.3',
RELEASE = '2023-03-14',
REQUIRED = '2.27.0',
CATEGORY = 'Login',
LICENSE = 'MIT',
DESCRIPTION = 'Tries to login using the $_ENV["REMOTE_*"] variables';
@ -55,7 +55,7 @@ class LoginRemotePlugin extends \RainLoop\Plugins\AbstractPlugin
}
}
$oActions->Location('./');
\MailSo\Base\Http::Location('./');
return true;
}

View file

@ -9,9 +9,9 @@ class MailboxDetectPlugin extends \RainLoop\Plugins\AbstractPlugin
NAME = 'MailboxDetect',
AUTHOR = 'SnappyMail',
URL = 'https://snappymail.eu/',
VERSION = '2.4',
RELEASE = '2023-02-08',
REQUIRED = '2.25.0',
VERSION = '2.6',
RELEASE = '2023-03-13',
REQUIRED = '2.27.0',
CATEGORY = 'General',
LICENSE = 'MIT',
DESCRIPTION = 'Autodetect system folders and/or create them when needed';
@ -48,8 +48,8 @@ class MailboxDetectPlugin extends \RainLoop\Plugins\AbstractPlugin
$roles = [
'inbox' => false,
'sent' => !!$oSettingsLocal->GetConf('SentFolder', ''),
'drafts' => !!$oSettingsLocal->GetConf('DraftFolder', ''),
'junk' => !!$oSettingsLocal->GetConf('SpamFolder', ''),
'drafts' => !!$oSettingsLocal->GetConf('DraftsFolder', ''),
'junk' => !!$oSettingsLocal->GetConf('JunkFolder', ''),
'trash' => !!$oSettingsLocal->GetConf('TrashFolder', ''),
'archive' => !!$oSettingsLocal->GetConf('ArchiveFolder', '')
];
@ -74,13 +74,13 @@ class MailboxDetectPlugin extends \RainLoop\Plugins\AbstractPlugin
$sDelimiter || ($sDelimiter = $folder['delimiter']);
if ($folder['role']) {
$roles[$folder['role']] = true;
} else if (\in_array('\\sentmail', $folder['flags'])) {
} else if (\in_array('\\sentmail', $folder['attributes'])) {
$found['sent'][] = $i;
} else if (\in_array('\\spam', $folder['flags'])) {
} else if (\in_array('\\spam', $folder['attributes'])) {
$found['junk'][] = $i;
} else if (\in_array('\\bin', $folder['flags'])) {
} else if (\in_array('\\bin', $folder['attributes'])) {
$found['trash'][] = $i;
} else if (\in_array('\\starred', $folder['flags'])) {
} else if (\in_array('\\starred', $folder['attributes'])) {
$found['flagged'][] = $i;
} else {
// Kolab

View file

@ -4,8 +4,8 @@ class NextcloudPlugin extends \RainLoop\Plugins\AbstractPlugin
{
const
NAME = 'Nextcloud',
VERSION = '2.17',
RELEASE = '2023-01-31',
VERSION = '2.20',
RELEASE = '2023-02-22',
CATEGORY = 'Integrations',
DESCRIPTION = 'Integrate with Nextcloud v20+',
REQUIRED = '2.25.1';
@ -33,6 +33,17 @@ class NextcloudPlugin extends \RainLoop\Plugins\AbstractPlugin
$this->addTemplate('templates/PopupsNextcloudFiles.html');
$this->addTemplate('templates/PopupsNextcloudCalendars.html');
} else {
// \OC::$server->getConfig()->getAppValue('snappymail', 'snappymail-no-embed');
$this->addHook('main.content-security-policy', 'ContentSecurityPolicy');
}
}
public function ContentSecurityPolicy(\SnappyMail\HTTP\CSP $CSP)
{
if (\method_exists($CSP, 'add')) {
$CSP->add('frame-ancestors', "'self'");
}
}
@ -187,6 +198,31 @@ class NextcloudPlugin extends \RainLoop\Plugins\AbstractPlugin
$sEmail = $sCustomEmail;
}
$aResult['DevEmail'] = $sEmail ?: '';
} else if (!empty($aResult['ContactsSync'])) {
$bSave = false;
if (empty($aResult['ContactsSync']['Url'])) {
$aResult['ContactsSync']['Url'] = "{$sWebDAV}/addressbooks/users/{$sUID}/contacts/";
$bSave = true;
}
if (empty($aResult['ContactsSync']['User'])) {
$aResult['ContactsSync']['User'] = $sUID;
$bSave = true;
}
if (empty($aResult['ContactsSync']['Password'])) {
$aResult['ContactsSync']['Password'] = '';
}
if ($bSave) {
$oActions = \RainLoop\Api::Actions();
$oActions->setContactsSyncData(
$oActions->getAccountFromToken(),
array(
'Mode' => $aResult['ContactsSync']['Mode'],
'User' => $aResult['ContactsSync']['User'],
'Password' => $aResult['ContactsSync']['Password'],
'Url' => $aResult['ContactsSync']['Url']
)
);
}
}
}
}

View file

@ -6,6 +6,7 @@
let view = e.detail;
view.nextcloudAttach = () => {
rl.nextcloud.selectFiles().then(files => {
let urls = [];
files && files.forEach(file => {
if (file.name) {
let attachment = view.addAttachmentHelper(
@ -29,10 +30,14 @@
}
);
} else if (file.url) {
// TODO: other editors and text/plain
view.oEditor.editor.squire.makeLink(file.url);
urls.push(file.url);
}
});
if (urls.length) {
// TODO: other editors and text/plain
// https://github.com/the-djmaze/snappymail/issues/981
view.oEditor.editor.squire.insertHTML(urls.join("<br>"));
}
});
};
}

View file

@ -6,9 +6,9 @@ class RecaptchaPlugin extends \RainLoop\Plugins\AbstractPlugin
NAME = 'reCaptcha',
AUTHOR = 'SnappyMail',
URL = 'https://snappymail.eu/',
VERSION = '2.14',
RELEASE = '2023-01-11',
REQUIRED = '2.23',
VERSION = '2.15',
RELEASE = '2023-02-22',
REQUIRED = '2.26.4',
CATEGORY = 'General',
LICENSE = 'MIT',
DESCRIPTION = 'A CAPTCHA (v2) is a program that can generate and grade tests that humans can pass but current computer programs cannot. For example, humans can read distorted text as the one shown below, but current computer programs can\'t. More info at https://developers.google.com/recaptcha';
@ -141,12 +141,9 @@ class RecaptchaPlugin extends \RainLoop\Plugins\AbstractPlugin
public function ContentSecurityPolicy(\SnappyMail\HTTP\CSP $CSP)
{
// $CSP->script[] = 'https://www.google.com/recaptcha/';
$CSP->script[] = 'https://www.gstatic.com/recaptcha/';
$CSP->script[] = 'https://www.recaptcha.net/recaptcha/';
// $CSP->frame[] = 'https://www.google.com/recaptcha/';
// $CSP->frame[] = 'https://recaptcha.google.com/recaptcha/';
$CSP->frame[] = 'https://www.recaptcha.net/recaptcha/';
$CSP->add('script-src', 'https://www.gstatic.com/recaptcha/');
$CSP->add('script-src', 'https://www.recaptcha.net/recaptcha/');
$CSP->add('frame-src', 'https://www.recaptcha.net/recaptcha/');
}
}