From ba49d06d1afcbd007d048abfcfd2def1eb86d262 Mon Sep 17 00:00:00 2001
From: the-djmaze <>
Date: Fri, 14 Jan 2022 18:57:55 +0100
Subject: [PATCH] v2.11.0
---
.../files/usr/local/include/application.ini | 2 +-
README.md | 14 ++--
integrations/cloudron/DESCRIPTION.md | 2 +-
integrations/cloudron/Dockerfile | 2 +-
integrations/nextcloud/snappymail/VERSION | 2 +-
.../nextcloud/snappymail/appinfo/info.xml | 2 +-
integrations/virtualmin/snappymail.pl | 2 +-
package.json | 2 +-
plugins/change-password/drivers/pdo.php | 84 ++++++++++---------
.../app/libraries/MailSo/Mail/MailClient.php | 1 +
10 files changed, 60 insertions(+), 53 deletions(-)
diff --git a/.docker/release/files/usr/local/include/application.ini b/.docker/release/files/usr/local/include/application.ini
index 482e20b9f..058d5bd2a 100644
--- a/.docker/release/files/usr/local/include/application.ini
+++ b/.docker/release/files/usr/local/include/application.ini
@@ -289,5 +289,5 @@ dev_email = ""
dev_password = ""
[version]
-current = "2.10.3"
+current = "2.11.0"
saved = "Mon, 23 Aug 2021 07:55:13 +0000"
diff --git a/README.md b/README.md
index 37fedfc97..307bf62d2 100644
--- a/README.md
+++ b/README.md
@@ -139,22 +139,22 @@ RainLoop 1.15 vs SnappyMail
|js/* |RainLoop |Snappy |
|--------------- |--------: |--------: |
|admin.js |2.158.025 | 86.116 |
-|app.js |4.215.733 | 424.300 |
+|app.js |4.215.733 | 423.547 |
|boot.js | 672.433 | 2.779 |
|libs.js | 647.679 | 208.745 |
|polyfills.js | 325.908 | 0 |
|serviceworker.js | 0 | 285 |
-|TOTAL |8.019.778 | 722.225 |
+|TOTAL |8.019.778 | 721.472 |
|js/min/* |RainLoop |Snappy |RL gzip |SM gzip |RL brotli |SM brotli |
|--------------- |--------: |--------: |------: |------: |--------: |--------: |
|admin.min.js | 255.514 | 43.225 | 73.899 | 13.927 | 60.674 | 12.410 |
-|app.min.js | 516.000 | 214.755 |140.430 | 65.379 |110.657 | 55.690 |
+|app.min.js | 516.000 | 214.686 |140.430 | 65.385 |110.657 | 55.574 |
|boot.min.js | 66.456 | 1.654 | 22.553 | 996 | 20.043 | 814 |
|libs.min.js | 574.626 | 99.476 |177.280 | 36.501 |151.855 | 32.699 |
|polyfills.min.js | 32.608 | 0 | 11.315 | 0 | 10.072 | 0 |
-|TOTAL |1.445.204 | 359.110 |425.477 |116.803 |353.301 |101.613 |
-|TOTAL (no admin) |1.189.690 | 315.885 |351.061 |102.876 |292.627 | 89.203 |
+|TOTAL |1.445.204 | 359.041 |425.477 |116.809 |353.301 |101.497 |
+|TOTAL (no admin) |1.189.690 | 315.816 |351.061 |102.882 |292.627 | 89.087 |
For a user its around 70% smaller and faster than traditional RainLoop.
@@ -193,8 +193,8 @@ For a user its around 70% smaller and faster than traditional RainLoop.
|css/* |RainLoop |Snappy |RL gzip |SM gzip |SM brotli |
|------------ |-------: |------: |------: |------: |--------: |
-|app.css | 340.334 | 84.751 | 46.959 | 16.292 | 14.087 |
-|app.min.css | 274.791 | 68.572 | 39.618 | 14.414 | 12.786 |
+|app.css | 340.334 | 84.579 | 46.959 | 16.311 | 14.102 |
+|app.min.css | 274.791 | 68.200 | 39.618 | 14.359 | 12.744 |
|boot.css | | 1.326 | | 664 | 545 |
|boot.min.css | | 1.071 | | 590 | 474 |
|admin.css | | 30.558 | | 6.894 | 5.979 |
diff --git a/integrations/cloudron/DESCRIPTION.md b/integrations/cloudron/DESCRIPTION.md
index 91246aeea..e5a76ff21 100644
--- a/integrations/cloudron/DESCRIPTION.md
+++ b/integrations/cloudron/DESCRIPTION.md
@@ -1,4 +1,4 @@
-This app packages SnappyMail 2.10.3.
+This app packages SnappyMail 2.11.0.
SnappyMail is a simple, modern, lightweight & fast web-based email client.
diff --git a/integrations/cloudron/Dockerfile b/integrations/cloudron/Dockerfile
index d17ab0a18..077d439ad 100644
--- a/integrations/cloudron/Dockerfile
+++ b/integrations/cloudron/Dockerfile
@@ -4,7 +4,7 @@ RUN mkdir -p /app/code
WORKDIR /app/code
# If you change the extraction below, be sure to test on scaleway
-VERSION=2.10.3
+VERSION=2.11.0
RUN wget https://github.com/the-djmaze/snappymail/releases/download/v${VERSION}/snappymail-${VERSION}.zip -O /tmp/snappymail.zip && \
unzip /tmp/snappymail.zip -d /app/code && \
rm /tmp/snappymail.zip && \
diff --git a/integrations/nextcloud/snappymail/VERSION b/integrations/nextcloud/snappymail/VERSION
index fe1824995..ed0edc885 100755
--- a/integrations/nextcloud/snappymail/VERSION
+++ b/integrations/nextcloud/snappymail/VERSION
@@ -1 +1 @@
-2.10.3
\ No newline at end of file
+2.11.0
\ No newline at end of file
diff --git a/integrations/nextcloud/snappymail/appinfo/info.xml b/integrations/nextcloud/snappymail/appinfo/info.xml
index 793b83628..86b62558b 100644
--- a/integrations/nextcloud/snappymail/appinfo/info.xml
+++ b/integrations/nextcloud/snappymail/appinfo/info.xml
@@ -4,7 +4,7 @@
SnappyMail
SnappyMail Webmail
Simple, modern and fast web-based email client. After enabling in Nextcloud, go to Nextcloud admin panel, "Additionnal settings" and you will see a "SnappyMail webmail" section. There, click on the link to go to the SnappyMail admin panel. The default user/password is admin/12345. This version is based on SnappyMail 2.6.0 (2021-07).
- 2.10.3
+ 2.11.0
agpl
SnappyMail Team, Nextgen-Networks, Tab Fitts, Nathan Kinkade, Pierre-Alain Bandinelli
SnappyMail
diff --git a/integrations/virtualmin/snappymail.pl b/integrations/virtualmin/snappymail.pl
index 4d9e31733..390ce65f9 100644
--- a/integrations/virtualmin/snappymail.pl
+++ b/integrations/virtualmin/snappymail.pl
@@ -20,7 +20,7 @@ return "SnappyMail Webmail is a browser-based multilingual IMAP client with an a
# script_snappymail_versions()
sub script_snappymail_versions
{
-return ( "2.10.3" );
+return ( "2.11.0" );
}
sub script_snappymail_version_desc
diff --git a/package.json b/package.json
index 09143e3a4..8348060ad 100644
--- a/package.json
+++ b/package.json
@@ -3,7 +3,7 @@
"title": "SnappyMail",
"description": "Simple, modern & fast web-based email client",
"private": true,
- "version": "2.10.3",
+ "version": "2.11.0",
"homepage": "https://snappymail.eu",
"author": {
"name": "DJ Maze",
diff --git a/plugins/change-password/drivers/pdo.php b/plugins/change-password/drivers/pdo.php
index f4b6f07e7..1bc0b691d 100644
--- a/plugins/change-password/drivers/pdo.php
+++ b/plugins/change-password/drivers/pdo.php
@@ -6,13 +6,10 @@ class ChangePasswordDriverPDO
NAME = 'PDO',
DESCRIPTION = 'Use your own SQL (PDO) statement (with wildcards).';
- private
- $dsn = '',
- $user = '',
- $pass = '',
- $sql = '',
- $encrypt = '',
- $encrypt_prefix = ''; // Like: {ARGON2I} {BLF-CRYPT} {SHA512-CRYPT}
+ /**
+ * @var \RainLoop\Config\Plugin
+ */
+ private $oConfig = null;
/**
* @var \MailSo\Log\Logger
@@ -21,13 +18,8 @@ class ChangePasswordDriverPDO
function __construct(\RainLoop\Config\Plugin $oConfig, \MailSo\Log\Logger $oLogger)
{
+ $this->oConfig = $oConfig;
$this->oLogger = $oLogger;
- $this->dsn = $oConfig->Get('plugin', 'pdo_dsn', '');
- $this->user = $oConfig->Get('plugin', 'pdo_user', '');
- $this->pass = $oConfig->Get('plugin', 'pdo_password', '');
- $this->sql = $oConfig->Get('plugin', 'pdo_sql', '');
- $this->encrypt = $oConfig->Get('plugin', 'pdo_encrypt', '');
- $this->encrypt_prefix = $oConfig->Get('plugin', 'pdo_encryptprefix', '');
}
public static function isSupported() : bool
@@ -52,43 +44,57 @@ class ChangePasswordDriverPDO
->SetDefaultValue(array('none', 'bcrypt', 'Argon2i', 'Argon2id', 'SHA256-CRYPT', 'SHA512-CRYPT'))
->SetDescription('In what way do you want the passwords to be encrypted?'),
\RainLoop\Plugins\Property::NewInstance('pdo_encryptprefix')->SetLabel('Encrypt prefix')
- ->SetDescription('Optional encrypted password prefix, like: {BLF-CRYPT}'),
+ ->SetDescription('Optional encrypted password prefix, like {ARGON2I} or {BLF-CRYPT} or {SHA512-CRYPT}')
);
}
public function ChangePassword(\RainLoop\Model\Account $oAccount, string $sPrevPassword, string $sNewPassword) : bool
{
- $options = array(
- \PDO::ATTR_EMULATE_PREPARES => true,
- \PDO::ATTR_PERSISTENT => true,
- \PDO::ATTR_ERRMODE => \PDO::ERRMODE_EXCEPTION
- );
+ try
+ {
+ $conn = new \PDO(
+ $this->oConfig->Get('plugin', 'pdo_dsn', ''),
+ $this->oConfig->Get('plugin', 'pdo_user', ''),
+ $this->oConfig->Get('plugin', 'pdo_password', ''),
+ array(
+ \PDO::ATTR_EMULATE_PREPARES => true,
+ \PDO::ATTR_PERSISTENT => true,
+ \PDO::ATTR_ERRMODE => \PDO::ERRMODE_EXCEPTION
+ )
+ );
- $conn = new \PDO($this->dsn, $this->user, $this->pass, $options);
+ $sEmail = $oAccount->Email();
+ $encrypt = $this->oConfig->Get('plugin', 'pdo_encrypt', '');
+ $encrypt_prefix = $this->oConfig->Get('plugin', 'pdo_encryptprefix', '');
- //prepare SQL varaibles
- $sEmail = $oAccount->Email();
- $sEmailUser = \MailSo\Base\Utils::GetAccountNameFromEmail($sEmail);
- $sEmailDomain = \MailSo\Base\Utils::GetDomainFromEmail($sEmail);
+ $placeholders = array(
+ ':email' => $sEmail,
+ ':oldpass' => $encrypt_prefix . \ChangePasswordPlugin::encrypt($encrypt, $sPrevPassword),
+ ':newpass' => $encrypt_prefix . \ChangePasswordPlugin::encrypt($encrypt, $sNewPassword),
+ ':domain' => \MailSo\Base\Utils::GetDomainFromEmail($sEmail),
+ ':username' => \MailSo\Base\Utils::GetAccountNameFromEmail($sEmail)
+ );
- $placeholders = array(
- ':email' => $sEmail,
- ':oldpass' => $this->encrypt_prefix . \ChangePasswordPlugin::encrypt($this->encrypt, $sPrevPassword),
- ':newpass' => $this->encrypt_prefix . \ChangePasswordPlugin::encrypt($this->encrypt, $sNewPassword),
- ':domain' => $sEmailDomain,
- ':username' => $sEmailUser
- );
+ $sql = $this->oConfig->Get('plugin', 'pdo_sql', '');
- $statement = $conn->prepare($this->sql);
+ $statement = $conn->prepare($sql);
- // we have to check that all placehoders are used in the query, passing any unused placeholders will generate an error
- foreach ($placeholders as $placeholder => $value) {
- if (\preg_match_all("/{$placeholder}(?![a-zA-Z0-9\-])/", $this->sql)) {
- $statement->bindValue($placeholder, $value);
+ // we have to check that all placehoders are used in the query, passing any unused placeholders will generate an error
+ foreach ($placeholders as $placeholder => $value) {
+ if (\preg_match_all("/{$placeholder}(?![a-zA-Z0-9\-])/", $sql)) {
+ $statement->bindValue($placeholder, $value);
+ }
+ }
+
+ // and execute
+ return !!$statement->execute();
+ }
+ catch (\Exception $oException)
+ {
+ if ($this->oLogger) {
+ $this->oLogger->WriteException($oException);
}
}
-
- // and execute
- return !!$statement->execute();
+ return false;
}
}
diff --git a/snappymail/v/0.0.0/app/libraries/MailSo/Mail/MailClient.php b/snappymail/v/0.0.0/app/libraries/MailSo/Mail/MailClient.php
index 1dd08dcb6..cf92b029d 100644
--- a/snappymail/v/0.0.0/app/libraries/MailSo/Mail/MailClient.php
+++ b/snappymail/v/0.0.0/app/libraries/MailSo/Mail/MailClient.php
@@ -276,6 +276,7 @@ class MailClient
}
$aFetchResponse = $this->oImapClient->Fetch(array(
+// FetchType::BINARY_SIZE.'['.$sMimeIndex.']',
// Push in the aFetchCallbacks array and then called by \MailSo\Imap\Traits\ResponseParser::partialResponseLiteralCallbackCallable
array(
$sPeek.'['.$sMimeIndex.']',