This commit is contained in:
the-djmaze 2022-01-14 18:57:55 +01:00
parent 630dc1e854
commit ba49d06d1a
10 changed files with 60 additions and 53 deletions

View file

@ -289,5 +289,5 @@ dev_email = ""
dev_password = "" dev_password = ""
[version] [version]
current = "2.10.3" current = "2.11.0"
saved = "Mon, 23 Aug 2021 07:55:13 +0000" saved = "Mon, 23 Aug 2021 07:55:13 +0000"

View file

@ -139,22 +139,22 @@ RainLoop 1.15 vs SnappyMail
|js/* |RainLoop |Snappy | |js/* |RainLoop |Snappy |
|--------------- |--------: |--------: | |--------------- |--------: |--------: |
|admin.js |2.158.025 | 86.116 | |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 | |boot.js | 672.433 | 2.779 |
|libs.js | 647.679 | 208.745 | |libs.js | 647.679 | 208.745 |
|polyfills.js | 325.908 | 0 | |polyfills.js | 325.908 | 0 |
|serviceworker.js | 0 | 285 | |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 | |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 | |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 | |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 | |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 | |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 |1.445.204 | 359.041 |425.477 |116.809 |353.301 |101.497 |
|TOTAL (no admin) |1.189.690 | 315.885 |351.061 |102.876 |292.627 | 89.203 | |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. 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 | |css/* |RainLoop |Snappy |RL gzip |SM gzip |SM brotli |
|------------ |-------: |------: |------: |------: |--------: | |------------ |-------: |------: |------: |------: |--------: |
|app.css | 340.334 | 84.751 | 46.959 | 16.292 | 14.087 | |app.css | 340.334 | 84.579 | 46.959 | 16.311 | 14.102 |
|app.min.css | 274.791 | 68.572 | 39.618 | 14.414 | 12.786 | |app.min.css | 274.791 | 68.200 | 39.618 | 14.359 | 12.744 |
|boot.css | | 1.326 | | 664 | 545 | |boot.css | | 1.326 | | 664 | 545 |
|boot.min.css | | 1.071 | | 590 | 474 | |boot.min.css | | 1.071 | | 590 | 474 |
|admin.css | | 30.558 | | 6.894 | 5.979 | |admin.css | | 30.558 | | 6.894 | 5.979 |

View file

@ -1,4 +1,4 @@
This app packages SnappyMail <upstream>2.10.3</upstream>. This app packages SnappyMail <upstream>2.11.0</upstream>.
SnappyMail is a simple, modern, lightweight & fast web-based email client. SnappyMail is a simple, modern, lightweight & fast web-based email client.

View file

@ -4,7 +4,7 @@ RUN mkdir -p /app/code
WORKDIR /app/code WORKDIR /app/code
# If you change the extraction below, be sure to test on scaleway # 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 && \ 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 && \ unzip /tmp/snappymail.zip -d /app/code && \
rm /tmp/snappymail.zip && \ rm /tmp/snappymail.zip && \

View file

@ -1 +1 @@
2.10.3 2.11.0

View file

@ -4,7 +4,7 @@
<name>SnappyMail</name> <name>SnappyMail</name>
<summary>SnappyMail Webmail</summary> <summary>SnappyMail Webmail</summary>
<description>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).</description> <description>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).</description>
<version>2.10.3</version> <version>2.11.0</version>
<licence>agpl</licence> <licence>agpl</licence>
<author>SnappyMail Team, Nextgen-Networks, Tab Fitts, Nathan Kinkade, Pierre-Alain Bandinelli</author> <author>SnappyMail Team, Nextgen-Networks, Tab Fitts, Nathan Kinkade, Pierre-Alain Bandinelli</author>
<namespace>SnappyMail</namespace> <namespace>SnappyMail</namespace>

View file

@ -20,7 +20,7 @@ return "SnappyMail Webmail is a browser-based multilingual IMAP client with an a
# script_snappymail_versions() # script_snappymail_versions()
sub script_snappymail_versions sub script_snappymail_versions
{ {
return ( "2.10.3" ); return ( "2.11.0" );
} }
sub script_snappymail_version_desc sub script_snappymail_version_desc

View file

@ -3,7 +3,7 @@
"title": "SnappyMail", "title": "SnappyMail",
"description": "Simple, modern & fast web-based email client", "description": "Simple, modern & fast web-based email client",
"private": true, "private": true,
"version": "2.10.3", "version": "2.11.0",
"homepage": "https://snappymail.eu", "homepage": "https://snappymail.eu",
"author": { "author": {
"name": "DJ Maze", "name": "DJ Maze",

View file

@ -6,13 +6,10 @@ class ChangePasswordDriverPDO
NAME = 'PDO', NAME = 'PDO',
DESCRIPTION = 'Use your own SQL (PDO) statement (with wildcards).'; DESCRIPTION = 'Use your own SQL (PDO) statement (with wildcards).';
private /**
$dsn = '', * @var \RainLoop\Config\Plugin
$user = '', */
$pass = '', private $oConfig = null;
$sql = '',
$encrypt = '',
$encrypt_prefix = ''; // Like: {ARGON2I} {BLF-CRYPT} {SHA512-CRYPT}
/** /**
* @var \MailSo\Log\Logger * @var \MailSo\Log\Logger
@ -21,13 +18,8 @@ class ChangePasswordDriverPDO
function __construct(\RainLoop\Config\Plugin $oConfig, \MailSo\Log\Logger $oLogger) function __construct(\RainLoop\Config\Plugin $oConfig, \MailSo\Log\Logger $oLogger)
{ {
$this->oConfig = $oConfig;
$this->oLogger = $oLogger; $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 public static function isSupported() : bool
@ -52,38 +44,44 @@ class ChangePasswordDriverPDO
->SetDefaultValue(array('none', 'bcrypt', 'Argon2i', 'Argon2id', 'SHA256-CRYPT', 'SHA512-CRYPT')) ->SetDefaultValue(array('none', 'bcrypt', 'Argon2i', 'Argon2id', 'SHA256-CRYPT', 'SHA512-CRYPT'))
->SetDescription('In what way do you want the passwords to be encrypted?'), ->SetDescription('In what way do you want the passwords to be encrypted?'),
\RainLoop\Plugins\Property::NewInstance('pdo_encryptprefix')->SetLabel('Encrypt prefix') \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 public function ChangePassword(\RainLoop\Model\Account $oAccount, string $sPrevPassword, string $sNewPassword) : bool
{ {
$options = array( 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_EMULATE_PREPARES => true,
\PDO::ATTR_PERSISTENT => true, \PDO::ATTR_PERSISTENT => true,
\PDO::ATTR_ERRMODE => \PDO::ERRMODE_EXCEPTION \PDO::ATTR_ERRMODE => \PDO::ERRMODE_EXCEPTION
)
); );
$conn = new \PDO($this->dsn, $this->user, $this->pass, $options);
//prepare SQL varaibles
$sEmail = $oAccount->Email(); $sEmail = $oAccount->Email();
$sEmailUser = \MailSo\Base\Utils::GetAccountNameFromEmail($sEmail); $encrypt = $this->oConfig->Get('plugin', 'pdo_encrypt', '');
$sEmailDomain = \MailSo\Base\Utils::GetDomainFromEmail($sEmail); $encrypt_prefix = $this->oConfig->Get('plugin', 'pdo_encryptprefix', '');
$placeholders = array( $placeholders = array(
':email' => $sEmail, ':email' => $sEmail,
':oldpass' => $this->encrypt_prefix . \ChangePasswordPlugin::encrypt($this->encrypt, $sPrevPassword), ':oldpass' => $encrypt_prefix . \ChangePasswordPlugin::encrypt($encrypt, $sPrevPassword),
':newpass' => $this->encrypt_prefix . \ChangePasswordPlugin::encrypt($this->encrypt, $sNewPassword), ':newpass' => $encrypt_prefix . \ChangePasswordPlugin::encrypt($encrypt, $sNewPassword),
':domain' => $sEmailDomain, ':domain' => \MailSo\Base\Utils::GetDomainFromEmail($sEmail),
':username' => $sEmailUser ':username' => \MailSo\Base\Utils::GetAccountNameFromEmail($sEmail)
); );
$statement = $conn->prepare($this->sql); $sql = $this->oConfig->Get('plugin', 'pdo_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 // 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) { foreach ($placeholders as $placeholder => $value) {
if (\preg_match_all("/{$placeholder}(?![a-zA-Z0-9\-])/", $this->sql)) { if (\preg_match_all("/{$placeholder}(?![a-zA-Z0-9\-])/", $sql)) {
$statement->bindValue($placeholder, $value); $statement->bindValue($placeholder, $value);
} }
} }
@ -91,4 +89,12 @@ class ChangePasswordDriverPDO
// and execute // and execute
return !!$statement->execute(); return !!$statement->execute();
} }
catch (\Exception $oException)
{
if ($this->oLogger) {
$this->oLogger->WriteException($oException);
}
}
return false;
}
} }

View file

@ -276,6 +276,7 @@ class MailClient
} }
$aFetchResponse = $this->oImapClient->Fetch(array( $aFetchResponse = $this->oImapClient->Fetch(array(
// FetchType::BINARY_SIZE.'['.$sMimeIndex.']',
// Push in the aFetchCallbacks array and then called by \MailSo\Imap\Traits\ResponseParser::partialResponseLiteralCallbackCallable // Push in the aFetchCallbacks array and then called by \MailSo\Imap\Traits\ResponseParser::partialResponseLiteralCallbackCallable
array( array(
$sPeek.'['.$sMimeIndex.']', $sPeek.'['.$sMimeIndex.']',