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

@ -6,7 +6,7 @@ const
HASH_PREFIX = '#/',
SERVER_PREFIX = './?',
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'),
@ -75,14 +75,14 @@ export const
* @param {string} path
* @returns {string}
*/
staticLink = path => VERSION_PREFIX + 'static/' + path,
staticLink = path => VERSION_PREFIX() + 'static/' + path,
/**
* @param {string} theme
* @returns {string}
*/
themePreviewLink = theme => {
let prefix = VERSION_PREFIX;
let prefix = VERSION_PREFIX();
if ('@custom' === theme.slice(-7)) {
theme = theme.slice(0, theme.length - 7).trim();
prefix = Settings.app('webPath') || '';

View file

@ -44,7 +44,7 @@ export const
/* // Without deprecated 'unescape':
b64EncodeJSON = data => btoa(encodeURIComponent(JSON.stringify(data)).replace(
/%([0-9A-F]{2})/g, (match, p1) => String.fromCharCode('0x' + p1)
)),
)),
*/
b64EncodeJSONSafe = data => b64EncodeJSON(data).replace(/\+/g, '-').replace(/\//g, '_').replace(/=+$/, ''),

View file

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

View file

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

View file

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