mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-07-13 03:27:39 +03:00
Improved boot.js with existing global window.rl
Put dev/Storage/Settings.js in boots.js global rl.settings
This commit is contained in:
parent
f90dbcc84b
commit
aeb5275648
57 changed files with 284 additions and 380 deletions
|
|
@ -1,5 +1,4 @@
|
|||
import ko from 'ko';
|
||||
import * as Settings from 'Storage/Settings';
|
||||
|
||||
class AbstractAppStore {
|
||||
constructor() {
|
||||
|
|
@ -9,9 +8,9 @@ class AbstractAppStore {
|
|||
}
|
||||
|
||||
populate() {
|
||||
this.allowLanguagesOnLogin(!!Settings.settingsGet('AllowLanguagesOnLogin'));
|
||||
this.allowLanguagesOnSettings(!!Settings.settingsGet('AllowLanguagesOnSettings'));
|
||||
this.newMoveToFolder(!!Settings.settingsGet('NewMoveToFolder'));
|
||||
this.allowLanguagesOnLogin(!!rl.settings.get('AllowLanguagesOnLogin'));
|
||||
this.allowLanguagesOnSettings(!!rl.settings.get('AllowLanguagesOnSettings'));
|
||||
this.newMoveToFolder(!!rl.settings.get('NewMoveToFolder'));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
import ko from 'ko';
|
||||
import { settingsGet } from 'Storage/Settings';
|
||||
import { AbstractAppStore } from 'Stores/AbstractApp';
|
||||
|
||||
class AppAdminStore extends AbstractAppStore {
|
||||
|
|
@ -18,6 +17,7 @@ class AppAdminStore extends AbstractAppStore {
|
|||
populate() {
|
||||
super.populate();
|
||||
|
||||
const settingsGet = rl.settings
|
||||
this.determineUserLanguage(!!settingsGet('DetermineUserLanguage'));
|
||||
this.determineUserDomain(!!settingsGet('DetermineUserDomain'));
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,5 @@
|
|||
import ko from 'ko';
|
||||
import { Capa } from 'Common/Enums';
|
||||
import * as Settings from 'Storage/Settings';
|
||||
|
||||
class CapaAdminStore {
|
||||
constructor() {
|
||||
|
|
@ -18,17 +17,18 @@ class CapaAdminStore {
|
|||
}
|
||||
|
||||
populate() {
|
||||
this.additionalAccounts(Settings.capa(Capa.AdditionalAccounts));
|
||||
this.identities(Settings.capa(Capa.Identities));
|
||||
this.attachmentThumbnails(Settings.capa(Capa.AttachmentThumbnails));
|
||||
this.sieve(Settings.capa(Capa.Sieve));
|
||||
this.filters(Settings.capa(Capa.Filters));
|
||||
this.themes(Settings.capa(Capa.Themes));
|
||||
this.userBackground(Settings.capa(Capa.UserBackground));
|
||||
this.openPGP(Settings.capa(Capa.OpenPGP));
|
||||
this.twoFactorAuth(Settings.capa(Capa.TwoFactor));
|
||||
this.twoFactorAuthForce(Settings.capa(Capa.TwoFactorForce));
|
||||
this.templates(Settings.capa(Capa.Templates));
|
||||
let capa = rl.settings.capa;
|
||||
this.additionalAccounts(capa(Capa.AdditionalAccounts));
|
||||
this.identities(capa(Capa.Identities));
|
||||
this.attachmentThumbnails(capa(Capa.AttachmentThumbnails));
|
||||
this.sieve(capa(Capa.Sieve));
|
||||
this.filters(capa(Capa.Filters));
|
||||
this.themes(capa(Capa.Themes));
|
||||
this.userBackground(capa(Capa.UserBackground));
|
||||
this.openPGP(capa(Capa.OpenPGP));
|
||||
this.twoFactorAuth(capa(Capa.TwoFactor));
|
||||
this.twoFactorAuthForce(capa(Capa.TwoFactorForce));
|
||||
this.templates(capa(Capa.Templates));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
import ko from 'ko';
|
||||
import * as Settings from 'Storage/Settings';
|
||||
|
||||
class LanguageStore {
|
||||
constructor() {
|
||||
|
|
@ -21,17 +20,18 @@ class LanguageStore {
|
|||
}
|
||||
|
||||
populate() {
|
||||
const aLanguages = Settings.appSettingsGet('languages'),
|
||||
aLanguagesAdmin = Settings.appSettingsGet('languagesAdmin');
|
||||
const Settings = rl.settings,
|
||||
aLanguages = Settings.app('languages'),
|
||||
aLanguagesAdmin = Settings.app('languagesAdmin');
|
||||
|
||||
this.languages(Array.isArray(aLanguages) ? aLanguages : []);
|
||||
this.languagesAdmin(Array.isArray(aLanguagesAdmin) ? aLanguagesAdmin : []);
|
||||
|
||||
this.language(Settings.settingsGet('Language'));
|
||||
this.languageAdmin(Settings.settingsGet('LanguageAdmin'));
|
||||
this.language(Settings.get('Language'));
|
||||
this.languageAdmin(Settings.get('LanguageAdmin'));
|
||||
|
||||
this.userLanguage(Settings.settingsGet('UserLanguage'));
|
||||
this.userLanguageAdmin(Settings.settingsGet('UserLanguageAdmin'));
|
||||
this.userLanguage(Settings.get('UserLanguage'));
|
||||
this.userLanguageAdmin(Settings.get('UserLanguageAdmin'));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
import ko from 'ko';
|
||||
import * as Settings from 'Storage/Settings';
|
||||
|
||||
class ThemeStore {
|
||||
constructor() {
|
||||
|
|
@ -11,12 +10,13 @@ class ThemeStore {
|
|||
}
|
||||
|
||||
populate() {
|
||||
const themes = Settings.appSettingsGet('themes');
|
||||
const Settings = rl.settings,
|
||||
themes = Settings.app('themes');
|
||||
|
||||
this.themes(Array.isArray(themes) ? themes : []);
|
||||
this.theme(Settings.settingsGet('Theme'));
|
||||
this.themeBackgroundName(Settings.settingsGet('UserBackgroundName'));
|
||||
this.themeBackgroundHash(Settings.settingsGet('UserBackgroundHash'));
|
||||
this.theme(Settings.get('Theme'));
|
||||
this.themeBackgroundName(Settings.get('UserBackgroundName'));
|
||||
this.themeBackgroundHash(Settings.get('UserBackgroundHash'));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
import ko from 'ko';
|
||||
import * as Settings from 'Storage/Settings';
|
||||
|
||||
class AccountUserStore {
|
||||
constructor() {
|
||||
|
|
@ -33,8 +32,8 @@ class AccountUserStore {
|
|||
}
|
||||
|
||||
populate() {
|
||||
this.email(Settings.settingsGet('Email'));
|
||||
this.parentEmail(Settings.settingsGet('ParentEmail'));
|
||||
this.email(rl.settings.get('Email'));
|
||||
this.parentEmail(rl.settings.get('ParentEmail'));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -4,10 +4,10 @@ import { Focused, KeyState } from 'Common/Enums';
|
|||
import { keyScope, leftPanelDisabled } from 'Common/Globals';
|
||||
import { isNonEmptyArray } from 'Common/Utils';
|
||||
|
||||
import * as Settings from 'Storage/Settings';
|
||||
|
||||
import { AbstractAppStore } from 'Stores/AbstractApp';
|
||||
|
||||
const Settings = rl.settings;
|
||||
|
||||
class AppUserStore extends AbstractAppStore {
|
||||
constructor() {
|
||||
super();
|
||||
|
|
@ -16,7 +16,7 @@ class AppUserStore extends AbstractAppStore {
|
|||
|
||||
this.focusedState = ko.observable(Focused.None);
|
||||
|
||||
const isMobile = Settings.appSettingsGet('mobile');
|
||||
const isMobile = Settings.app('mobile');
|
||||
|
||||
this.focusedState.subscribe((value) => {
|
||||
switch (value) {
|
||||
|
|
@ -62,18 +62,18 @@ class AppUserStore extends AbstractAppStore {
|
|||
populate() {
|
||||
super.populate();
|
||||
|
||||
this.projectHash(Settings.settingsGet('ProjectHash'));
|
||||
this.projectHash(Settings.get('ProjectHash'));
|
||||
|
||||
this.contactsAutosave(!!Settings.settingsGet('ContactsAutosave'));
|
||||
this.useLocalProxyForExternalImages(!!Settings.settingsGet('UseLocalProxyForExternalImages'));
|
||||
this.contactsAutosave(!!Settings.get('ContactsAutosave'));
|
||||
this.useLocalProxyForExternalImages(!!Settings.get('UseLocalProxyForExternalImages'));
|
||||
|
||||
this.contactsIsAllowed(!!Settings.settingsGet('ContactsIsAllowed'));
|
||||
this.contactsIsAllowed(!!Settings.get('ContactsIsAllowed'));
|
||||
|
||||
const attachmentsActions = Settings.appSettingsGet('attachmentsActions');
|
||||
const attachmentsActions = Settings.app('attachmentsActions');
|
||||
this.attachmentsActions(isNonEmptyArray(attachmentsActions) ? attachmentsActions : []);
|
||||
|
||||
this.devEmail = Settings.settingsGet('DevEmail');
|
||||
this.devPassword = Settings.settingsGet('DevPassword');
|
||||
this.devEmail = Settings.get('DevEmail');
|
||||
this.devPassword = Settings.get('DevPassword');
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
import ko from 'ko';
|
||||
import * as Settings from 'Storage/Settings';
|
||||
|
||||
class ContactUserStore {
|
||||
constructor() {
|
||||
|
|
@ -18,12 +17,13 @@ class ContactUserStore {
|
|||
}
|
||||
|
||||
populate() {
|
||||
this.allowContactsSync(!!Settings.settingsGet('ContactsSyncIsAllowed'));
|
||||
this.enableContactsSync(!!Settings.settingsGet('EnableContactsSync'));
|
||||
const settingsGet = rl.settings.get;
|
||||
this.allowContactsSync(!!settingsGet('ContactsSyncIsAllowed'));
|
||||
this.enableContactsSync(!!settingsGet('EnableContactsSync'));
|
||||
|
||||
this.contactsSyncUrl(Settings.settingsGet('ContactsSyncUrl'));
|
||||
this.contactsSyncUser(Settings.settingsGet('ContactsSyncUser'));
|
||||
this.contactsSyncPass(Settings.settingsGet('ContactsSyncPassword'));
|
||||
this.contactsSyncUrl(settingsGet('ContactsSyncUrl'));
|
||||
this.contactsSyncUser(settingsGet('ContactsSyncUser'));
|
||||
this.contactsSyncPass(settingsGet('ContactsSyncPassword'));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,5 @@
|
|||
import ko from 'ko';
|
||||
|
||||
import { settingsGet } from 'Storage/Settings';
|
||||
|
||||
import { FolderType } from 'Common/Enums';
|
||||
import { UNUSED_OPTION_VALUE } from 'Common/Consts';
|
||||
import { folderListOptionsBuilder } from 'Common/Utils';
|
||||
|
|
@ -32,7 +30,7 @@ class FolderUserStore {
|
|||
|
||||
this.currentFolder = ko.observable(null).extend({ toggleSubscribeProperty: [this, 'selected'] });
|
||||
|
||||
this.sieveAllowFileintoInbox = !!settingsGet('SieveAllowFileintoInbox');
|
||||
this.sieveAllowFileintoInbox = !!rl.settings.get('SieveAllowFileintoInbox');
|
||||
|
||||
this.computers();
|
||||
this.subscribers();
|
||||
|
|
|
|||
|
|
@ -3,7 +3,6 @@ import ko from 'ko';
|
|||
import { DesktopNotification } from 'Common/Enums';
|
||||
import Audio from 'Common/Audio';
|
||||
|
||||
import * as Settings from 'Storage/Settings';
|
||||
|
||||
class NotificationUserStore {
|
||||
constructor() {
|
||||
|
|
@ -159,8 +158,8 @@ class NotificationUserStore {
|
|||
}
|
||||
|
||||
populate() {
|
||||
this.enableSoundNotification(!!Settings.settingsGet('SoundNotification'));
|
||||
this.enableDesktopNotification(!!Settings.settingsGet('DesktopNotifications'));
|
||||
this.enableSoundNotification(!!rl.settings.get('SoundNotification'));
|
||||
this.enableDesktopNotification(!!rl.settings.get('DesktopNotifications'));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -4,8 +4,6 @@ import { MESSAGES_PER_PAGE, MESSAGES_PER_PAGE_VALUES } from 'Common/Consts';
|
|||
import { Layout, EditorDefaultType } from 'Common/Enums';
|
||||
import { pInt } from 'Common/Utils';
|
||||
|
||||
import * as Settings from 'Storage/Settings';
|
||||
|
||||
class SettingsUserStore {
|
||||
constructor() {
|
||||
this.iAutoLogoutTimer = 0;
|
||||
|
|
@ -52,21 +50,22 @@ class SettingsUserStore {
|
|||
}
|
||||
|
||||
populate() {
|
||||
this.layout(pInt(Settings.settingsGet('Layout')));
|
||||
this.editorDefaultType(Settings.settingsGet('EditorDefaultType'));
|
||||
const settingsGet = rl.settings.get;
|
||||
this.layout(pInt(settingsGet('Layout')));
|
||||
this.editorDefaultType(settingsGet('EditorDefaultType'));
|
||||
|
||||
this.autoLogout(pInt(Settings.settingsGet('AutoLogout')));
|
||||
this.messagesPerPage(Settings.settingsGet('MPP'));
|
||||
this.autoLogout(pInt(settingsGet('AutoLogout')));
|
||||
this.messagesPerPage(settingsGet('MPP'));
|
||||
|
||||
this.showImages(!!Settings.settingsGet('ShowImages'));
|
||||
this.useCheckboxesInList(!!Settings.settingsGet('UseCheckboxesInList'));
|
||||
this.allowDraftAutosave(!!Settings.settingsGet('AllowDraftAutosave'));
|
||||
this.useThreads(!!Settings.settingsGet('UseThreads'));
|
||||
this.replySameFolder(!!Settings.settingsGet('ReplySameFolder'));
|
||||
this.showImages(!!settingsGet('ShowImages'));
|
||||
this.useCheckboxesInList(!!settingsGet('UseCheckboxesInList'));
|
||||
this.allowDraftAutosave(!!settingsGet('AllowDraftAutosave'));
|
||||
this.useThreads(!!settingsGet('UseThreads'));
|
||||
this.replySameFolder(!!settingsGet('ReplySameFolder'));
|
||||
|
||||
const refresh = () => {
|
||||
clearTimeout(this.iAutoLogoutTimer);
|
||||
if (0 < this.autoLogout() && !Settings.settingsGet('AccountSignMe')) {
|
||||
if (0 < this.autoLogout() && !settingsGet('AccountSignMe')) {
|
||||
this.iAutoLogoutTimer = setTimeout(() =>
|
||||
dispatchEvent(new CustomEvent('rl.auto-logout'))
|
||||
, this.autoLogout() * 60000);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue