Merge branch 'the-djmaze:master' into master

This commit is contained in:
cm-schl 2024-05-28 16:25:25 +02:00 committed by GitHub
commit caf1ee3e2a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
30 changed files with 280 additions and 109 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.2 KiB

After

Width:  |  Height:  |  Size: 2 KiB

Before After
Before After

View file

@ -10,8 +10,8 @@ class AvatarsPlugin extends \RainLoop\Plugins\AbstractPlugin
NAME = 'Avatars',
AUTHOR = 'SnappyMail',
URL = 'https://snappymail.eu/',
VERSION = '1.16',
RELEASE = '2024-03-12',
VERSION = '1.17',
RELEASE = '2024-05-26',
REQUIRED = '2.25.0',
CATEGORY = 'Contacts',
LICENSE = 'MIT',
@ -304,6 +304,7 @@ class AvatarsPlugin extends \RainLoop\Plugins\AbstractPlugin
$sDomain = \preg_replace('/^(.+\\.)?(paypal\\.[a-z][a-z])$/D', 'paypal.com', $sDomain);
$sDomain = \preg_replace('/^facebookmail.com$/D', 'facebook.com', $sDomain);
$sDomain = \preg_replace('/^dhlparcel.nl$/D', 'dhl.com', $sDomain);
$sDomain = \preg_replace('/^amazon.nl$/D', 'amazon.com', $sDomain);
$sDomain = \preg_replace('/^.+\\.([^.]+\\.[^.]+)$/D', '$1', $sDomain);
return $sDomain;
}

View file

