Skip to content

Commit

Permalink
Merge branch 'dev/sync-nextcloud-addressbook' into draft/dev_sync-nex…
Browse files Browse the repository at this point in the history
…tcloud-addressbook
  • Loading branch information
Fahim Salam Chowdhury committed Sep 3, 2024
2 parents 19ddcfb + f4ad959 commit 2e3fbe0
Show file tree
Hide file tree
Showing 87 changed files with 3,360 additions and 402 deletions.
6 changes: 5 additions & 1 deletion .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,11 @@ module.exports = {
// Mailvelope
'mailvelope': "readonly",
// Punycode
'IDN': "readonly"
'IDN': "readonly",
// Turndown
'TurndownService': "readonly",
// Marked
'marked': "readonly"
},
// http://eslint.org/docs/rules/
rules: {
Expand Down
40 changes: 40 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,43 @@
## 2.37.3 – 2024-08-27

### Added
- Mark images with width=1 as tracking pixel
- Show warning in Admin -> About when PHP runs in 32bit
- Edit ACL rules
[#157](https://github.com/the-djmaze/snappymail/issues/157)
- Show GnuPG version for
[#1560](https://github.com/the-djmaze/snappymail/issues/1560)
- Make sure only scalar values are allowed in $_ENV for
[#1560](https://github.com/the-djmaze/snappymail/issues/1560)
- Change minimum new mail check interval
[#1678](https://github.com/the-djmaze/snappymail/issues/1678)
- Sieve editor does not support "index" extension
[#1709](https://github.com/the-djmaze/snappymail/issues/1709)

### Changed
- Improved domain autoconfig interaction
- MS autodiscover priorities DNS over subdomain
- Simplify sieve scripts list
[#1675](https://github.com/the-djmaze/snappymail/issues/1675)
- Handling of (token) errors due to
[#1706](https://github.com/the-djmaze/snappymail/issues/1706)
- Sabre/Xml to v4.0.5
- Update Chinese by @Artoria2e5
- Update French by @hguilbert

### Fixed
- Thread sorting visible after disabling the imap capability
[#1574](https://github.com/the-djmaze/snappymail/issues/1574)
- Creating new message impossible as long as a draft exists?
[#1710](https://github.com/the-djmaze/snappymail/issues/1710)
- InvalidToken error at login
[#1706](https://github.com/the-djmaze/snappymail/issues/1706)

### Nextcloud
- Force Nextcloud personal language by default
[#1428](https://github.com/the-djmaze/snappymail/issues/1428)


## 2.37.2 – 2024-08-13

### Added
Expand Down
24 changes: 12 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -140,26 +140,26 @@ RainLoop 1.17 vs SnappyMail

|js/* |RainLoop |Snappy |
|--------------- |--------: |--------: |
|admin.js |2.170.153 | 84.054 |
|app.js |4.207.787 | 441.754 |
|boot.js | 868.735 | 4.147 |
|admin.js |2.170.153 | 84.203 |
|app.js |4.207.787 | 445.359 |
|boot.js | 868.735 | 4.343 |
|libs.js | 658.812 | 193.716 |
|sieve.js | 0 | 84.598 |
|sieve.js | 0 | 84.571 |
|polyfills.js | 334.608 | 0 |
|serviceworker.js | 0 | 285 |
|TOTAL |8.240.095 | 808.554 |
|TOTAL |8.240.095 | 812.477 |

|js/min/* |RainLoop |Snappy |RL gzip |SM gzip |RL brotli |SM brotli |
|--------------- |--------: |--------: |------: |------: |--------: |--------: |
|admin.min.js | 256.831 | 41.162 | 73.606 | 13.885 | 60.877 | 12.434 |
|app.min.js | 515.367 | 199.730 |139.456 | 67.669 |110.485 | 57.672 |
|boot.min.js | 84.659 | 2.087 | 26.998 | 1.204 | 23.643 | 1.002 |
|admin.min.js | 256.831 | 41.256 | 73.606 | 13.940 | 60.877 | 12.493 |
|app.min.js | 515.367 | 201.270 |139.456 | 68.096 |110.485 | 58.078 |
|boot.min.js | 84.659 | 2.231 | 26.998 | 1.271 | 23.643 | 1.067 |
|libs.min.js | 584.772 | 92.365 |180.901 | 34.487 |155.182 | 30.830 |
|sieve.min.js | 0 | 41.093 | 0 | 10.325 | 0 | 9.327 |
|sieve.min.js | 0 | 41.288 | 0 | 10.327 | 0 | 9.318 |
|polyfills.min.js | 32.837 | 0 | 11.406 | 0 | 10.175 | 0 |
|TOTAL user |1.217.635 | 294.182 |358.761 |103.360 |299.485 | 89.504 |
|TOTAL user+sieve |1.217.635 | 335.275 |358.761 |113.685 |299.485 | 98.831 |
|TOTAL admin | 959.099 | 135.614 |292.911 | 49.576 |249.877 | 44.266 |
|TOTAL user |1.217.635 | 295.866 |358.761 |103.854 |299.485 | 89.975 |
|TOTAL user+sieve |1.217.635 | 337.154 |358.761 |114.181 |299.485 | 99.293 |
|TOTAL admin | 959.099 | 135.852 |292.911 | 49.698 |249.877 | 44.390 |

For a user it is around 68% smaller and faster than traditional RainLoop.

Expand Down
5 changes: 4 additions & 1 deletion dev/Common/Html.js
Original file line number Diff line number Diff line change
Expand Up @@ -469,6 +469,7 @@ export const
else if (detectHiddenImages
&& ((oStyle.maxHeight && 3 > pInt(oStyle.maxHeight)) // TODO: issue with 'in'
|| (oStyle.maxWidth && 3 > pInt(oStyle.maxWidth)) // TODO: issue with 'in'
|| (oStyle.width && 2 > pInt(oStyle.width))
|| [
'email.microsoftemail.com/open',
'github.com/notifications/beacon/',
Expand Down Expand Up @@ -675,7 +676,9 @@ export const
forEach('a', a => {
let txt = a.textContent, href = a.href;
return a.replaceWith(
txt.trim() == href || href.includes('mailto:') ? txt : txt + ' ' + href + ' '
txt.replace(/[\s()-]+/g, '').includes(href.replace(/^[a-z]:/, '').replace(/[\s()-]+/g, ''))
? txt
: txt + ' ' + href + ' '
);
});

Expand Down
2 changes: 2 additions & 0 deletions dev/Settings/Admin/About.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ export class AdminSettingsAbout /*extends AbstractViewSettings*/ {
coreWarning: false,
coreVersion: '',
coreVersionCompare: -2,
php64: true,
load1: 0,
load5: 0,
load15: 0,
Expand Down Expand Up @@ -69,6 +70,7 @@ export class AdminSettingsAbout /*extends AbstractViewSettings*/ {
this.coreWarning(!!data.core.warning);
this.coreVersion(data.core.version || '');
this.coreVersionCompare(data.core.versionCompare);
this.php64(data.php[1].loaded);
} else {
this.coreReal(false);
this.coreWarning(false);
Expand Down
2 changes: 2 additions & 0 deletions dev/Settings/Admin/Security.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ export class AdminSettingsSecurity extends AbstractViewSettings {
capaOpenPGP: SettingsCapa('OpenPGP')
});

this.gnuPGversion = 'GnuPG v' + SettingsGet('gnupg');

const reset = () => {
this.saveError(false);
this.saveSuccess(false);
Expand Down
2 changes: 1 addition & 1 deletion dev/Stores/User/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { ThemeStore } from 'Stores/Theme';
import { arePopupsVisible } from 'Knoin/Knoin';

export const AppUserStore = {
allowContacts: () => !!SettingsGet('contactsAllowed') && !!SettingsGet('contactsExternal')
allowContacts: () => !!SettingsGet('contactsAllowed')
};

addObservablesTo(AppUserStore, {
Expand Down
2 changes: 1 addition & 1 deletion integrations/cloudron/DESCRIPTION.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
This app packages SnappyMail <upstream>2.37.2</upstream>.
This app packages SnappyMail <upstream>2.37.3</upstream>.

SnappyMail is a simple, modern, lightweight & fast web-based email client.

Expand Down
2 changes: 1 addition & 1 deletion integrations/cloudron/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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.37.2
VERSION=2.37.3
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 && \
Expand Down
2 changes: 1 addition & 1 deletion integrations/nextcloud/snappymail/appinfo/info.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<id>snappymail</id>
<name>SnappyMail</name>
<summary>SnappyMail Webmail</summary>
<version>2.37.2</version>
<version>2.37.3</version>
<licence>agpl</licence>
<author>SnappyMail, RainLoop Team, Nextgen-Networks, Tab Fitts, Nathan Kinkade, Pierre-Alain Bandinelli</author>
<description><![CDATA[**Lightweight & fast email client.**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,11 +61,15 @@ public function setAdmin(): JSONResponse {
]);
}

SnappyMailHelper::loadApp();

$oConfig = \RainLoop\Api::Config();
if (!empty($_POST['snappymail-app_path'])) {
$oConfig = \RainLoop\Api::Config();
$oConfig->Set('webmail', 'app_path', $_POST['snappymail-app_path']);
$oConfig->Save();
}
$oConfig->Set('webmail', 'allow_languages_on_settings', empty($_POST['snappymail-nc-lang']));
$oConfig->Set('login', 'allow_languages_on_login', empty($_POST['snappymail-nc-lang']));
$oConfig->Save();

if (!empty($_POST['import-rainloop'])) {
return new JSONResponse([
Expand All @@ -74,7 +78,6 @@ public function setAdmin(): JSONResponse {
]);
}

SnappyMailHelper::loadApp();
$debug = !empty($_POST['snappymail-debug']);
$oConfig = \RainLoop\Api::Config();
if ($debug != $oConfig->Get('debug', 'enable', false)) {
Expand Down Expand Up @@ -133,7 +136,7 @@ public function setPersonal(): JSONResponse {
// TODO: Handle both exceptions separately?
SnappyMailHelper::loadApp();
\RainLoop\Api::Actions()->DoLogout();

return new JSONResponse([
'status' => 'error',
'Message' => $e->getMessage()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,8 @@ public function run(IOutput $output) {
if (!$oConfig->Get('webmail', 'app_path')) {
$output->info('Set config [webmail]app_path');
$oConfig->Set('webmail', 'app_path', \OC::$server->getAppManager()->getAppWebPath('snappymail') . '/app/');
$oConfig->Set('webmail', 'allow_languages_on_settings', false);
$oConfig->Set('login', 'allow_languages_on_login', false);
$bSave = true;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ public function getForm()
$oConfig->Save();
}
$parameters['snappymail-app_path'] = $oConfig->Get('webmail', 'app_path', false);
$parameters['snappymail-nc-lang'] = !$oConfig->Get('webmail', 'allow_languages_on_settings', true);

\OCP\Util::addScript('snappymail', 'snappymail');
return new TemplateResponse('snappymail', 'admin-local', $parameters);
Expand Down
7 changes: 7 additions & 0 deletions integrations/nextcloud/snappymail/templates/admin-local.php
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,13 @@
<br />
<?php } ?>

<p>
<input id="snappymail-nc-lang" name="snappymail-nc-lang" type="checkbox" class="checkbox" <?php if ($_['snappymail-nc-lang']) echo 'checked="checked"'; ?>>
<label for="snappymail-nc-lang">
<?php echo($l->t('Force Nextcloud personal language')); ?>
</label>
</p>
<br />
<p>
<label for="snappymail-app_path">
<?php echo($l->t('app_path')); ?>
Expand Down
2 changes: 1 addition & 1 deletion integrations/virtualmin/snappymail.pl
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ sub script_snappymail_longdesc
# script_snappymail_versions()
sub script_snappymail_versions
{
return ( "2.37.2" );
return ( "2.37.3" );
}

sub script_snappymail_version_desc
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"title": "SnappyMail",
"description": "Simple, modern & fast web-based email client",
"private": true,
"version": "2.37.2",
"version": "2.37.3",
"homepage": "https://snappymail.eu",
"author": {
"name": "DJ Maze",
Expand Down
4 changes: 4 additions & 0 deletions plugins/avatars/avatars.js
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,10 @@
if (msg?.from?.[0]) {
let url = getAvatar(msg),
fn = url=>{element.src = url};
element.onerror = ()=>{
element.onerror = null;
setIdenticon(msg.from[0], fn);
};
if (url) {
fn(url);
} else if (msg.avatar?.startsWith('data:')) {
Expand Down
12 changes: 8 additions & 4 deletions plugins/avatars/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ class AvatarsPlugin extends \RainLoop\Plugins\AbstractPlugin
NAME = 'Avatars',
AUTHOR = 'SnappyMail',
URL = 'https://snappymail.eu/',
VERSION = '1.19',
RELEASE = '2024-07-08',
VERSION = '1.20',
RELEASE = '2024-08-26',
REQUIRED = '2.33.0',
CATEGORY = 'Contacts',
LICENSE = 'MIT',
Expand Down Expand Up @@ -116,12 +116,16 @@ public function DoAvatar() : array
* Nextcloud Mail uses insecure unencrypted 'index.php/apps/mail/api/avatars/url/local%40example.com'
*/
// public function ServiceAvatar(...$aParts)
public function ServiceAvatar(string $sServiceName, string $sBimi, string $sEmail)
public function ServiceAvatar(string $sServiceName, string $sBimi, string $sEncryptedEmail)
{
$sEmail = \SnappyMail\Crypt::DecryptUrlSafe($sEmail);
$maxAge = 86400;
$sEmail = \SnappyMail\Crypt::DecryptUrlSafe($sEncryptedEmail);
$aBimi = \explode('-', $sBimi, 2);
$sBimiSelector = isset($aBimi[1]) ? $aBimi[1] : 'default';
// $sEmail && \MailSo\Base\Http::setETag("{$sBimiSelector}-{$sEncryptedEmail}");
if ($sEmail && ($aResult = $this->getAvatar($sEmail, !empty($aBimi[0]), $sBimiSelector))) {
\header("Cache-Control: max-age={$maxAge}, private");
\header('Expires: '.\gmdate('D, j M Y H:i:s', $maxAge + \time()).' UTC');
\header('Content-Type: '.$aResult[0]);
echo $aResult[1];
} else {
Expand Down
5 changes: 0 additions & 5 deletions plugins/kolab/KolabAddressBook.php
Original file line number Diff line number Diff line change
Expand Up @@ -99,11 +99,6 @@ public function IsSupported() : bool
return true;
}

public function IsExternal(): bool
{
return false;
}

public function SetEmail(string $sEmail) : bool
{
return true;
Expand Down
8 changes: 1 addition & 7 deletions plugins/nextcloud/NextcloudAddressBook.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,13 +60,7 @@ public function IsSupported(): bool
return true;
}

public function IsExternal(): bool
{
return true;
}

public function SetEmail(string $sEmail): bool
{
public function SetEmail(string $sEmail) : bool {
return true;
}

Expand Down
2 changes: 1 addition & 1 deletion plugins/nextcloud/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -451,7 +451,7 @@ public function MainFabrica(string $sName, &$mResult)
$ignoreSystemAddressbook
);
}
/*
/*
if ($this->Config()->Get('plugin', 'storage', false) && ('storage' === $sName || 'storage-local' === $sName)) {
require_once __DIR__ . '/storage.php';
$oDriver = new \NextcloudStorage(APP_PRIVATE_DATA.'storage', $sName === 'storage-local');
Expand Down
19 changes: 10 additions & 9 deletions snappymail/v/0.0.0/app/libraries/MailSo/Imap/BodyStructure.php
Original file line number Diff line number Diff line change
Expand Up @@ -172,9 +172,10 @@ public function isSMimeSigned() : bool
);
}

public function IsAttachment() : bool
protected function IsAttachment(/*BodyStructure*/ $oParent) : bool
{
return 'application/pgp-encrypted' !== $this->sContentType
// return 'application/pgp-encrypted' !== $this->sContentType
return (!$oParent || !$oParent->isPgpEncrypted())
&& (
'attachment' === $this->sDisposition || (
!\str_starts_with($this->sContentType, 'multipart/')
Expand All @@ -194,8 +195,8 @@ public function GetHtmlAndPlainParts() : array
{
$aParts = [];

$gParts = $this->SearchByCallback(function ($oItem) {
return $oItem->isText() && !$oItem->IsAttachment();
$gParts = $this->SearchByCallback(function ($oItem, $oParent) {
return $oItem->isText() && !$oItem->IsAttachment($oParent);
});
foreach ($gParts as $oPart) {
$aParts[] = $oPart;
Expand Down Expand Up @@ -232,13 +233,13 @@ public function GetHtmlAndPlainParts() : array

public function SearchCharset() : string
{
$gParts = $this->SearchByCallback(function ($oPart) {
return $oPart->Charset() && $oPart->isText() && !$oPart->IsAttachment();
$gParts = $this->SearchByCallback(function ($oPart, $oParent) {
return $oPart->Charset() && $oPart->isText() && !$oPart->IsAttachment($oParent);
});

if (!$gParts->valid()) {
$gParts = $this->SearchByCallback(function ($oPart) {
return $oPart->Charset() && $oPart->IsAttachment();
$gParts = $this->SearchByCallback(function ($oPart, $oParent) {
return $oPart->Charset() && $oPart->IsAttachment($oParent);
});
}

Expand All @@ -259,7 +260,7 @@ public function SearchAttachmentsParts() : iterable
{
return $this->SearchByCallback(function ($oItem, $oParent) {
// return $oItem->IsAttachment();
return $oItem->IsAttachment() && (!$oParent || !$oParent->isPgpEncrypted());
return $oItem->IsAttachment($oParent) && (!$oParent || !$oParent->isPgpEncrypted());
});
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -299,6 +299,7 @@ public function CapabilityValue(string $sExtentionName) : ?string
private function setCapabilities(ResponseCollection $oResponseCollection) : void
{
$aList = $oResponseCollection->getCapabilityResult();
$this->aCapaRaw = $aList;
if ($aList) {
// Strip unused capabilities
$aList = \array_diff($aList, ['PREVIEW=FUZZY', 'SNIPPET=FUZZY', 'SORT=DISPLAY']);
Expand Down
Loading

0 comments on commit 2e3fbe0

Please sign in to comment.