Merge branch 'master' into rtl-support

This commit is contained in:
the-djmaze 2023-04-18 09:54:24 +02:00
commit 9cabfe7570
12 changed files with 92 additions and 48 deletions

View file

@ -28,6 +28,7 @@ If applicable, add screenshots to help explain your problem.
- IMAP daemon: [e.g. courier, dovecot]
- PHP version:
- SnappyMail Version:
- Mode: [e.g. standalone, nextcloud, cyberpanel, docker]
**[Debug/logging information](https://github.com/the-djmaze/snappymail/wiki/FAQ#how-do-i-enable-logging)**
Place them here (few lines) or as attachments (many lines)

View file

@ -265,8 +265,6 @@ export const
}
tmpl.innerHTML = html
// Strip Microsoft comments
.replace(/<!--\[if[\s\S]*?-->/gi, '')
// .replace(/<pre[^>]*>[\s\S]*?<\/pre>/gi, pre => pre.replace(/\n/g, '\n<br>'))
// Not supported by <template> element
// .replace(/<!doctype[^>]*>/gi, '')
@ -280,8 +278,7 @@ export const
.trim();
html = '';
// \MailSo\Base\HtmlUtils::ClearComments()
// https://github.com/the-djmaze/snappymail/issues/187
// Strip all comments
const nodeIterator = document.createNodeIterator(tmpl.content, NodeFilter.SHOW_COMMENT);
while (nodeIterator.nextNode()) {
nodeIterator.referenceNode.remove();
@ -531,11 +528,12 @@ export const
if (urls_broken.length) {
setAttribute('data-x-style-broken-urls', JSON.stringify(urls_broken));
}
/*
// https://github.com/the-djmaze/snappymail/issues/1082
if (11 > pInt(oStyle.fontSize)) {
oStyle.removeProperty('font-size');
}
*/
// Removes background and color
// Many e-mails incorrectly only define one, not both
// And in dark theme mode this kills the readability

View file

@ -1355,10 +1355,15 @@ export class ComposePopupView extends AbstractViewPopup {
async getMessageRequestParams(sSaveFolder, draft)
{
let Text = this.oEditor.getData().trim(),
l = Text.length,
hasAttachments = 0;
// Prepare ComposeAttachmentModel attachments
const attachments = {};
this.attachments.forEach(item => {
if (item?.complete() && item?.tempName() && item?.enabled()) {
++hasAttachments;
attachments[item.tempName()] = {
name: item.fileName(),
inline: item.isInline,
@ -1369,6 +1374,10 @@ export class ComposePopupView extends AbstractViewPopup {
}
});
if (!draft && !l && !hasAttachments) {
throw i18n('COMPOSE/ERROR_EMPTY_BODY');
}
const
identity = this.currentIdentity(),
params = {
@ -1397,12 +1406,7 @@ export class ComposePopupView extends AbstractViewPopup {
encrypt = this.pgpEncrypt() && this.canPgpEncrypt(),
isHtml = this.oEditor.isHtml();
let Text = this.oEditor.getData().trim();
if (!draft && !Text.length) {
throw i18n('COMPOSE/ERROR_EMPTY_BODY');
}
if (isHtml) {
let l;
do {
l = Text.length;
Text = Text

View file

@ -35,13 +35,18 @@ class SnappyMailHelper
{
static::loadApp();
$oConfig = \RainLoop\Api::Config();
if (false !== \stripos(\php_sapi_name(), 'cli')) {
return;
}
try {
$oActions = \RainLoop\Api::Actions();
$oConfig = \RainLoop\Api::Config();
if (isset($_GET[$oConfig->Get('security', 'admin_panel_key', 'admin')])) {
if ($oConfig->Get('security', 'allow_admin_panel', true)
&& \OC_User::isAdminUser(\OC::$server->getUserSession()->getUser()->getUID())
&& !$oActions->IsAdminLoggined(false)
&& \OC_User::isAdminUser(\OC::$server->getUserSession()->getUser()->getUID())
&& !$oActions->IsAdminLoggined(false)
) {
$sRand = \MailSo\Base\Utils::Sha1Rand();
if ($oActions->Cacher(null, true)->Set(\RainLoop\KeyPathHelper::SessionAdminKey($sRand), \time())) {
@ -88,16 +93,16 @@ class SnappyMailHelper
}
}
}
if ($handle) {
\header_remove('Content-Security-Policy');
\RainLoop\Service::Handle();
// https://github.com/the-djmaze/snappymail/issues/1069
exit;
}
} catch (\Throwable $e) {
// Ignore login failure
}
if ($handle) {
\header_remove('Content-Security-Policy');
\RainLoop\Service::Handle();
// https://github.com/the-djmaze/snappymail/issues/1069
exit;
}
}
public static function getLoginCredentials() : array

View file

@ -4,8 +4,8 @@ class NextcloudPlugin extends \RainLoop\Plugins\AbstractPlugin
{
const
NAME = 'Nextcloud',
VERSION = '2.22',
RELEASE = '2023-03-28',
VERSION = '2.23',
RELEASE = '2023-04-11',
CATEGORY = 'Integrations',
DESCRIPTION = 'Integrate with Nextcloud v20+',
REQUIRED = '2.27.0';
@ -34,6 +34,9 @@ class NextcloudPlugin extends \RainLoop\Plugins\AbstractPlugin
$this->addTemplate('templates/PopupsNextcloudFiles.html');
$this->addTemplate('templates/PopupsNextcloudCalendars.html');
$this->addHook('imap.before-login', 'oidcLogin');
$this->addHook('smtp.before-login', 'oidcLogin');
$this->addHook('sieve.before-login', 'oidcLogin');
} else {
// \OC::$server->getConfig()->getAppValue('snappymail', 'snappymail-no-embed');
$this->addHook('main.content-security-policy', 'ContentSecurityPolicy');
@ -62,6 +65,20 @@ class NextcloudPlugin extends \RainLoop\Plugins\AbstractPlugin
return static::IsIntegrated() && \OC::$server->getUserSession()->isLoggedIn();
}
public function oidcLogin(\RainLoop\Model\Account $oAccount, \MailSo\Net\NetClient $oClient, \MailSo\Net\ConnectSettings $oSettings) : void
{
if ($this->Config()->Get('plugin', 'oidc', false)
&& \OC::$server->getSession()->get('is_oidc')
// && $oClient->supportsAuthType('OAUTHBEARER') // v2.28
) {
$sAccessToken = \OC::$server->getSession()->get('oidc_access_token');
if ($sAccessToken) {
$oSettings->Password = $sAccessToken;
\array_unshift($oSettings->SASLMechanisms, 'OAUTHBEARER');
}
}
}
/*
\OC::$server->getCalendarManager();
\OC::$server->getLDAPProvider();
@ -254,6 +271,9 @@ class NextcloudPlugin extends \RainLoop\Plugins\AbstractPlugin
->SetType(\RainLoop\Enumerations\PluginPropertyType::BOOL)
->SetDefaultValue(true),
\RainLoop\Plugins\Property::NewInstance('calendar')->SetLabel('Enable "Put ICS in calendar"')
->SetType(\RainLoop\Enumerations\PluginPropertyType::BOOL)
->SetDefaultValue(false),
\RainLoop\Plugins\Property::NewInstance('oidc')->SetLabel('Login with OIDC')
->SetType(\RainLoop\Enumerations\PluginPropertyType::BOOL)
->SetDefaultValue(false)
);

View file

@ -7,8 +7,8 @@ class TwoFactorAuthPlugin extends \RainLoop\Plugins\AbstractPlugin
{
const
NAME = 'Two Factor Authentication',
VERSION = '2.16.1',
RELEASE = '2022-09-20',
VERSION = '2.16.2',
RELEASE = '2023-04-11',
REQUIRED = '2.15.2',
CATEGORY = 'Login',
DESCRIPTION = 'Provides support for TOTP 2FA';
@ -167,10 +167,10 @@ class TwoFactorAuthPlugin extends \RainLoop\Plugins\AbstractPlugin
return $this->jsonResponse(__FUNCTION__, false);
}
$oSettings = $this->Manager()->Actions()->SettingsProvider()->Load($oAccount);
if ($this->Manager()->Actions()->HasActionParam('EnableTwoFactor')) {
$sValue = $this->GetActionParam('EnableTwoFactor', '');
$oSettings->SetConf('EnableTwoFactor', !empty($sValue));
$oActions = $this->Manager()->Actions();
if ($oActions->HasActionParam('EnableTwoFactor')) {
$sValue = $oActions->GetActionParam('EnableTwoFactor', '');
$oActions->SettingsProvider()->Load($oAccount)->SetConf('EnableTwoFactor', !empty($sValue));
}
$sEmail = $oAccount->Email();

View file

@ -94,6 +94,11 @@ class ImapClient extends \MailSo\Net\NetClient
}
}
public function supportsAuthType(string $sasl_type) : bool
{
return $this->hasCapability("AUTH={$sasl_type}");
}
/**
* @throws \InvalidArgumentException
* @throws \MailSo\RuntimeException

View file

@ -195,6 +195,7 @@ abstract class NetClient
}
}
abstract public function supportsAuthType(string $sasl_type) : bool;
// abstract public function Login(ConnectSettings $oSettings) : self;
abstract public function Logout() : void;

View file

@ -70,6 +70,11 @@ class SieveClient extends \MailSo\Net\NetClient
}
}
public function supportsAuthType(string $sasl_type) : bool
{
return \in_array(\strtoupper($sasl_type), $this->aAuth);
}
/**
* @throws \InvalidArgumentException
* @throws \MailSo\RuntimeException

View file

@ -102,6 +102,11 @@ class SmtpClient extends \MailSo\Net\NetClient
}
}
public function supportsAuthType(string $sasl_type) : bool
{
return \in_array(\strtoupper($sasl_type), $this->aAuthTypes);
}
/**
* @throws \InvalidArgumentException
* @throws \MailSo\RuntimeException

View file

@ -10,7 +10,7 @@ abstract class Service
public static function Handle() : bool
{
static $bOne = null;
if (null === $bOne && false === \stripos(\php_sapi_name(), 'cli')) {
if (null === $bOne) {
$bOne = static::RunResult();
}

View file

@ -20,11 +20,11 @@
"MOVE_TO": "Verschieben nach",
"NAME": "Name",
"NONE": "Keine",
"TO_SPAM": "Move message(s) to Spam",
"TO_SPAM": "Nachricht(en) zu Spam verschieben",
"NOT_SPAM": "Kein Spam",
"USERNAME": "Nutzername",
"PASSWORD": "Passwort",
"REMEMBER": "Remember",
"REMEMBER": "Zugangsdaten merken",
"REPLY_TO": "Antwort an",
"SAVE": "Speichern",
"SAVE_CHANGES": "Änderungen speichern?",
@ -108,7 +108,7 @@
"NEW_MESSAGE_NOTIFICATION": "Sie haben %COUNT% neue Nachrichten!",
"QUOTA_SIZE": "Sie nutzen <strong>%SIZE% (%PROC%%)<\/strong> von <strong>%LIMIT%<\/strong>.",
"SORT": "Sortieren",
"NO_SORT": "Mail server does not support sorting",
"NO_SORT": "Ihr Mailserver unterstützt das Sortieren von E-Mails nicht",
"SORT_DATE_ASC": "Datum aufsteigend",
"SORT_DATE_DESC": "Datum absteigend",
"SORT_SIZE_ASC": "Größe aufsteigend",
@ -230,11 +230,11 @@
"BUTTON_REQUEST_READ_RECEIPT": "Empfangsbestätigung anfordern",
"BUTTON_MARK_AS_IMPORTANT": "Als Wichtig markieren",
"BUTTON_REQUEST_DSN": "Übermittlungsstatus anfordern",
"BUTTON_REQUIRE_TLS": "Require secure delivery",
"ERROR_EMPTY_BODY": "Message body is empty"
"BUTTON_REQUIRE_TLS": "Erzwinge sichere Übermittlung (TLS)",
"ERROR_EMPTY_BODY": "Inhalt der Nachricht ist leer"
},
"POPUPS_ASK": {
"EXIT_ARE_YOU_SURE": "Are you sure you want to exit?",
"EXIT_ARE_YOU_SURE": "Sind Sie sicher, dass Sie SnappyMail beenden möchten?",
"DESC_WANT_CLOSE_THIS_WINDOW": "Sind Sie sicher, dass Sie dieses Fenster schließen möchten?",
"DESC_WANT_DELETE_MESSAGES": "Sind Sie sicher, dass Sie diese Nachricht(en) löschen möchten?"
},
@ -318,7 +318,7 @@
"MARK_AS_READ_LABEL": "Als Gelesen markieren",
"REPLY_INTERVAL_LABEL": "Antwortintervall (Tage)",
"KEEP_LABEL": "Behalten",
"STOP_LABEL": "Stop further processing of rules",
"STOP_LABEL": "Stoppe das Abarbeiten nachfolgender Regeln",
"VACATION_SUBJECT_LABEL": "Betreff (optional)",
"VACATION_MESSAGE_LABEL": "Nachricht",
"VACATION_RECIPIENTS_LABEL": "Empfänger (durch Komma getrennt)",
@ -393,7 +393,7 @@
"LAYOUT_NO_SPLIT": "Keine Aufteilung",
"LAYOUT_VERTICAL_SPLIT": "Vertikale Aufteilung",
"LAYOUT_HORIZONTAL_SPLIT": "Horizontale Aufteilung",
"SHOW_NEXT_MESSAGE": "Show next message when (re)move current message",
"SHOW_NEXT_MESSAGE": "Zeige nächste Nachricht wenn aktuelle gelöscht oder verschoben wird",
"EDITOR": "Standard-Texteditor",
"EDITOR_HTML": "HTML",
"EDITOR_PLAIN": "Unformatierter Text",
@ -406,27 +406,27 @@
"PREFER_HTML": "HTML gegenüber Klartext bevorzugen",
"PREFER_HTML_INFO": "Nachrichten können manchmal in beiden Formaten empfangen werden. Diese Option setzt, ob die Nachricht standardmäßig in HTML oder als Klartext angezeigt wird.",
"REMOVE_COLORS": "Entferne Hintergrund- und Textfarben aus der Nachricht",
"ALLOW_STYLES": "Allow <style> CSS",
"ALLOW_STYLES": "Erlaube erweiterte Darstellungen in Nachrichten (CSS <style>)",
"MESSAGE_PER_PAGE": "Nachrichten pro Seite",
"CHECK_MAIL_INTERVAL": "Check mail interval",
"CHECK_MAIL_INTERVAL": "Prüfintervall für neue Nachrichten",
"MARK_MESSAGE_READ_AFTER": "Nachricht als gelesen markieren nach",
"MSG_DEFAULT_ACTION": "Standardaktion",
"SECONDS": "Sekunden",
"MINUTES": "minutes",
"MINUTES": "Minuten",
"NOTIFICATIONS": "Benachrichtigungen",
"SOUND_NOTIFICATION": "Benachrichtigungston",
"CHROME_NOTIFICATION_DESC": "Popups einblenden, wenn neue Nachrichten vorhanden sind",
"CHROME_NOTIFICATION_DESC_DENIED": "(Vom Browser blockiert.)",
"COLLAPSE_BLOCKQUOTES": "Collapse quoted text",
"MAX_QUOTE_LEVEL": "Maximum visible quoted text levels",
"COLLAPSE_BLOCKQUOTES": "zitierten Text ausblenden",
"MAX_QUOTE_LEVEL": "Maximal sichtbare Ebenen von zitiertem Text",
"LIST_INLINE_ATTACHMENTS": "Inline-Anhänge in der Liste anzeigen",
"LIST_SIMPLE_ATTACHMENTS": "Vereinfachte Liste der Anhänge",
"LIST_MESSAGES_GROUPED": "Nachrichten bei Sortierung nach Datum oder Absender gruppieren",
"EXTERNAL_IMAGES": "External images",
"IMAGES_OPTION_ASK": "Always ask",
"IMAGES_OPTION_WHITELIST": "Whitelist or ask",
"IMAGES_OPTION_ALWAYS": "Show always",
"IMAGES_WHITELIST": "Images whitelist"
"EXTERNAL_IMAGES": "Externe Bilder",
"IMAGES_OPTION_ASK": "Jedesmal Fragen",
"IMAGES_OPTION_WHITELIST": "Nutze Ausnahmeliste oder frage den Benutzer",
"IMAGES_OPTION_ALWAYS": "Immer anzeigen",
"IMAGES_WHITELIST": "Ausnahmeliste für Bilder"
},
"SETTINGS_CONTACTS": {
"LABEL_CONTACTS_AUTOSAVE": "Empfänger automatisch zu Ihrem Adressbuch hinzuzufügen",