Improve Settings handling

This commit is contained in:
djmaze 2021-03-10 11:44:48 +01:00
parent e7b1ce7509
commit 34b25eedea
39 changed files with 160 additions and 150 deletions

View file

@ -2,6 +2,7 @@ import 'External/Admin/ko';
import ko from 'ko'; import ko from 'ko';
import { StorageResultType } from 'Common/Enums'; import { StorageResultType } from 'Common/Enums';
import { Settings, SettingsGet } from 'Common/Globals';
import { AppAdminStore } from 'Stores/Admin/App'; import { AppAdminStore } from 'Stores/Admin/App';
import { CapaAdminStore } from 'Stores/Admin/Capa'; import { CapaAdminStore } from 'Stores/Admin/Capa';
@ -103,11 +104,11 @@ class AdminApp extends AbstractApp {
this.hideLoading(); this.hideLoading();
if (!rl.settings.app('allowAdminPanel')) { if (!Settings.app('allowAdminPanel')) {
rl.route.root(); rl.route.root();
setTimeout(() => location.href = '/', 1); setTimeout(() => location.href = '/', 1);
} else { } else {
if (rl.settings.get('Auth')) { if (SettingsGet('Auth')) {
startScreens([SettingsAdminScreen]); startScreens([SettingsAdminScreen]);
} else { } else {
startScreens([LoginAdminScreen]); startScreens([LoginAdminScreen]);

View file

@ -24,6 +24,7 @@ import {
createElement, createElement,
$htmlCL, $htmlCL,
Settings, Settings,
SettingsGet,
leftPanelDisabled leftPanelDisabled
} from 'Common/Globals'; } from 'Common/Globals';
@ -116,9 +117,9 @@ class AppUser extends AbstractApp {
this.reload(); this.reload();
} }
if (Settings.get('UserBackgroundHash')) { if (SettingsGet('UserBackgroundHash')) {
setTimeout(() => { setTimeout(() => {
const img = userBackground(Settings.get('UserBackgroundHash')); const img = userBackground(SettingsGet('UserBackgroundHash'));
if (img) { if (img) {
$htmlCL.add('UserBackground'); $htmlCL.add('UserBackground');
doc.body.style.backgroundImage = "url("+img+")"; doc.body.style.backgroundImage = "url("+img+")";
@ -485,7 +486,7 @@ class AppUser extends AbstractApp {
if (StorageResultType.Success === sResult && oData.Result) { if (StorageResultType.Success === sResult && oData.Result) {
const counts = {}, const counts = {},
sAccountEmail = AccountStore.email(); sAccountEmail = AccountStore.email();
let parentEmail = Settings.get('ParentEmail') || sAccountEmail; let parentEmail = SettingsGet('ParentEmail') || sAccountEmail;
if (Array.isArray(oData.Result.Accounts)) { if (Array.isArray(oData.Result.Accounts)) {
AccountStore.accounts.forEach(oAccount => AccountStore.accounts.forEach(oAccount =>
@ -887,7 +888,7 @@ class AppUser extends AbstractApp {
} }
logout() { logout() {
Remote.logout(() => this.logoutReload(0 < (Settings.get('ParentEmail')||{length:0}).length)); Remote.logout(() => this.logoutReload(0 < (SettingsGet('ParentEmail')||{length:0}).length));
} }
bootend() { bootend() {
@ -906,18 +907,18 @@ class AppUser extends AbstractApp {
AccountStore.populate(); AccountStore.populate();
ContactStore.populate(); ContactStore.populate();
let contactsSyncInterval = pInt(Settings.get('ContactsSyncInterval')); let contactsSyncInterval = pInt(SettingsGet('ContactsSyncInterval'));
const startupUrl = pString(Settings.get('StartupUrl')); const startupUrl = pString(SettingsGet('StartupUrl'));
progressJs.set(90); progressJs.set(90);
rl.setWindowTitle(); rl.setWindowTitle();
if (Settings.get('Auth')) { if (SettingsGet('Auth')) {
if ( if (
Settings.capa(Capa.TwoFactor) && Settings.capa(Capa.TwoFactor) &&
Settings.capa(Capa.TwoFactorForce) && Settings.capa(Capa.TwoFactorForce) &&
Settings.get('RequireTwoFactor') SettingsGet('RequireTwoFactor')
) { ) {
this.bootend(); this.bootend();
showScreenPopup(TwoFactorConfigurationPopupView, [true]); showScreenPopup(TwoFactorConfigurationPopupView, [true]);
@ -1010,7 +1011,7 @@ class AppUser extends AbstractApp {
// When auto-login is active // When auto-login is active
if ( if (
Settings.get('AccountSignMe') && !!SettingsGet('AccountSignMe') &&
navigator.registerProtocolHandler && navigator.registerProtocolHandler &&
Settings.capa(Capa.Composer) Settings.capa(Capa.Composer)
) { ) {
@ -1019,12 +1020,12 @@ class AppUser extends AbstractApp {
navigator.registerProtocolHandler( navigator.registerProtocolHandler(
'mailto', 'mailto',
location.protocol + '//' + location.host + location.pathname + '?mailto&to=%s', location.protocol + '//' + location.host + location.pathname + '?mailto&to=%s',
(Settings.get('Title') || 'SnappyMail') (SettingsGet('Title') || 'SnappyMail')
); );
} catch (e) {} // eslint-disable-line no-empty } catch (e) {} // eslint-disable-line no-empty
if (Settings.get('MailToEmail')) { if (SettingsGet('MailToEmail')) {
mailToHelper(Settings.get('MailToEmail')); mailToHelper(SettingsGet('MailToEmail'));
} }
}, 500); }, 500);
} }

View file

@ -8,6 +8,7 @@ export const $htmlCL = doc.documentElement.classList;
export const elementById = id => doc.getElementById(id); export const elementById = id => doc.getElementById(id);
export const Settings = rl.settings; export const Settings = rl.settings;
export const SettingsGet = rl.settings.get;
export const dropdownVisibility = ko.observable(false).extend({ rateLimit: 0 }); export const dropdownVisibility = ko.observable(false).extend({ rateLimit: 0 });

View file

@ -1,5 +1,5 @@
import { pString, pInt } from 'Common/Utils'; import { pString, pInt } from 'Common/Utils';
import { Settings } from 'Common/Globals'; import { Settings, SettingsGet } from 'Common/Globals';
const const
ROOT = './', ROOT = './',
@ -8,7 +8,7 @@ const
VERSION = Settings.app('version'), VERSION = Settings.app('version'),
VERSION_PREFIX = Settings.app('webVersionPath') || 'snappymail/v/' + VERSION + '/', VERSION_PREFIX = Settings.app('webVersionPath') || 'snappymail/v/' + VERSION + '/',
getHash = () => Settings.get('AuthAccountHash') || '0'; getHash = () => SettingsGet('AuthAccountHash') || '0';
/** /**
* @returns {string} * @returns {string}

View file

@ -1,4 +1,5 @@
import { settingsAddViewModel } from 'Screen/AbstractSettings'; import { settingsAddViewModel } from 'Screen/AbstractSettings';
import { SettingsGet } from 'Common/Globals';
const USER_VIEW_MODELS_HOOKS = [], const USER_VIEW_MODELS_HOOKS = [],
ADMIN_VIEW_MODELS_HOOKS = []; ADMIN_VIEW_MODELS_HOOKS = [];
@ -48,7 +49,7 @@ export function runSettingsViewModelHooks(admin) {
* @returns {?} * @returns {?}
*/ */
rl.pluginSettingsGet = (pluginSection, name) => { rl.pluginSettingsGet = (pluginSection, name) => {
let plugins = rl.settings.get('Plugins'); let plugins = SettingsGet('Plugins');
plugins = plugins && null != plugins[pluginSection] ? plugins[pluginSection] : null; plugins = plugins && null != plugins[pluginSection] ? plugins[pluginSection] : null;
return plugins ? (null == plugins[name] ? null : plugins[name]) : null; return plugins ? (null == plugins[name] ? null : plugins[name]) : null;
}; };

View file

@ -504,5 +504,5 @@ export function mailToHelper(mailToUrl) {
export function showMessageComposer(params = []) export function showMessageComposer(params = [])
{ {
rl.app.showScreenPopup(params); rl.app.showMessageComposer(params);
} }

View file

@ -4,7 +4,7 @@ import { UNUSED_OPTION_VALUE } from 'Common/Consts';
import { pInt } from 'Common/Utils'; import { pInt } from 'Common/Utils';
import { ClientSideKeyName, FolderType } from 'Common/EnumsUser'; import { ClientSideKeyName, FolderType } from 'Common/EnumsUser';
import * as Cache from 'Common/Cache'; import * as Cache from 'Common/Cache';
import { Settings } from 'Common/Globals'; import { Settings, SettingsGet } from 'Common/Globals';
import * as Local from 'Storage/Client'; import * as Local from 'Storage/Client';
@ -119,12 +119,12 @@ export class FolderCollectionModel extends AbstractCollectionModel
if ( if (
this.SystemFolders && this.SystemFolders &&
!('' + !('' +
Settings.get('SentFolder') + SettingsGet('SentFolder') +
Settings.get('DraftFolder') + SettingsGet('DraftFolder') +
Settings.get('SpamFolder') + SettingsGet('SpamFolder') +
Settings.get('TrashFolder') + SettingsGet('TrashFolder') +
Settings.get('ArchiveFolder') + SettingsGet('ArchiveFolder') +
Settings.get('NullFolder')) SettingsGet('NullFolder'))
) { ) {
Settings.set('SentFolder', this.SystemFolders[ServerFolderType.SENT] || null); Settings.set('SentFolder', this.SystemFolders[ServerFolderType.SENT] || null);
Settings.set('DraftFolder', this.SystemFolders[ServerFolderType.DRAFTS] || null); Settings.set('DraftFolder', this.SystemFolders[ServerFolderType.DRAFTS] || null);
@ -135,11 +135,11 @@ export class FolderCollectionModel extends AbstractCollectionModel
update = true; update = true;
} }
FolderStore.sentFolder(normalizeFolder(Settings.get('SentFolder'))); FolderStore.sentFolder(normalizeFolder(SettingsGet('SentFolder')));
FolderStore.draftFolder(normalizeFolder(Settings.get('DraftFolder'))); FolderStore.draftFolder(normalizeFolder(SettingsGet('DraftFolder')));
FolderStore.spamFolder(normalizeFolder(Settings.get('SpamFolder'))); FolderStore.spamFolder(normalizeFolder(SettingsGet('SpamFolder')));
FolderStore.trashFolder(normalizeFolder(Settings.get('TrashFolder'))); FolderStore.trashFolder(normalizeFolder(SettingsGet('TrashFolder')));
FolderStore.archiveFolder(normalizeFolder(Settings.get('ArchiveFolder'))); FolderStore.archiveFolder(normalizeFolder(SettingsGet('ArchiveFolder')));
if (update) { if (update) {
rl.app.Remote.saveSystemFolders(()=>{}, { rl.app.Remote.saveSystemFolders(()=>{}, {
@ -301,7 +301,7 @@ export class FolderModel extends AbstractModel {
canBeDeleted: () => !folder.isSystemFolder() && !folder.subFolders.length, canBeDeleted: () => !folder.isSystemFolder() && !folder.subFolders.length,
canBeSubscribed: () => !folder.isSystemFolder() && folder.selectable && rl.settings.app('useImapSubscribe'), canBeSubscribed: () => !folder.isSystemFolder() && folder.selectable && Settings.app('useImapSubscribe'),
canBeSelected: () => !folder.isSystemFolder() && folder.selectable, canBeSelected: () => !folder.isSystemFolder() && folder.selectable,

View file

@ -1,4 +1,5 @@
import { StorageResultType, Notification } from 'Common/Enums'; import { StorageResultType, Notification } from 'Common/Enums';
import { Settings } from 'Common/Globals';
import { pInt, pString } from 'Common/Utils'; import { pInt, pString } from 'Common/Utils';
import { serverRequest } from 'Common/Links'; import { serverRequest } from 'Common/Links';
@ -11,7 +12,7 @@ const getURL = (add = '') => serverRequest('Json') + add,
updateToken = data => { updateToken = data => {
if (data.UpdateToken) { if (data.UpdateToken) {
rl.hash.set(); rl.hash.set();
rl.settings.set('AuthAccountHash', data.UpdateToken); Settings.set('AuthAccountHash', data.UpdateToken);
} }
}, },

View file

@ -8,6 +8,7 @@ import {
MessageFlagsCache MessageFlagsCache
} from 'Common/Cache'; } from 'Common/Cache';
import { SettingsGet } from 'Common/Globals';
import { SUB_QUERY_PREFIX } from 'Common/Links'; import { SUB_QUERY_PREFIX } from 'Common/Links';
import AppStore from 'Stores/User/App'; import AppStore from 'Stores/User/App';
@ -31,16 +32,15 @@ class RemoteUserFetch extends AbstractFetchRemote {
* @param {?Function} fCallback * @param {?Function} fCallback
*/ */
folders(fCallback) { folders(fCallback) {
const settingsGet = rl.settings.get;
this.defaultRequest( this.defaultRequest(
fCallback, fCallback,
'Folders', 'Folders',
{ {
SentFolder: settingsGet('SentFolder'), SentFolder: SettingsGet('SentFolder'),
DraftFolder: settingsGet('DraftFolder'), DraftFolder: SettingsGet('DraftFolder'),
SpamFolder: settingsGet('SpamFolder'), SpamFolder: SettingsGet('SpamFolder'),
TrashFolder: settingsGet('TrashFolder'), TrashFolder: SettingsGet('TrashFolder'),
ArchiveFolder: settingsGet('ArchiveFolder') ArchiveFolder: SettingsGet('ArchiveFolder')
}, },
null, null,
'', '',

View file

@ -1,7 +1,8 @@
import ko from 'ko'; import ko from 'ko';
import { Settings } from 'Common/Globals';
export class AboutAdminSettings { export class AboutAdminSettings {
constructor() { constructor() {
this.version = ko.observable(rl.settings.app('version')); this.version = ko.observable(Settings.app('version'));
} }
} }

View file

@ -1,15 +1,15 @@
import ko from 'ko'; import ko from 'ko';
import { SettingsGet } from 'Common/Globals';
import { settingsSaveHelperSimpleFunction } from 'Common/Utils'; import { settingsSaveHelperSimpleFunction } from 'Common/Utils';
import Remote from 'Remote/Admin/Fetch'; import Remote from 'Remote/Admin/Fetch';
export class BrandingAdminSettings { export class BrandingAdminSettings {
constructor() { constructor() {
const settingsGet = rl.settings.get; this.title = ko.observable(SettingsGet('Title')).idleTrigger();
this.title = ko.observable(settingsGet('Title')).idleTrigger(); this.loadingDesc = ko.observable(SettingsGet('LoadingDescription')).idleTrigger();
this.loadingDesc = ko.observable(settingsGet('LoadingDescription')).idleTrigger(); this.faviconUrl = ko.observable(SettingsGet('FaviconUrl')).idleTrigger();
this.faviconUrl = ko.observable(settingsGet('FaviconUrl')).idleTrigger();
} }
onBuild() { onBuild() {

View file

@ -1,25 +1,24 @@
import ko from 'ko'; import ko from 'ko';
import { SaveSettingsStep, StorageResultType } from 'Common/Enums';
import { SettingsGet } from 'Common/Globals';
import { settingsSaveHelperSimpleFunction, defaultOptionsAfterRender } from 'Common/Utils'; import { settingsSaveHelperSimpleFunction, defaultOptionsAfterRender } from 'Common/Utils';
import { SaveSettingsStep, StorageResultType } from 'Common/Enums';
import Remote from 'Remote/Admin/Fetch'; import Remote from 'Remote/Admin/Fetch';
import { decorateKoCommands } from 'Knoin/Knoin'; import { decorateKoCommands } from 'Knoin/Knoin';
const settingsGet = rl.settings.get;
export class ContactsAdminSettings { export class ContactsAdminSettings {
constructor() { constructor() {
this.defaultOptionsAfterRender = defaultOptionsAfterRender; this.defaultOptionsAfterRender = defaultOptionsAfterRender;
ko.addObservablesTo(this, { ko.addObservablesTo(this, {
enableContacts: !!settingsGet('ContactsEnable'), enableContacts: !!SettingsGet('ContactsEnable'),
contactsSync: !!settingsGet('ContactsSync'), contactsSync: !!SettingsGet('ContactsSync'),
contactsType: '', contactsType: '',
pdoDsn: settingsGet('ContactsPdoDsn'), pdoDsn: SettingsGet('ContactsPdoDsn'),
pdoUser: settingsGet('ContactsPdoUser'), pdoUser: SettingsGet('ContactsPdoUser'),
pdoPassword: settingsGet('ContactsPdoPassword'), pdoPassword: SettingsGet('ContactsPdoPassword'),
pdoDsnTrigger: SaveSettingsStep.Idle, pdoDsnTrigger: SaveSettingsStep.Idle,
pdoUserTrigger: SaveSettingsStep.Idle, pdoUserTrigger: SaveSettingsStep.Idle,
@ -32,7 +31,7 @@ export class ContactsAdminSettings {
testContactsErrorMessage: '' testContactsErrorMessage: ''
}); });
const supportedTypes = settingsGet('supportedPdoDrivers') || [], const supportedTypes = SettingsGet('supportedPdoDrivers') || [],
types = [{ types = [{
id:'sqlite', id:'sqlite',
name:'SQLite' name:'SQLite'
@ -71,7 +70,7 @@ export class ContactsAdminSettings {
this.testContactsErrorMessage(''); this.testContactsErrorMessage('');
}); });
this.contactsType(settingsGet('ContactsPdoType')); this.contactsType(SettingsGet('ContactsPdoType'));
this.onTestContactsResponse = this.onTestContactsResponse.bind(this); this.onTestContactsResponse = this.onTestContactsResponse.bind(this);
@ -162,7 +161,7 @@ export class ContactsAdminSettings {
}); });
}); });
this.contactsType(settingsGet('ContactsPdoType')); this.contactsType(SettingsGet('ContactsPdoType'));
}, 50); }, 50);
} }
} }

View file

@ -8,6 +8,7 @@ import {
} from 'Common/Utils'; } from 'Common/Utils';
import { SaveSettingsStep } from 'Common/Enums'; import { SaveSettingsStep } from 'Common/Enums';
import { Settings, SettingsGet } from 'Common/Globals';
import { reload as translatorReload, convertLangName } from 'Common/Translator'; import { reload as translatorReload, convertLangName } from 'Common/Translator';
import { showScreenPopup } from 'Knoin/Knoin'; import { showScreenPopup } from 'Knoin/Knoin';
@ -20,17 +21,15 @@ import { AppAdminStore } from 'Stores/Admin/App';
import { CapaAdminStore } from 'Stores/Admin/Capa'; import { CapaAdminStore } from 'Stores/Admin/Capa';
import LanguagesPopupView from 'View/Popup/Languages'; import LanguagesPopupView from 'View/Popup/Languages';
const settingsGet = rl.settings.get;
export class GeneralAdminSettings { export class GeneralAdminSettings {
constructor() { constructor() {
this.language = LanguageStore.language; this.language = LanguageStore.language;
this.languages = LanguageStore.languages; this.languages = LanguageStore.languages;
const aLanguagesAdmin = rl.settings.app('languagesAdmin'); const aLanguagesAdmin = Settings.app('languagesAdmin');
this.languagesAdmin = ko.observableArray(Array.isArray(aLanguagesAdmin) ? aLanguagesAdmin : []); this.languagesAdmin = ko.observableArray(Array.isArray(aLanguagesAdmin) ? aLanguagesAdmin : []);
this.languageAdmin = ko this.languageAdmin = ko
.observable(settingsGet('LanguageAdmin')) .observable(SettingsGet('LanguageAdmin'))
.extend({ limitedList: this.languagesAdmin }); .extend({ limitedList: this.languagesAdmin });
this.theme = ThemeStore.theme; this.theme = ThemeStore.theme;
@ -44,8 +43,8 @@ export class GeneralAdminSettings {
this.capaTemplates = CapaAdminStore.templates; this.capaTemplates = CapaAdminStore.templates;
ko.addObservablesTo(this, { ko.addObservablesTo(this, {
allowLanguagesOnSettings: !!settingsGet('AllowLanguagesOnSettings'), allowLanguagesOnSettings: !!SettingsGet('AllowLanguagesOnSettings'),
newMoveToFolder: !!settingsGet('NewMoveToFolder'), newMoveToFolder: !!SettingsGet('NewMoveToFolder'),
attachmentLimitTrigger: SaveSettingsStep.Idle, attachmentLimitTrigger: SaveSettingsStep.Idle,
languageTrigger: SaveSettingsStep.Idle, languageTrigger: SaveSettingsStep.Idle,
themeTrigger: SaveSettingsStep.Idle themeTrigger: SaveSettingsStep.Idle
@ -56,10 +55,10 @@ export class GeneralAdminSettings {
this.dataFolderAccess = AppAdminStore.dataFolderAccess; this.dataFolderAccess = AppAdminStore.dataFolderAccess;
this.mainAttachmentLimit = ko this.mainAttachmentLimit = ko
.observable(pInt(settingsGet('AttachmentLimit')) / (1024 * 1024)) .observable(pInt(SettingsGet('AttachmentLimit')) / (1024 * 1024))
.extend({ debounce: 500 }); .extend({ debounce: 500 });
this.uploadData = settingsGet('PhpUploadSizes'); this.uploadData = SettingsGet('PhpUploadSizes');
this.uploadDataDesc = this.uploadDataDesc =
this.uploadData && (this.uploadData.upload_max_filesize || this.uploadData.post_max_size) this.uploadData && (this.uploadData.upload_max_filesize || this.uploadData.post_max_size)
? [ ? [
@ -178,7 +177,7 @@ export class GeneralAdminSettings {
showScreenPopup(LanguagesPopupView, [ showScreenPopup(LanguagesPopupView, [
this.languageAdmin, this.languageAdmin,
this.languagesAdmin(), this.languagesAdmin(),
settingsGet('UserLanguageAdmin') SettingsGet('UserLanguageAdmin')
]); ]);
} }
} }

View file

@ -1,20 +1,20 @@
import ko from 'ko'; import ko from 'ko';
import { Settings, SettingsGet } from 'Common/Globals';
import { settingsSaveHelperSimpleFunction } from 'Common/Utils'; import { settingsSaveHelperSimpleFunction } from 'Common/Utils';
import Remote from 'Remote/Admin/Fetch'; import Remote from 'Remote/Admin/Fetch';
export class LoginAdminSettings { export class LoginAdminSettings {
constructor() { constructor() {
const settingsGet = rl.settings.get;
ko.addObservablesTo(this, { ko.addObservablesTo(this, {
determineUserLanguage: !!settingsGet('DetermineUserLanguage'), determineUserLanguage: !!SettingsGet('DetermineUserLanguage'),
determineUserDomain: !!settingsGet('DetermineUserDomain'), determineUserDomain: !!SettingsGet('DetermineUserDomain'),
allowLanguagesOnLogin: !!settingsGet('AllowLanguagesOnLogin'), allowLanguagesOnLogin: !!SettingsGet('AllowLanguagesOnLogin'),
hideSubmitButton: !!rl.settings.app('hideSubmitButton') hideSubmitButton: !!Settings.app('hideSubmitButton')
}); });
this.defaultDomain = ko.observable(settingsGet('LoginDefaultDomain')).idleTrigger(); this.defaultDomain = ko.observable(SettingsGet('LoginDefaultDomain')).idleTrigger();
} }
onBuild() { onBuild() {

View file

@ -1,6 +1,7 @@
import ko from 'ko'; import ko from 'ko';
import { StorageResultType, Notification } from 'Common/Enums'; import { StorageResultType, Notification } from 'Common/Enums';
import { SettingsGet } from 'Common/Globals';
import { getNotification } from 'Common/Translator'; import { getNotification } from 'Common/Translator';
import { showScreenPopup } from 'Knoin/Knoin'; import { showScreenPopup } from 'Knoin/Knoin';
@ -13,7 +14,7 @@ import { PluginPopupView } from 'View/Popup/Plugin';
export class PluginsAdminSettings { export class PluginsAdminSettings {
constructor() { constructor() {
this.enabledPlugins = ko.observable(!!rl.settings.get('EnabledPlugins')); this.enabledPlugins = ko.observable(!!SettingsGet('EnabledPlugins'));
this.plugins = PluginAdminStore; this.plugins = PluginAdminStore;
this.pluginsError = PluginAdminStore.error; this.pluginsError = PluginAdminStore.error;

View file

@ -1,6 +1,7 @@
import ko from 'ko'; import ko from 'ko';
import { StorageResultType } from 'Common/Enums'; import { StorageResultType } from 'Common/Enums';
import { SettingsGet } from 'Common/Globals';
import { AppAdminStore } from 'Stores/Admin/App'; import { AppAdminStore } from 'Stores/Admin/App';
import { CapaAdminStore } from 'Stores/Admin/Capa'; import { CapaAdminStore } from 'Stores/Admin/Capa';
@ -9,8 +10,6 @@ import Remote from 'Remote/Admin/Fetch';
import { decorateKoCommands } from 'Knoin/Knoin'; import { decorateKoCommands } from 'Knoin/Knoin';
const settingsGet = rl.settings.get;
export class SecurityAdminSettings { export class SecurityAdminSettings {
constructor() { constructor() {
this.weakPassword = AppAdminStore.weakPassword; this.weakPassword = AppAdminStore.weakPassword;
@ -21,16 +20,16 @@ export class SecurityAdminSettings {
this.capaTwoFactorAuthForce = CapaAdminStore.twoFactorAuthForce; this.capaTwoFactorAuthForce = CapaAdminStore.twoFactorAuthForce;
ko.addObservablesTo(this, { ko.addObservablesTo(this, {
useLocalProxyForExternalImages: !!rl.settings.get('UseLocalProxyForExternalImages'), useLocalProxyForExternalImages: !!SettingsGet('UseLocalProxyForExternalImages'),
verifySslCertificate: !!settingsGet('VerifySslCertificate'), verifySslCertificate: !!SettingsGet('VerifySslCertificate'),
allowSelfSigned: !!settingsGet('AllowSelfSigned'), allowSelfSigned: !!SettingsGet('AllowSelfSigned'),
isTwoFactorDropperShown: false, isTwoFactorDropperShown: false,
twoFactorDropperUser: '', twoFactorDropperUser: '',
twoFactorDropperUserFocused: false, twoFactorDropperUserFocused: false,
adminLogin: settingsGet('AdminLogin'), adminLogin: SettingsGet('AdminLogin'),
adminLoginError: false, adminLoginError: false,
adminPassword: '', adminPassword: '',
adminPasswordNew: '', adminPasswordNew: '',

View file

@ -1,6 +1,7 @@
import ko from 'ko'; import ko from 'ko';
import { Capa, StorageResultType } from 'Common/Enums'; import { Capa, StorageResultType } from 'Common/Enums';
import { Settings } from 'Common/Globals';
import AccountStore from 'Stores/User/Account'; import AccountStore from 'Stores/User/Account';
import { IdentityUserStore } from 'Stores/User/Identity'; import { IdentityUserStore } from 'Stores/User/Identity';
@ -13,8 +14,8 @@ import { IdentityPopupView } from 'View/Popup/Identity';
export class AccountsUserSettings { export class AccountsUserSettings {
constructor() { constructor() {
this.allowAdditionalAccount = rl.settings.capa(Capa.AdditionalAccounts); this.allowAdditionalAccount = Settings.capa(Capa.AdditionalAccounts);
this.allowIdentities = rl.settings.capa(Capa.Identities); this.allowIdentities = Settings.capa(Capa.Identities);
this.accounts = AccountStore.accounts; this.accounts = AccountStore.accounts;
this.identities = IdentityUserStore; this.identities = IdentityUserStore;

View file

@ -1,12 +1,10 @@
import ko from 'ko'; import ko from 'ko';
import { MESSAGES_PER_PAGE_VALUES } from 'Common/Consts'; import { MESSAGES_PER_PAGE_VALUES } from 'Common/Consts';
import { SaveSettingsStep } from 'Common/Enums'; import { SaveSettingsStep } from 'Common/Enums';
import { EditorDefaultType, Layout } from 'Common/EnumsUser'; import { EditorDefaultType, Layout } from 'Common/EnumsUser';
import { SettingsGet } from 'Common/Globals';
import { settingsSaveHelperSimpleFunction } from 'Common/Utils'; import { settingsSaveHelperSimpleFunction } from 'Common/Utils';
import { i18n, trigger as translatorTrigger, reload as translatorReload, convertLangName } from 'Common/Translator'; import { i18n, trigger as translatorTrigger, reload as translatorReload, convertLangName } from 'Common/Translator';
import { showScreenPopup } from 'Knoin/Knoin'; import { showScreenPopup } from 'Knoin/Knoin';
@ -44,7 +42,7 @@ export class GeneralUserSettings {
this.threadsAllowed = AppStore.threadsAllowed; this.threadsAllowed = AppStore.threadsAllowed;
this.useThreads = SettingsStore.useThreads; this.useThreads = SettingsStore.useThreads;
this.replySameFolder = SettingsStore.replySameFolder; this.replySameFolder = SettingsStore.replySameFolder;
this.allowLanguagesOnSettings = !!rl.settings.get('AllowLanguagesOnSettings'); this.allowLanguagesOnSettings = !!SettingsGet('AllowLanguagesOnSettings');
this.languageFullName = ko.computed(() => convertLangName(this.language())); this.languageFullName = ko.computed(() => convertLangName(this.language()));
this.languageTrigger = ko.observable(SaveSettingsStep.Idle).extend({ debounce: 100 }); this.languageTrigger = ko.observable(SaveSettingsStep.Idle).extend({ debounce: 100 });

View file

@ -2,6 +2,7 @@ import ko from 'ko';
import { pInt, settingsSaveHelperSimpleFunction } from 'Common/Utils'; import { pInt, settingsSaveHelperSimpleFunction } from 'Common/Utils';
import { Capa, SaveSettingsStep } from 'Common/Enums'; import { Capa, SaveSettingsStep } from 'Common/Enums';
import { Settings } from 'Common/Globals';
import { i18n, trigger as translatorTrigger } from 'Common/Translator'; import { i18n, trigger as translatorTrigger } from 'Common/Translator';
import { showScreenPopup } from 'Knoin/Knoin'; import { showScreenPopup } from 'Knoin/Knoin';
@ -14,8 +15,8 @@ import { TwoFactorConfigurationPopupView } from 'View/Popup/TwoFactorConfigurati
export class SecurityUserSettings { export class SecurityUserSettings {
constructor() { constructor() {
this.capaAutoLogout = rl.settings.capa(Capa.AutoLogout); this.capaAutoLogout = Settings.capa(Capa.AutoLogout);
this.capaTwoFactor = rl.settings.capa(Capa.TwoFactor); this.capaTwoFactor = Settings.capa(Capa.TwoFactor);
this.autoLogout = SettinsStore.autoLogout; this.autoLogout = SettinsStore.autoLogout;
this.autoLogout.trigger = ko.observable(SaveSettingsStep.Idle); this.autoLogout.trigger = ko.observable(SaveSettingsStep.Idle);

View file

@ -4,7 +4,7 @@ import { SaveSettingsStep, UploadErrorCode, Capa } from 'Common/Enums';
import { changeTheme, convertThemeName } from 'Common/Utils'; import { changeTheme, convertThemeName } from 'Common/Utils';
import { userBackground, themePreviewLink, serverRequest } from 'Common/Links'; import { userBackground, themePreviewLink, serverRequest } from 'Common/Links';
import { i18n } from 'Common/Translator'; import { i18n } from 'Common/Translator';
import { doc, $htmlCL } from 'Common/Globals'; import { doc, $htmlCL, Settings } from 'Common/Globals';
import { ThemeStore } from 'Stores/Theme'; import { ThemeStore } from 'Stores/Theme';
@ -23,7 +23,7 @@ export class ThemesUserSettings {
this.background.loading = ko.observable(false); this.background.loading = ko.observable(false);
this.background.error = ko.observable(''); this.background.error = ko.observable('');
this.capaUserBackground = ko.observable(rl.settings.capa(Capa.UserBackground)); this.capaUserBackground = ko.observable(Settings.capa(Capa.UserBackground));
this.themeTrigger = ko.observable(SaveSettingsStep.Idle).extend({ debounce: 100 }); this.themeTrigger = ko.observable(SaveSettingsStep.Idle).extend({ debounce: 100 });

View file

@ -1,13 +1,14 @@
import ko from 'ko'; import ko from 'ko';
import { SettingsGet } from 'Common/Globals';
export const AppAdminStore = { export const AppAdminStore = {
weakPassword: ko.observable(false), weakPassword: ko.observable(false),
dataFolderAccess: ko.observable(false), dataFolderAccess: ko.observable(false),
populate: function() { populate: function() {
this.weakPassword(!!rl.settings.get('WeakPassword')); this.weakPassword(!!SettingsGet('WeakPassword'));
/* /*
rl.settings.get('WeakPassword') SettingsGet('WeakPassword')
&& fetch('./data/VERSION?' + Math.random()).then(() => this.dataFolderAccess(true)); && fetch('./data/VERSION?' + Math.random()).then(() => this.dataFolderAccess(true));
*/ */
} }

View file

@ -1,9 +1,10 @@
import ko from 'ko'; import ko from 'ko';
import { Capa } from 'Common/Enums'; import { Capa } from 'Common/Enums';
import { Settings } from 'Common/Globals';
export const CapaAdminStore = { export const CapaAdminStore = {
populate: function() { populate: function() {
let capa = rl.settings.capa; const capa = Settings.capa;
this.additionalAccounts(capa(Capa.AdditionalAccounts)); this.additionalAccounts(capa(Capa.AdditionalAccounts));
this.identities(capa(Capa.Identities)); this.identities(capa(Capa.Identities));
this.attachmentThumbnails(capa(Capa.AttachmentThumbnails)); this.attachmentThumbnails(capa(Capa.AttachmentThumbnails));

View file

@ -1,15 +1,15 @@
import ko from 'ko'; import ko from 'ko';
import { Settings, SettingsGet } from 'Common/Globals';
export const LanguageStore = { export const LanguageStore = {
languages: ko.observableArray(), languages: ko.observableArray(),
userLanguage: ko.observable(''), userLanguage: ko.observable(''),
populate: function() { populate: function() {
const Settings = rl.settings, const aLanguages = Settings.app('languages');
aLanguages = Settings.app('languages');
this.languages(Array.isArray(aLanguages) ? aLanguages : []); this.languages(Array.isArray(aLanguages) ? aLanguages : []);
this.language(Settings.get('Language')); this.language(SettingsGet('Language'));
this.userLanguage(Settings.get('UserLanguage')); this.userLanguage(SettingsGet('UserLanguage'));
} }
} }

View file

@ -1,5 +1,5 @@
import ko from 'ko'; import ko from 'ko';
import { $htmlCL, leftPanelDisabled } from 'Common/Globals'; import { $htmlCL, leftPanelDisabled, Settings, SettingsGet } from 'Common/Globals';
export const ThemeStore = { export const ThemeStore = {
themes: ko.observableArray(), themes: ko.observableArray(),
@ -8,14 +8,13 @@ export const ThemeStore = {
isMobile: ko.observable($htmlCL.contains('rl-mobile')), isMobile: ko.observable($htmlCL.contains('rl-mobile')),
populate: function(){ populate: function(){
const Settings = rl.settings, const themes = Settings.app('themes');
themes = Settings.app('themes');
this.themes(Array.isArray(themes) ? themes : []); this.themes(Array.isArray(themes) ? themes : []);
this.theme(Settings.get('Theme')); this.theme(SettingsGet('Theme'));
if (!this.isMobile()) { if (!this.isMobile()) {
this.userBackgroundName(Settings.get('UserBackgroundName')); this.userBackgroundName(SettingsGet('UserBackgroundName'));
this.userBackgroundHash(Settings.get('UserBackgroundHash')); this.userBackgroundHash(SettingsGet('UserBackgroundHash'));
} }
leftPanelDisabled(this.isMobile()); leftPanelDisabled(this.isMobile());

View file

@ -1,4 +1,5 @@
import ko from 'ko'; import ko from 'ko';
import { SettingsGet } from 'Common/Globals';
class AccountUserStore { class AccountUserStore {
constructor() { constructor() {
@ -27,8 +28,8 @@ class AccountUserStore {
} }
populate() { populate() {
this.email(rl.settings.get('Email')); this.email(SettingsGet('Email'));
this.parentEmail(rl.settings.get('ParentEmail')); this.parentEmail(SettingsGet('ParentEmail'));
} }
} }

View file

@ -1,7 +1,7 @@
import ko from 'ko'; import ko from 'ko';
import { KeyState } from 'Common/Enums'; import { KeyState } from 'Common/Enums';
import { Focused } from 'Common/EnumsUser'; import { Focused } from 'Common/EnumsUser';
import { keyScope, leftPanelDisabled, Settings } from 'Common/Globals'; import { keyScope, leftPanelDisabled, Settings, SettingsGet } from 'Common/Globals';
import { ThemeStore } from 'Stores/Theme'; import { ThemeStore } from 'Stores/Theme';
class AppUserStore { class AppUserStore {
@ -48,18 +48,18 @@ class AppUserStore {
} }
populate() { populate() {
this.projectHash(Settings.get('ProjectHash')); this.projectHash(SettingsGet('ProjectHash'));
this.contactsAutosave(!!Settings.get('ContactsAutosave')); this.contactsAutosave(!!SettingsGet('ContactsAutosave'));
this.useLocalProxyForExternalImages(!!Settings.get('UseLocalProxyForExternalImages')); this.useLocalProxyForExternalImages(!!SettingsGet('UseLocalProxyForExternalImages'));
this.contactsIsAllowed(!!Settings.get('ContactsIsAllowed')); this.contactsIsAllowed(!!SettingsGet('ContactsIsAllowed'));
const attachmentsActions = Settings.app('attachmentsActions'); const attachmentsActions = Settings.app('attachmentsActions');
this.attachmentsActions(Array.isNotEmpty(attachmentsActions) ? attachmentsActions : []); this.attachmentsActions(Array.isNotEmpty(attachmentsActions) ? attachmentsActions : []);
this.devEmail = Settings.get('DevEmail'); this.devEmail = SettingsGet('DevEmail');
this.devPassword = Settings.get('DevPassword'); this.devPassword = SettingsGet('DevPassword');
} }
} }

View file

@ -1,4 +1,5 @@
import ko from 'ko'; import ko from 'ko';
import { SettingsGet } from 'Common/Globals';
class ContactUserStore { class ContactUserStore {
constructor() { constructor() {
@ -19,13 +20,12 @@ class ContactUserStore {
} }
populate() { populate() {
const settingsGet = rl.settings.get; this.allowContactsSync(!!SettingsGet('ContactsSyncIsAllowed'));
this.allowContactsSync(!!settingsGet('ContactsSyncIsAllowed')); this.enableContactsSync(!!SettingsGet('EnableContactsSync'));
this.enableContactsSync(!!settingsGet('EnableContactsSync'));
this.contactsSyncUrl(settingsGet('ContactsSyncUrl')); this.contactsSyncUrl(SettingsGet('ContactsSyncUrl'));
this.contactsSyncUser(settingsGet('ContactsSyncUser')); this.contactsSyncUser(SettingsGet('ContactsSyncUser'));
this.contactsSyncPass(settingsGet('ContactsSyncPassword')); this.contactsSyncPass(SettingsGet('ContactsSyncPassword'));
} }
} }

View file

@ -4,6 +4,7 @@ import { FolderType } from 'Common/EnumsUser';
import { UNUSED_OPTION_VALUE } from 'Common/Consts'; import { UNUSED_OPTION_VALUE } from 'Common/Consts';
import { folderListOptionsBuilder } from 'Common/UtilsUser'; import { folderListOptionsBuilder } from 'Common/UtilsUser';
import { getFolderInboxName, getFolderFromCacheList } from 'Common/Cache'; import { getFolderInboxName, getFolderFromCacheList } from 'Common/Cache';
import { SettingsGet } from 'Common/Globals';
class FolderUserStore { class FolderUserStore {
constructor() { constructor() {
@ -40,7 +41,7 @@ class FolderUserStore {
this.currentFolder = ko.observable(null).extend({ toggleSubscribeProperty: [this, 'selected'] }); this.currentFolder = ko.observable(null).extend({ toggleSubscribeProperty: [this, 'selected'] });
this.sieveAllowFileintoInbox = !!rl.settings.get('SieveAllowFileintoInbox'); this.sieveAllowFileintoInbox = !!SettingsGet('SieveAllowFileintoInbox');
this.draftFolderNotEnabled = ko.computed( this.draftFolderNotEnabled = ko.computed(
() => !this.draftFolder() || UNUSED_OPTION_VALUE === this.draftFolder() () => !this.draftFolder() || UNUSED_OPTION_VALUE === this.draftFolder()

View file

@ -1,6 +1,7 @@
import ko from 'ko'; import ko from 'ko';
import Audio from 'Common/Audio'; import Audio from 'Common/Audio';
import { SettingsGet } from 'Common/Globals';
import * as Links from 'Common/Links'; import * as Links from 'Common/Links';
/** /**
@ -102,8 +103,8 @@ class NotificationUserStore {
} }
populate() { populate() {
this.enableSoundNotification(!!rl.settings.get('SoundNotification')); this.enableSoundNotification(!!SettingsGet('SoundNotification'));
this.enableDesktopNotification(!!rl.settings.get('DesktopNotifications')); this.enableDesktopNotification(!!SettingsGet('DesktopNotifications'));
} }
} }

View file

@ -3,7 +3,7 @@ import ko from 'ko';
import { MESSAGES_PER_PAGE_VALUES } from 'Common/Consts'; import { MESSAGES_PER_PAGE_VALUES } from 'Common/Consts';
import { Layout, EditorDefaultType } from 'Common/EnumsUser'; import { Layout, EditorDefaultType } from 'Common/EnumsUser';
import { pInt } from 'Common/Utils'; import { pInt } from 'Common/Utils';
import { $htmlCL, Settings } from 'Common/Globals'; import { $htmlCL, SettingsGet } from 'Common/Globals';
import { ThemeStore } from 'Stores/Theme'; import { ThemeStore } from 'Stores/Theme';
class SettingsUserStore { class SettingsUserStore {
@ -41,7 +41,7 @@ class SettingsUserStore {
let iAutoLogoutTimer; let iAutoLogoutTimer;
this.delayLogout = (() => { this.delayLogout = (() => {
clearTimeout(iAutoLogoutTimer); clearTimeout(iAutoLogoutTimer);
if (0 < this.autoLogout() && !Settings.get('AccountSignMe')) { if (0 < this.autoLogout() && !SettingsGet('AccountSignMe')) {
iAutoLogoutTimer = setTimeout( iAutoLogoutTimer = setTimeout(
rl.app.logout, rl.app.logout,
this.autoLogout() * 60000 this.autoLogout() * 60000
@ -60,19 +60,18 @@ class SettingsUserStore {
} }
populate() { populate() {
const settingsGet = Settings.get; this.layout(pInt(SettingsGet('Layout')));
this.layout(pInt(settingsGet('Layout'))); this.editorDefaultType(SettingsGet('EditorDefaultType'));
this.editorDefaultType(settingsGet('EditorDefaultType'));
this.autoLogout(pInt(settingsGet('AutoLogout'))); this.autoLogout(pInt(SettingsGet('AutoLogout')));
this.messagesPerPage(settingsGet('MPP')); this.messagesPerPage(SettingsGet('MPP'));
this.showImages(!!settingsGet('ShowImages')); this.showImages(!!SettingsGet('ShowImages'));
this.removeColors(!!settingsGet('RemoveColors')); this.removeColors(!!SettingsGet('RemoveColors'));
this.useCheckboxesInList(!!(ThemeStore.isMobile() || settingsGet('UseCheckboxesInList'))); this.useCheckboxesInList(!!(ThemeStore.isMobile() || SettingsGet('UseCheckboxesInList')));
this.allowDraftAutosave(!!settingsGet('AllowDraftAutosave')); this.allowDraftAutosave(!!SettingsGet('AllowDraftAutosave'));
this.useThreads(!!settingsGet('UseThreads')); this.useThreads(!!SettingsGet('UseThreads'));
this.replySameFolder(!!settingsGet('ReplySameFolder')); this.replySameFolder(!!SettingsGet('ReplySameFolder'));
this.delayLogout(); this.delayLogout();
} }

View file

@ -1,6 +1,7 @@
import ko from 'ko'; import ko from 'ko';
import { StorageResultType, Notification } from 'Common/Enums'; import { StorageResultType, Notification } from 'Common/Enums';
import { Settings } from 'Common/Globals';
import { getNotification } from 'Common/Translator'; import { getNotification } from 'Common/Translator';
import Remote from 'Remote/Admin/Fetch'; import Remote from 'Remote/Admin/Fetch';
@ -12,7 +13,7 @@ class LoginAdminView extends AbstractViewCenter {
constructor() { constructor() {
super('Admin/Login', 'AdminLogin'); super('Admin/Login', 'AdminLogin');
this.hideSubmitButton = rl.settings.app('hideSubmitButton'); this.hideSubmitButton = Settings.app('hideSubmitButton');
this.addObservables({ this.addObservables({
login: '', login: '',

View file

@ -8,13 +8,13 @@ import { PackageAdminStore } from 'Stores/Admin/Package';
import { AbstractViewRight } from 'Knoin/AbstractViews'; import { AbstractViewRight } from 'Knoin/AbstractViews';
import { leftPanelDisabled } from 'Common/Globals'; import { leftPanelDisabled, Settings } from 'Common/Globals';
class PaneSettingsAdminView extends AbstractViewRight { class PaneSettingsAdminView extends AbstractViewRight {
constructor() { constructor() {
super('Admin/Settings/Pane', 'AdminPane'); super('Admin/Settings/Pane', 'AdminPane');
this.version = ko.observable(rl.settings.app('version')); this.version = ko.observable(Settings.app('version'));
this.leftPanelDisabled = leftPanelDisabled; this.leftPanelDisabled = leftPanelDisabled;

View file

@ -22,7 +22,7 @@ import { serverRequest } from 'Common/Links';
import { i18n, getNotification, getUploadErrorDescByCode } from 'Common/Translator'; import { i18n, getNotification, getUploadErrorDescByCode } from 'Common/Translator';
import { timestampToString } from 'Common/Momentor'; import { timestampToString } from 'Common/Momentor';
import { MessageFlagsCache, setFolderHash } from 'Common/Cache'; import { MessageFlagsCache, setFolderHash } from 'Common/Cache';
import { Settings } from 'Common/Globals'; import { Settings, SettingsGet } from 'Common/Globals';
import AppStore from 'Stores/User/App'; import AppStore from 'Stores/User/App';
import SettingsStore from 'Stores/User/Settings'; import SettingsStore from 'Stores/User/Settings';
@ -1189,7 +1189,7 @@ class ComposePopupView extends AbstractViewPopup {
initUploader() { initUploader() {
if (this.composeUploaderButton()) { if (this.composeUploaderButton()) {
const uploadCache = {}, const uploadCache = {},
attachmentSizeLimit = pInt(Settings.get('AttachmentLimit')), attachmentSizeLimit = pInt(SettingsGet('AttachmentLimit')),
oJua = new Jua({ oJua = new Jua({
action: serverRequest('Upload'), action: serverRequest('Upload'),
name: 'uploader', name: 'uploader',

View file

@ -2,6 +2,7 @@ import ko from 'ko';
import { SetSystemFoldersNotification } from 'Common/EnumsUser'; import { SetSystemFoldersNotification } from 'Common/EnumsUser';
import { UNUSED_OPTION_VALUE } from 'Common/Consts'; import { UNUSED_OPTION_VALUE } from 'Common/Consts';
import { Settings } from 'Common/Globals';
import { defaultOptionsAfterRender } from 'Common/Utils'; import { defaultOptionsAfterRender } from 'Common/Utils';
import { folderListOptionsBuilder } from 'Common/UtilsUser'; import { folderListOptionsBuilder } from 'Common/UtilsUser';
import { initOnStartOrLangChange, i18n } from 'Common/Translator'; import { initOnStartOrLangChange, i18n } from 'Common/Translator';
@ -50,7 +51,7 @@ class FolderSystemPopupView extends AbstractViewPopup {
this.trashFolder = FolderStore.trashFolder; this.trashFolder = FolderStore.trashFolder;
this.archiveFolder = FolderStore.archiveFolder; this.archiveFolder = FolderStore.archiveFolder;
const settingsSet = rl.settings.set, const settingsSet = Settings.set,
fSetSystemFolders = () => { fSetSystemFolders = () => {
settingsSet('SentFolder', FolderStore.sentFolder()); settingsSet('SentFolder', FolderStore.sentFolder());
settingsSet('DraftFolder', FolderStore.draftFolder()); settingsSet('DraftFolder', FolderStore.draftFolder());

View file

@ -1,4 +1,5 @@
import { Capa, StorageResultType } from 'Common/Enums'; import { Capa, StorageResultType } from 'Common/Enums';
import { Settings } from 'Common/Globals';
import { pString } from 'Common/Utils'; import { pString } from 'Common/Utils';
import { i18n, trigger as translatorTrigger } from 'Common/Translator'; import { i18n, trigger as translatorTrigger } from 'Common/Translator';
@ -33,7 +34,7 @@ class TwoFactorConfigurationPopupView extends AbstractViewPopup {
viewEnable_: false viewEnable_: false
}); });
this.capaTwoFactor = rl.settings.capa(Capa.TwoFactor); this.capaTwoFactor = Settings.capa(Capa.TwoFactor);
this.addComputables({ this.addComputables({
viewEnable: { viewEnable: {

View file

@ -20,8 +20,8 @@ export class AbstractSystemDropDownUserView extends AbstractViewRight {
constructor(name) { constructor(name) {
super(name, 'SystemDropDown'); super(name, 'SystemDropDown');
this.allowSettings = !!Settings.capa(Capa.Settings); this.allowSettings = Settings.capa(Capa.Settings);
this.allowHelp = !!Settings.capa(Capa.Help); this.allowHelp = Settings.capa(Capa.Help);
this.currentAudio = AppStore.currentAudio; this.currentAudio = AppStore.currentAudio;

View file

@ -19,7 +19,7 @@ import Remote from 'Remote/User/Fetch';
import { decorateKoCommands, showScreenPopup } from 'Knoin/Knoin'; import { decorateKoCommands, showScreenPopup } from 'Knoin/Knoin';
import { AbstractViewCenter } from 'Knoin/AbstractViews'; import { AbstractViewCenter } from 'Knoin/AbstractViews';
import { Settings } from 'Common/Globals'; import { Settings, SettingsGet } from 'Common/Globals';
import { LanguagesPopupView } from 'View/Popup/Languages'; import { LanguagesPopupView } from 'View/Popup/Languages';
@ -44,7 +44,7 @@ class LoginUserView extends AbstractViewCenter {
this.hideSubmitButton = Settings.app('hideSubmitButton'); this.hideSubmitButton = Settings.app('hideSubmitButton');
this.addObservables({ this.addObservables({
loadingDesc: Settings.get('LoadingDescription'), loadingDesc: SettingsGet('LoadingDescription'),
email: '', email: '',
password: '', password: '',
@ -73,7 +73,7 @@ class LoginUserView extends AbstractViewCenter {
this.formError = ko.observable(false).extend({ falseTimeout: 500 }); this.formError = ko.observable(false).extend({ falseTimeout: 500 });
this.allowLanguagesOnLogin = !!Settings.get('AllowLanguagesOnLogin'); this.allowLanguagesOnLogin = !!SettingsGet('AllowLanguagesOnLogin');
this.language = LanguageStore.language; this.language = LanguageStore.language;
this.languages = LanguageStore.languages; this.languages = LanguageStore.languages;
@ -109,8 +109,8 @@ class LoginUserView extends AbstractViewCenter {
signMeType: iValue => this.signMe(LoginSignMeType.DefaultOn === iValue) signMeType: iValue => this.signMe(LoginSignMeType.DefaultOn === iValue)
}); });
if (Settings.get('AdditionalLoginError') && !this.submitError()) { if (SettingsGet('AdditionalLoginError') && !this.submitError()) {
this.submitError(Settings.get('AdditionalLoginError')); this.submitError(SettingsGet('AdditionalLoginError'));
} }
decorateKoCommands(this, { decorateKoCommands(this, {
@ -207,7 +207,7 @@ class LoginUserView extends AbstractViewCenter {
onBuild() { onBuild() {
const signMeLocal = Local.get(ClientSideKeyName.LastSignMe), const signMeLocal = Local.get(ClientSideKeyName.LastSignMe),
signMe = (Settings.get('SignMe') || 'unused').toLowerCase(); signMe = (SettingsGet('SignMe') || 'unused').toLowerCase();
switch (signMe) { switch (signMe) {
case LoginSignMeTypeAsString.DefaultOff: case LoginSignMeTypeAsString.DefaultOff:

View file

@ -15,7 +15,7 @@ import {
import { UNUSED_OPTION_VALUE } from 'Common/Consts'; import { UNUSED_OPTION_VALUE } from 'Common/Consts';
import { doc, leftPanelDisabled, moveAction, Settings } from 'Common/Globals'; import { doc, leftPanelDisabled, moveAction, Settings, SettingsGet } from 'Common/Globals';
import { computedPaginatorHelper, showMessageComposer } from 'Common/UtilsUser'; import { computedPaginatorHelper, showMessageComposer } from 'Common/UtilsUser';
import { FileInfo } from 'Common/File'; import { FileInfo } from 'Common/File';
@ -60,7 +60,7 @@ export class MessageListMailBoxUserView extends AbstractViewRight {
this.iGoToUpUpOrDownDownTimeout = 0; this.iGoToUpUpOrDownDownTimeout = 0;
this.newMoveToFolder = !!Settings.get('NewMoveToFolder'); this.newMoveToFolder = !!SettingsGet('NewMoveToFolder');
this.allowReload = Settings.capa(Capa.Reload); this.allowReload = Settings.capa(Capa.Reload);
this.allowSearch = Settings.capa(Capa.Search); this.allowSearch = Settings.capa(Capa.Search);

6
dev/bootstrap.js vendored
View file

@ -1,4 +1,4 @@
import { doc, elementById, dropdownVisibility } from 'Common/Globals'; import { doc, elementById, dropdownVisibility, Settings } from 'Common/Globals';
import { StorageResultType } from 'Common/Enums'; import { StorageResultType } from 'Common/Enums';
import { i18n } from 'Common/Translator'; import { i18n } from 'Common/Translator';
@ -51,7 +51,7 @@ export default (App) => {
}, },
reload: () => { reload: () => {
rl.route.root(); rl.route.root();
setTimeout(() => (rl.settings.app('inIframe') ? parent : window).location.reload(), 100); setTimeout(() => (Settings.app('inIframe') ? parent : window).location.reload(), 100);
}, },
off: () => hasher.changed.active = false, off: () => hasher.changed.active = false,
on: () => hasher.changed.active = true, on: () => hasher.changed.active = true,
@ -91,7 +91,7 @@ export default (App) => {
if (postData) { if (postData) {
init.method = 'POST'; init.method = 'POST';
init.headers['Content-Type'] = 'application/x-www-form-urlencoded; charset=UTF-8'; init.headers['Content-Type'] = 'application/x-www-form-urlencoded; charset=UTF-8';
postData.XToken = rl.settings.app('token'); postData.XToken = Settings.app('token');
// init.body = JSON.stringify(postData); // init.body = JSON.stringify(postData);
const formData = new FormData(), const formData = new FormData(),
buildFormData = (formData, data, parentKey) => { buildFormData = (formData, data, parentKey) => {