@ -4,11 +4,11 @@ class NextcloudPlugin extends \RainLoop\Plugins\AbstractPlugin
{
const
NAME = 'Nextcloud',
VERSION = '2.35',
RELEASE = '2024-03-29',
VERSION = '2.36.2',
RELEASE = '2024-05-27',
CATEGORY = 'Integrations',
DESCRIPTION = 'Integrate with Nextcloud v20+',
REQUIRED = '2.36.0';
REQUIRED = '2.36.2';
public function Init() : void
{
@ -35,13 +35,12 @@ class NextcloudPlugin extends \RainLoop\Plugins\AbstractPlugin
$this->addTemplate('templates/PopupsNextcloudFiles.html');
$this->addTemplate('templates/PopupsNextcloudCalendars.html');
/*
$this->addHook('login.credentials.step-2', 'loginCredentials2');
$this->addHook('login.credentials', 'loginCredentials');
// $this->addHook('login.credentials.step-2', 'loginCredentials2');
// $this->addHook('login.credentials', 'loginCredentials');
$this->addHook('imap.before-login', 'beforeLogin');
$this->addHook('smtp.before-login', 'beforeLogin');
$this->addHook('sieve.before-login', 'beforeLogin');
*/
} else {
\SnappyMail\Log::debug('Nextcloud', 'NOT integrated');
// \OC::$server->getConfig()->getAppValue('snappymail', 'snappymail-no-embed');
@ -73,23 +72,24 @@ class NextcloudPlugin extends \RainLoop\Plugins\AbstractPlugin
public function loginCredentials(string &$sEmail, string &$sLogin, ?string &$sPassword = null) : void
{
$ocUser = \OC::$server->getUserSession()->getUser();
$sEmail = $ocUser->getEMailAddress() ?: $oc->user->getPrimaryEMailAddress();
$sLogin = $ocUser->getUID();
/**
* This has an issue.
* When user changes email address, all settings are gone as the new
* _data_/_default_/storage/{domain}/{local-part} is used
*/
// $ocUser = \OC::$server->getUserSession()->getUser();
// $sEmail = $ocUser->getEMailAddress() ?: $ocUser->getPrimaryEMailAddress() ?: $sEmail;
}
public function loginCredentials2(string &$sEmail, ?string &$sPassword = null) : void
{
$ocUser = \OC::$server->getUserSession()->getUser();
$sEmail = $ocUser->getEMailAddress() ?: $oc->user->getPrimaryEMailAddress();
$sEmail = $ocUser->getEMailAddress() ?: $ocUser->getPrimaryEMailAddress() ?: $sEmail;
}
public function beforeLogin(\RainLoop\Model\Account $oAccount, \MailSo\Net\NetClient $oClient, \MailSo\Net\ConnectSettings $oSettings) : void
{
$oSettings->username = \OC::$server->getUserSession()->getUser()->getUID();
/*
// https://apps.nextcloud.com/apps/oidc_login
// DISABLED https://github.com/the-djmaze/snappymail/issues/1420#issuecomment-1933045917
if (\OC::$server->getConfig()->getAppValue('snappymail', 'snappymail-autologin-oidc', false)
&& \OC::$server->getSession()->get('is_oidc')
// && $oClient->supportsAuthType('OAUTHBEARER') // v2.28
@ -100,7 +100,6 @@ class NextcloudPlugin extends \RainLoop\Plugins\AbstractPlugin
\array_unshift($oSettings->SASLMechanisms, 'OAUTHBEARER');
}
}
*/
}
/*
@ -244,7 +243,7 @@ class NextcloudPlugin extends \RainLoop\Plugins\AbstractPlugin
}
if (!$sEmail) {
$sEmail = $ocUser->getEMailAddress();
// ?: $oc->user->getPrimaryEMailAddress();
// ?: $ocUser->getPrimaryEMailAddress();
}
/*
if ($config->getAppValue('snappymail', 'snappymail-autologin-oidc', false)) {

View file

@ -6,8 +6,8 @@ class ProxyAuthPlugin extends \RainLoop\Plugins\AbstractPlugin
NAME = 'Proxy Auth',
AUTHOR = 'Philipp',
URL = 'https://www.mundhenk.org/',
VERSION = '0.3',
RELEASE = '2024-03-27',
VERSION = '0.4',
RELEASE = '2024-05-26',
REQUIRED = '2.36.1',
CATEGORY = 'Login',
LICENSE = 'MIT',
@ -118,7 +118,7 @@ class ProxyAuthPlugin extends \RainLoop\Plugins\AbstractPlugin
if ($sProxyRequest) {
/* create master user login from remote user header and settings */
$sEmail = $sRemoteUser . $sMasterSeparator . $sMasterUser;
$sPassword = \trim($this->Config()->getDecrypted('plugin', 'master_password', ''));
$sPassword = new \SnappyMail\SensitiveString(\trim($this->Config()->getDecrypted('plugin', 'master_password', '')));
try
{

View file

@ -11,11 +11,11 @@
ForwardProxyAuth = () => {
if (auto_login) {
var xhr = new XMLHttpRequest();
xhr.open("GET", "/?UserHeaderSet", true);
xhr.open("GET", "?UserHeaderSet", true);
xhr.onreadystatechange = function () {
if (xhr.readyState == 4 && xhr.status == 200) {
window.location.href = "/?ProxyAuth";
window.location.href = "?ProxyAuth";
}
};

View file

@ -11,16 +11,27 @@
dateRegEx = /(TZID=(?<tz>[^:]+):)?(?<year>[0-9]{4})(?<month>[0-9]{2})(?<day>[0-9]{2})T(?<hour>[0-9]{2})(?<minute>[0-9]{2})(?<second>[0-9]{2})(?<utc>Z?)/,
parseDate = str => {
let parts = dateRegEx.exec(str)?.groups,
options = {dateStyle: 'long', timeStyle: 'short'};
options = {dateStyle: 'long', timeStyle: 'short'},
date = (parts ? new Date(
parseInt(parts.year, 10),
parseInt(parts.month, 10) - 1,
parseInt(parts.day, 10),
parseInt(parts.hour, 10),
parseInt(parts.minute, 10),
parseInt(parts.second, 10)
) : new Date(str));
parts?.tz && (options.timeZone = parts.tz);
return (parts ? new Date(
parseInt(parts.year, 10),
parseInt(parts.month, 10) - 1,
parseInt(parts.day, 10),
parseInt(parts.hour, 10),
parseInt(parts.minute, 10),
parseInt(parts.second, 10)
) : new Date(str)).format(options);
try {
return date.format(options);
} catch (e) {
console.error(e);
if (options.timeZone) {
// TODO: handle messy vtimezones
// VTIMEZONEs[options.timeZone];
options.timeZone = undefined;
return date.format(options);
}
}
};
attachmentsPlace.after(Element.fromHTML(`