Some small cleanups and fixes

This commit is contained in:
the-djmaze 2022-02-24 12:43:44 +01:00
parent e7c7b8ed53
commit 962ddde1f3
9 changed files with 34 additions and 39 deletions

View file

@ -1,6 +1,6 @@
<?php <?php
define('ROOT_DIR', dirname(__DIR__)); define('ROOT_DIR', dirname(__DIR__));
define('PLUGINS_DEST_DIR', dirname(__DIR__) . '/build/dist/releases/plugins'); define('PLUGINS_DEST_DIR', __DIR__ . '/dist/releases/plugins');
$destPath = __DIR__ . 'build/dist/releases/plugins/'; $destPath = __DIR__ . 'build/dist/releases/plugins/';
is_dir(PLUGINS_DEST_DIR) || mkdir(PLUGINS_DEST_DIR, 0777, true); is_dir(PLUGINS_DEST_DIR) || mkdir(PLUGINS_DEST_DIR, 0777, true);

View file

@ -6,7 +6,7 @@ const
HASH_PREFIX = '#/', HASH_PREFIX = '#/',
SERVER_PREFIX = './?', SERVER_PREFIX = './?',
VERSION = Settings.app('version'), VERSION = Settings.app('version'),
VERSION_PREFIX = Settings.app('webVersionPath') || 'snappymail/v/' + VERSION + '/', VERSION_PREFIX = () => Settings.app('webVersionPath') || 'snappymail/v/' + VERSION + '/',
adminPath = () => rl.adminArea() && !Settings.app('adminHostUse'), adminPath = () => rl.adminArea() && !Settings.app('adminHostUse'),
@ -75,14 +75,14 @@ export const
* @param {string} path * @param {string} path
* @returns {string} * @returns {string}
*/ */
staticLink = path => VERSION_PREFIX + 'static/' + path, staticLink = path => VERSION_PREFIX() + 'static/' + path,
/** /**
* @param {string} theme * @param {string} theme
* @returns {string} * @returns {string}
*/ */
themePreviewLink = theme => { themePreviewLink = theme => {
let prefix = VERSION_PREFIX; let prefix = VERSION_PREFIX();
if ('@custom' === theme.slice(-7)) { if ('@custom' === theme.slice(-7)) {
theme = theme.slice(0, theme.length - 7).trim(); theme = theme.slice(0, theme.length - 7).trim();
prefix = Settings.app('webPath') || ''; prefix = Settings.app('webPath') || '';

View file

@ -1,4 +1,5 @@
import { MessageFlagsCache, addRequestedMessage } from 'Common/Cache'; import { MessageFlagsCache, addRequestedMessage } from 'Common/Cache';
import { Notification } from 'Common/Enums';
import { MessageSetAction, ComposeType/*, FolderType*/ } from 'Common/EnumsUser'; import { MessageSetAction, ComposeType/*, FolderType*/ } from 'Common/EnumsUser';
import { doc, createElement, elementById } from 'Common/Globals'; import { doc, createElement, elementById } from 'Common/Globals';
import { plainToHtml } from 'Common/Html'; import { plainToHtml } from 'Common/Html';

View file

@ -1,5 +1,6 @@
import { koComputable } from 'External/ko'; import { koComputable } from 'External/ko';
import { Notification } from 'Common/Enums';
import { MessageSetAction } from 'Common/EnumsUser'; import { MessageSetAction } from 'Common/EnumsUser';
import { $htmlCL } from 'Common/Globals'; import { $htmlCL } from 'Common/Globals';
import { arrayLength, pInt, pString } from 'Common/Utils'; import { arrayLength, pInt, pString } from 'Common/Utils';

View file

@ -11,16 +11,16 @@ import { DomainAdminStore } from 'Stores/Admin/Domain';
const domainToParams = oDomain => ({ const domainToParams = oDomain => ({
Name: oDomain.name(), Name: oDomain.name(),
IncHost: oDomain.imapServer(), IncHost: oDomain.imapHost(),
IncPort: oDomain.imapPort(), IncPort: oDomain.imapPort(),
IncSecure: oDomain.imapSecure(), IncSecure: oDomain.imapSecure(),
UseSieve: oDomain.useSieve() ? 1 : 0, UseSieve: oDomain.useSieve() ? 1 : 0,
SieveHost: oDomain.sieveServer(), SieveHost: oDomain.sieveHost(),
SievePort: oDomain.sievePort(), SievePort: oDomain.sievePort(),
SieveSecure: oDomain.sieveSecure(), SieveSecure: oDomain.sieveSecure(),
OutHost: oDomain.smtpServer(), OutHost: oDomain.smtpHost(),
OutPort: oDomain.smtpPort(), OutPort: oDomain.smtpPort(),
OutSecure: oDomain.smtpSecure(), OutSecure: oDomain.smtpSecure(),
OutAuth: oDomain.smtpAuth() ? 1 : 0, OutAuth: oDomain.smtpAuth() ? 1 : 0,
@ -46,9 +46,9 @@ class DomainPopupView extends AbstractViewPopup {
testingSieveErrorDesc: '', testingSieveErrorDesc: '',
testingSmtpErrorDesc: '', testingSmtpErrorDesc: '',
imapServerFocus: false, imapHostFocus: false,
sieveServerFocus: false, sieveHostFocus: false,
smtpServerFocus: false, smtpHostFocus: false,
}); });
this.addComputables({ this.addComputables({
@ -83,10 +83,10 @@ class DomainPopupView extends AbstractViewPopup {
return ( return (
this.name() && this.name() &&
this.imapServer() && this.imapHost() &&
this.imapPort() && this.imapPort() &&
(useSieve ? this.sieveServer() && this.sievePort() : true) && (useSieve ? this.sieveHost() && this.sievePort() : true) &&
((this.smtpServer() && this.smtpPort()) || usePhpMail) ((this.smtpHost() && this.smtpPort()) || usePhpMail)
); );
}, },
@ -100,14 +100,14 @@ class DomainPopupView extends AbstractViewPopup {
testingSmtpError: value => value || this.testingSmtpErrorDesc(''), testingSmtpError: value => value || this.testingSmtpErrorDesc(''),
// smart form improvements // smart form improvements
imapServerFocus: value => imapHostFocus: value =>
value && this.name() && !this.imapServer() && this.imapServer(this.name().replace(/[.]?[*][.]?/g, '')), value && this.name() && !this.imapHost() && this.imapHost(this.name().replace(/[.]?[*][.]?/g, '')),
sieveServerFocus: value => sieveHostFocus: value =>
value && this.imapServer() && !this.sieveServer() && this.sieveServer(this.imapServer()), value && this.imapHost() && !this.sieveHost() && this.sieveHost(this.imapHost()),
smtpServerFocus: value => value && this.imapServer() && !this.smtpServer() smtpHostFocus: value => value && this.imapHost() && !this.smtpHost()
&& this.smtpServer(this.imapServer().replace(/imap/gi, 'smtp')), && this.smtpHost(this.imapHost().replace(/imap/gi, 'smtp')),
imapSecure: value => { imapSecure: value => {
if (this.enableSmartPorts()) { if (this.enableSmartPorts()) {
@ -247,15 +247,15 @@ class DomainPopupView extends AbstractViewPopup {
this.edit(true); this.edit(true);
this.name(oDomain.Name); this.name(oDomain.Name);
this.imapServer(oDomain.IncHost); this.imapHost(oDomain.IncHost);
this.imapPort('' + pInt(oDomain.IncPort)); this.imapPort('' + pInt(oDomain.IncPort));
this.imapSecure(oDomain.IncSecure); this.imapSecure(oDomain.IncSecure);
this.imapShortLogin(!!oDomain.IncShortLogin); this.imapShortLogin(!!oDomain.IncShortLogin);
this.useSieve(!!oDomain.UseSieve); this.useSieve(!!oDomain.UseSieve);
this.sieveServer(oDomain.SieveHost); this.sieveHost(oDomain.SieveHost);
this.sievePort('' + pInt(oDomain.SievePort)); this.sievePort('' + pInt(oDomain.SievePort));
this.sieveSecure(oDomain.SieveSecure); this.sieveSecure(oDomain.SieveSecure);
this.smtpServer(oDomain.OutHost); this.smtpHost(oDomain.OutHost);
this.smtpPort('' + pInt(oDomain.OutPort)); this.smtpPort('' + pInt(oDomain.OutPort));
this.smtpSecure(oDomain.OutSecure); this.smtpSecure(oDomain.OutSecure);
this.smtpShortLogin(!!oDomain.OutShortLogin); this.smtpShortLogin(!!oDomain.OutShortLogin);
@ -275,17 +275,17 @@ class DomainPopupView extends AbstractViewPopup {
name: '', name: '',
imapServer: '', imapHost: '',
imapPort: '143', imapPort: '143',
imapSecure: 0, imapSecure: 0,
imapShortLogin: false, imapShortLogin: false,
useSieve: false, useSieve: false,
sieveServer: '', sieveHost: '',
sievePort: '4190', sievePort: '4190',
sieveSecure: 0, sieveSecure: 0,
smtpServer: '', smtpHost: '',
smtpPort: '25', smtpPort: '25',
smtpSecure: 0, smtpSecure: 0,
smtpShortLogin: false, smtpShortLogin: false,

View file

@ -16,9 +16,7 @@ class Settings extends \RainLoop\Providers\AbstractProvider
public function Load(\RainLoop\Model\Account $oAccount) : \RainLoop\Settings public function Load(\RainLoop\Model\Account $oAccount) : \RainLoop\Settings
{ {
$oSettings = new \RainLoop\Settings(); return new \RainLoop\Settings($this->oDriver->Load($oAccount));
$oSettings->InitData($this->oDriver->Load($oAccount));
return $oSettings;
} }
public function Save(\RainLoop\Model\Account $oAccount, \RainLoop\Settings $oSettings) : bool public function Save(\RainLoop\Model\Account $oAccount, \RainLoop\Settings $oSettings) : bool

View file

@ -7,14 +7,9 @@ class Settings
/** /**
* @var array * @var array
*/ */
protected $aData; protected $aData = array();
public function __construct() public function __construct(array $aData)
{
$this->aData = array();
}
public function InitData(array $aData) : void
{ {
$this->aData = $aData; $this->aData = $aData;
} }

View file

@ -29,7 +29,7 @@
<span data-i18n="POPUPS_DOMAIN/LABEL_SERVER"></span> <span data-i18n="POPUPS_DOMAIN/LABEL_SERVER"></span>
<br> <br>
<input type="text" class="span3" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false" <input type="text" class="span3" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false"
data-bind="textInput: imapServer, hasfocus: imapServerFocus"> data-bind="textInput: imapHost, hasfocus: imapHostFocus">
</div> </div>
<div class="span2"> <div class="span2">
<span data-i18n="POPUPS_DOMAIN/LABEL_SECURE"></span> <span data-i18n="POPUPS_DOMAIN/LABEL_SECURE"></span>
@ -71,7 +71,7 @@
<span data-i18n="POPUPS_DOMAIN/LABEL_SERVER"></span> <span data-i18n="POPUPS_DOMAIN/LABEL_SERVER"></span>
<br> <br>
<input type="text" class="span3" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false" <input type="text" class="span3" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false"
data-bind="textInput: smtpServer, hasfocus: smtpServerFocus"> data-bind="textInput: smtpHost, hasfocus: smtpHostFocus">
</div> </div>
<div class="span2"> <div class="span2">
<span data-i18n="POPUPS_DOMAIN/LABEL_SECURE"></span> <span data-i18n="POPUPS_DOMAIN/LABEL_SECURE"></span>
@ -152,7 +152,7 @@
<span data-i18n="POPUPS_DOMAIN/LABEL_SERVER"></span> <span data-i18n="POPUPS_DOMAIN/LABEL_SERVER"></span>
<br> <br>
<input type="text" class="span3" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false" <input type="text" class="span3" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false"
data-bind="textInput: sieveServer, hasfocus: sieveServerFocus"> data-bind="textInput: sieveHost, hasfocus: sieveHostFocus">
</div> </div>
<div class="span2"> <div class="span2">
<span data-i18n="POPUPS_DOMAIN/LABEL_SECURE"></span> <span data-i18n="POPUPS_DOMAIN/LABEL_SECURE"></span>