From 11c616715d5e40296a1a2725262e0b656bd7284e Mon Sep 17 00:00:00 2001 From: Sergey Mosin Date: Wed, 26 Jul 2023 20:01:11 -0400 Subject: [PATCH 1/8] improve: use calendar icon in message list for messages with '.ics' or 'text/calendar' attachments --- dev/Common/File.js | 7 ++++++- vendors/fontastic/styles.css | 3 +++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/dev/Common/File.js b/dev/Common/File.js index acd5a370e..f333235fa 100644 --- a/dev/Common/File.js +++ b/dev/Common/File.js @@ -116,7 +116,8 @@ export const FileType = { Spreadsheet: 'spreadsheet', Presentation: 'presentation', Certificate: 'certificate', - Archive: 'archive' + Archive: 'archive', + Calendar: 'calendar' }; export const FileInfo = { @@ -190,6 +191,9 @@ export const FileInfo = { case 'eml' == ext || ['message/delivery-status', 'message/rfc822'].includes(mimeType): result = FileType.Eml; break; + case 'ics' == ext || mimeType == 'text/calendar': + result = FileType.Calendar; + break; case 'text' == mimeTypeParts[0] || 'txt' == ext || 'log' == ext: result = FileType.Text; break; @@ -240,6 +244,7 @@ export const FileInfo = { case FileType.Certificate: case FileType.Spreadsheet: case FileType.Presentation: + case FileType.Calendar: return result + '-' + fileType; } return result; diff --git a/vendors/fontastic/styles.css b/vendors/fontastic/styles.css index 576869646..ae034056f 100644 --- a/vendors/fontastic/styles.css +++ b/vendors/fontastic/styles.css @@ -106,3 +106,6 @@ .icon-check-mark-circle-two::before { content: "\e073"; } +.icon-file-calendar::before { + content: "📅"; +} From d97ccf0cfb6e7a1ab7adf6be3f2813b985f531b1 Mon Sep 17 00:00:00 2001 From: Sergey Mosin Date: Sat, 29 Jul 2023 17:01:44 -0400 Subject: [PATCH 2/8] improve: add "Add/Edit signature" label to PopupsIdentity.html --- snappymail/v/0.0.0/app/localization/en/user.json | 1 + snappymail/v/0.0.0/app/templates/Views/User/PopupsIdentity.html | 1 + 2 files changed, 2 insertions(+) diff --git a/snappymail/v/0.0.0/app/localization/en/user.json b/snappymail/v/0.0.0/app/localization/en/user.json index e777708ff..b444b2dbc 100644 --- a/snappymail/v/0.0.0/app/localization/en/user.json +++ b/snappymail/v/0.0.0/app/localization/en/user.json @@ -254,6 +254,7 @@ "TITLE_UPDATE_IDENTITY": "Update Identity?", "BUTTON_ADD_IDENTITY": "Add", "BUTTON_UPDATE_IDENTITY": "Update", + "LABEL_SIGNATURE_ADD": "Add/Edit signature", "LABEL_SIGNATURE_INSERT_BEFORE": "Insert this signature before quoted text in replies" }, "POPUPS_CREATE_FOLDER": { diff --git a/snappymail/v/0.0.0/app/templates/Views/User/PopupsIdentity.html b/snappymail/v/0.0.0/app/templates/Views/User/PopupsIdentity.html index 484da4202..e5fffa2b2 100644 --- a/snappymail/v/0.0.0/app/templates/Views/User/PopupsIdentity.html +++ b/snappymail/v/0.0.0/app/templates/Views/User/PopupsIdentity.html @@ -52,6 +52,7 @@
+

- + From 22691450afc79e1d5e0268f265d03ea68c036f84 Mon Sep 17 00:00:00 2001 From: Sergey Mosin Date: Thu, 10 Aug 2023 17:20:58 -0400 Subject: [PATCH 6/8] improve: if applicable set '\\answered' or '$forwarded' flag after a message is sent so the proper icon is shown in the message list view --- dev/View/Popup/Compose.js | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/dev/View/Popup/Compose.js b/dev/View/Popup/Compose.js index 183e5b831..e1557d268 100644 --- a/dev/View/Popup/Compose.js +++ b/dev/View/Popup/Compose.js @@ -493,6 +493,19 @@ export class ComposePopupView extends AbstractViewPopup { || getNotification(Notifications.CantSendMessage)); } } else { + if (arrayLength(this.aDraftInfo) > 0) { + const flag = { + 'reply': '\\answered', + 'forward': '$forwarded' + }[this.aDraftInfo[0]]; + if (flag) { + const aFlags = MessageUserStore.message().flags(); + if (aFlags.indexOf(flag) === -1) { + aFlags.push(flag); + MessageUserStore.message().flags(aFlags); + } + } + } this.close(); } setFolderETag(this.draftsFolder(), ''); From 35cd3543530d3fb1304ad972e9a8a27ee575ec0a Mon Sep 17 00:00:00 2001 From: Sergey Mosin Date: Fri, 11 Aug 2023 14:44:42 -0400 Subject: [PATCH 7/8] improve: add 'collapse_blockquotes', 'allow_spellcheck' and 'mail_list_grouped' to admin settings ('defaults' section) --- snappymail/v/0.0.0/app/libraries/RainLoop/Actions.php | 7 ++++--- .../v/0.0.0/app/libraries/RainLoop/Config/Application.php | 5 ++++- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/snappymail/v/0.0.0/app/libraries/RainLoop/Actions.php b/snappymail/v/0.0.0/app/libraries/RainLoop/Actions.php index eb7356db5..febf39be7 100644 --- a/snappymail/v/0.0.0/app/libraries/RainLoop/Actions.php +++ b/snappymail/v/0.0.0/app/libraries/RainLoop/Actions.php @@ -679,16 +679,17 @@ class Actions 'contactsAllowed' => $this->AddressBookProvider($oAccount)->IsActive(), + 'allowSpellcheck' => $oConfig->Get('defaults', 'allow_spellcheck', false), 'ViewHTML' => (bool) $oConfig->Get('defaults', 'view_html', true), 'ViewImages' => $oConfig->Get('defaults', 'view_images', 'ask'), 'ViewImagesWhitelist' => '', 'RemoveColors' => (bool) $oConfig->Get('defaults', 'remove_colors', false), 'AllowStyles' => false, 'ListInlineAttachments' => false, - 'CollapseBlockquotes' => true, + 'CollapseBlockquotes' => $oConfig->Get('defaults', 'collapse_blockquotes', true), 'MaxBlockquotesLevel' => 0, 'simpleAttachmentsList' => false, - 'listGrouped' => false, + 'listGrouped' => $oConfig->Get('defaults', 'mail_list_grouped', false), 'MessagesPerPage' => (int) $oConfig->Get('webmail', 'messages_per_page', 25), 'MessageReadDelay' => (int) $oConfig->Get('webmail', 'message_read_delay', 5), 'MsgDefaultAction' => (int) $oConfig->Get('defaults', 'msg_default_action', 1), @@ -773,7 +774,7 @@ class Actions $aResult['requireTLS'] = (bool) $oSettings->GetConf('requireTLS', false); $aResult['pgpSign'] = (bool) $oSettings->GetConf('pgpSign', false); $aResult['pgpEncrypt'] = (bool) $oSettings->GetConf('pgpEncrypt', false); - $aResult['allowSpellcheck'] = (bool) $oSettings->GetConf('allowSpellcheck', false); + $aResult['allowSpellcheck'] = (bool) $oSettings->GetConf('allowSpellcheck', $aResult['allowSpellcheck']); // $aResult['allowCtrlEnterOnCompose'] = (bool) $oSettings->GetConf('allowCtrlEnterOnCompose', true); $aResult['ViewHTML'] = (bool)$oSettings->GetConf('ViewHTML', $aResult['ViewHTML']); diff --git a/snappymail/v/0.0.0/app/libraries/RainLoop/Config/Application.php b/snappymail/v/0.0.0/app/libraries/RainLoop/Config/Application.php index b9c92220c..8f7bdf1a1 100644 --- a/snappymail/v/0.0.0/app/libraries/RainLoop/Config/Application.php +++ b/snappymail/v/0.0.0/app/libraries/RainLoop/Config/Application.php @@ -301,10 +301,13 @@ Values: "match" - whitelist or ask "always" - show always'), 'contacts_autosave' => array(true), - 'mail_use_threads' => array(false), + 'mail_list_grouped' => array(false), + 'mail_use_threads' => array(false), 'allow_draft_autosave' => array(true), 'mail_reply_same_folder' => array(false), 'msg_default_action' => array(1, '1 - reply, 2 - reply all'), + 'collapse_blockquotes' => array(true), + 'allow_spellcheck' => array(false) ), 'logs' => array( From 79c8281a6b948aa095c0e51a9ed2a53ee6f360fc Mon Sep 17 00:00:00 2001 From: Sergey Mosin Date: Wed, 16 Aug 2023 10:42:17 -0400 Subject: [PATCH 8/8] improve: nextcloud: set 'smremember' cookie if 'sign_me_auto' is set to 'DefaultOn' when using 'snappymail-autologin*', otherwise nextcloud users need to re-login when the browser is re-opened. --- .../nextcloud/snappymail/lib/AppInfo/Application.php | 3 ++- .../nextcloud/snappymail/lib/Util/SnappyMailHelper.php | 4 +++- .../v/0.0.0/app/libraries/RainLoop/Actions/UserAuth.php | 9 ++++++++- snappymail/v/0.0.0/app/libraries/snappymail/cookies.php | 6 +++--- 4 files changed, 16 insertions(+), 6 deletions(-) diff --git a/integrations/nextcloud/snappymail/lib/AppInfo/Application.php b/integrations/nextcloud/snappymail/lib/AppInfo/Application.php index 5fad178eb..9a8e0748c 100644 --- a/integrations/nextcloud/snappymail/lib/AppInfo/Application.php +++ b/integrations/nextcloud/snappymail/lib/AppInfo/Application.php @@ -86,7 +86,8 @@ class Application extends App implements IBootstrap // https://github.com/nextcloud/server/issues/36083#issuecomment-1387370634 // \OC::$server->getSession()['snappymail-password'] = ''; SnappyMailHelper::loadApp(); - \RainLoop\Api::Actions()->Logout(true); +// \RainLoop\Api::Actions()->Logout(true); + \RainLoop\Api::Actions()->DoLogout(); }); // https://github.com/nextcloud/impersonate/issues/179 diff --git a/integrations/nextcloud/snappymail/lib/Util/SnappyMailHelper.php b/integrations/nextcloud/snappymail/lib/Util/SnappyMailHelper.php index 5764da4c8..4839779d2 100644 --- a/integrations/nextcloud/snappymail/lib/Util/SnappyMailHelper.php +++ b/integrations/nextcloud/snappymail/lib/Util/SnappyMailHelper.php @@ -80,7 +80,9 @@ class SnappyMailHelper if ($doLogin && $aCredentials[1] && $aCredentials[2]) { try { $oActions->Logger()->AddSecret($aCredentials[2]); - $oAccount = $oActions->LoginProcess($aCredentials[1], $aCredentials[2], false); + + $bSignMe = $oConfig->Get('login', 'sign_me_auto', \RainLoop\Enumerations\SignMeType::DEFAULT_OFF) === \RainLoop\Enumerations\SignMeType::DEFAULT_ON; + $oAccount = $oActions->LoginProcess($aCredentials[1], $aCredentials[2], $bSignMe); if ($oAccount) { $oActions->Plugins()->RunHook('login.success', array($oAccount)); $oActions->SetAuthToken($oAccount); diff --git a/snappymail/v/0.0.0/app/libraries/RainLoop/Actions/UserAuth.php b/snappymail/v/0.0.0/app/libraries/RainLoop/Actions/UserAuth.php index 33f7fa2cf..63d3c9737 100644 --- a/snappymail/v/0.0.0/app/libraries/RainLoop/Actions/UserAuth.php +++ b/snappymail/v/0.0.0/app/libraries/RainLoop/Actions/UserAuth.php @@ -139,7 +139,14 @@ trait UserAuth $this->imapConnect($oAccount, true); if ($bMainAccount) { - $bSignMe && $this->SetSignMeToken($oAccount); + if($bSignMe){ + // SetAuthToken token needs to be called before SetSignMeToken + // because $_COOKIE['smctoken'] is used by Crypt::Passphrase. + // If the $_COOKIE['smctoken'] is not set then SetSignMeToken + // throws an exception + $this->SetAuthToken($oAccount); + $this->SetSignMeToken($oAccount); + } $this->StorageProvider()->Put($oAccount, StorageType::SESSION, Utils::GetSessionToken(), 'true'); } diff --git a/snappymail/v/0.0.0/app/libraries/snappymail/cookies.php b/snappymail/v/0.0.0/app/libraries/snappymail/cookies.php index 9c670239e..3ac579b2f 100644 --- a/snappymail/v/0.0.0/app/libraries/snappymail/cookies.php +++ b/snappymail/v/0.0.0/app/libraries/snappymail/cookies.php @@ -83,7 +83,7 @@ class Cookies if ($cookie_remove) { \header_remove('Set-Cookie'); foreach ($cookies as $cookie) { - \header($cookie); + \header($cookie,false); } } @@ -118,14 +118,14 @@ class Cookies foreach (\str_split($sValue, $iMaxSize) as $i => $sPart) { $sCookieName = $i ? "{$sName}~{$i}" : $sName; Log::debug('COOKIE', "set {$sCookieName}"); - static::_set($sCookieName, $sPart, $iExpire); + static::_set($sCookieName, $sPart, $iExpire, $httponly); } // Delete unused old 4K split cookie parts foreach (\array_keys($_COOKIE) as $sCookieName) { $aSplit = \explode('~', $sCookieName); if (isset($aSplit[1]) && $aSplit[0] == $sName && $aSplit[1] > $i) { Log::debug('COOKIE', "unset {$sCookieName}"); - static::_set($sCookieName, '', 0); + static::_set($sCookieName, '', 0, $httponly); } } }