Improved boot.js with existing global window.rl

Put dev/Storage/Settings.js in boots.js global rl.settings
This commit is contained in:
djmaze 2020-09-04 12:05:17 +02:00
parent f90dbcc84b
commit aeb5275648
57 changed files with 284 additions and 380 deletions

View file

@ -1,10 +1,8 @@
import ko from 'ko';
import { appSettingsGet } from 'Storage/Settings';
class AboutAdminSettings {
constructor() {
this.version = ko.observable(appSettingsGet('version'));
this.version = ko.observable(rl.settings.app('version'));
this.coreType = ko.observable('djmaze');
}
}

View file

@ -4,10 +4,9 @@ import { settingsSaveHelperSimpleFunction } from 'Common/Utils';
import Remote from 'Remote/Admin/Ajax';
import { settingsGet } from 'Storage/Settings';
class BrandingAdminSettings {
constructor() {
const settingsGet = rl.settings.get;
this.title = ko.observable(settingsGet('Title')).idleTrigger();
this.loadingDesc = ko.observable(settingsGet('LoadingDescription')).idleTrigger();
this.faviconUrl = ko.observable(settingsGet('FaviconUrl')).idleTrigger();

View file

@ -4,10 +4,11 @@ import { settingsSaveHelperSimpleFunction, defautOptionsAfterRender } from 'Comm
import { SaveSettingsStep, StorageResultType } from 'Common/Enums';
import { i18n } from 'Common/Translator';
import { settingsGet } from 'Storage/Settings';
import Remote from 'Remote/Admin/Ajax';
import { command } from 'Knoin/Knoin';
const settingsGet = rl.settings.get;
class ContactsAdminSettings {
constructor() {
this.defautOptionsAfterRender = defautOptionsAfterRender;

View file

@ -11,7 +11,6 @@ import {
import { SaveSettingsStep } from 'Common/Enums';
import { reload as translatorReload } from 'Common/Translator';
import { settingsGet } from 'Storage/Settings';
import { showScreenPopup } from 'Knoin/Knoin';
import Remote from 'Remote/Admin/Ajax';
@ -21,6 +20,8 @@ import LanguageStore from 'Stores/Language';
import AppAdminStore from 'Stores/Admin/App';
import CapaAdminStore from 'Stores/Admin/Capa';
const settingsGet = rl.settings.get;
class GeneralAdminSettings {
constructor() {
this.language = LanguageStore.language;

View file

@ -1,7 +1,6 @@
import ko from 'ko';
import { settingsSaveHelperSimpleFunction } from 'Common/Utils';
import { settingsGet } from 'Storage/Settings';
import AppStore from 'Stores/Admin/App';
@ -12,7 +11,7 @@ class LoginAdminSettings {
this.determineUserLanguage = AppStore.determineUserLanguage;
this.determineUserDomain = AppStore.determineUserDomain;
this.defaultDomain = ko.observable(settingsGet('LoginDefaultDomain')).idleTrigger();
this.defaultDomain = ko.observable(rl.settings.get('LoginDefaultDomain')).idleTrigger();
this.allowLanguagesOnLogin = AppStore.allowLanguagesOnLogin;
this.dummy = ko.observable(false);

View file

@ -3,7 +3,6 @@ import ko from 'ko';
import { StorageResultType, Notification } from 'Common/Enums';
import { getNotification } from 'Common/Translator';
import { settingsGet } from 'Storage/Settings';
import { showScreenPopup } from 'Knoin/Knoin';
import PluginStore from 'Stores/Admin/Plugin';
@ -14,7 +13,7 @@ import { getApp } from 'Helper/Apps/Admin';
class PluginsAdminSettings {
constructor() {
this.enabledPlugins = ko.observable(!!settingsGet('EnabledPlugins'));
this.enabledPlugins = ko.observable(!!rl.settings.get('EnabledPlugins'));
this.plugins = PluginStore.plugins;
this.pluginsError = PluginStore.plugins.error;

View file

@ -2,8 +2,6 @@ import ko from 'ko';
import { StorageResultType } from 'Common/Enums';
import { settingsGet } from 'Storage/Settings';
import AppAdminStore from 'Stores/Admin/App';
import CapaAdminStore from 'Stores/Admin/Capa';
@ -11,6 +9,8 @@ import Remote from 'Remote/Admin/Ajax';
import { command } from 'Knoin/Knoin';
const settingsGet = rl.settings.get;
class SecurityAdminSettings {
constructor() {
this.useLocalProxyForExternalImages = AppAdminStore.useLocalProxyForExternalImages;

View file

@ -3,8 +3,6 @@ import ko from 'ko';
import { Capa, StorageResultType } from 'Common/Enums';
import { root } from 'Common/Links';
import { capa } from 'Storage/Settings';
import AccountStore from 'Stores/User/Account';
import IdentityStore from 'Stores/User/Identity';
import Remote from 'Remote/User/Ajax';
@ -15,8 +13,8 @@ import { showScreenPopup, routeOff, setHash } from 'Knoin/Knoin';
class AccountsUserSettings {
constructor() {
this.allowAdditionalAccount = capa(Capa.AdditionalAccounts);
this.allowIdentities = capa(Capa.Identities);
this.allowAdditionalAccount = rl.settings.capa(Capa.AdditionalAccounts);
this.allowIdentities = rl.settings.capa(Capa.Identities);
this.accounts = AccountStore.accounts;
this.identities = IdentityStore.identities;

View file

@ -5,7 +5,6 @@ import { getNotification, i18n } from 'Common/Translator';
import { removeFolderFromCacheList } from 'Common/Cache';
import { appSettingsGet } from 'Storage/Settings';
import * as Local from 'Storage/Client';
import FolderStore from 'Stores/User/Folder';
@ -37,7 +36,7 @@ class FoldersUserSettings {
this.folderForEdit = ko.observable(null).extend({ toggleSubscribeProperty: [this, 'edited'] });
this.useImapSubscribe = !!appSettingsGet('useImapSubscribe');
this.useImapSubscribe = !!rl.settings.app('useImapSubscribe');
}
folderEditOnEnter(folder) {

View file

@ -4,8 +4,6 @@ import { pInt, settingsSaveHelperSimpleFunction } from 'Common/Utils';
import { Capa, SaveSettingsStep } from 'Common/Enums';
import { i18n, trigger as translatorTrigger } from 'Common/Translator';
import { capa } from 'Storage/Settings';
import { showScreenPopup } from 'Knoin/Knoin';
import SettinsStore from 'Stores/User/Settings';
@ -14,8 +12,8 @@ import Remote from 'Remote/User/Ajax';
class SecurityUserSettings {
constructor() {
this.capaAutoLogout = capa(Capa.AutoLogout);
this.capaTwoFactor = capa(Capa.TwoFactor);
this.capaAutoLogout = rl.settings.capa(Capa.AutoLogout);
this.capaTwoFactor = rl.settings.capa(Capa.TwoFactor);
this.autoLogout = SettinsStore.autoLogout;
this.autoLogout.trigger = ko.observable(SaveSettingsStep.Idle);

View file

@ -5,8 +5,6 @@ import { changeTheme, convertThemeName } from 'Common/Utils';
import { userBackground, themePreviewLink, uploadBackground } from 'Common/Links';
import { i18n } from 'Common/Translator';
import { capa } from 'Storage/Settings';
import ThemeStore from 'Stores/Theme';
import Remote from 'Remote/User/Ajax';
@ -24,7 +22,7 @@ class ThemesUserSettings {
this.background.loading = ko.observable(false);
this.background.error = ko.observable('');
this.capaUserBackground = ko.observable(capa(Capa.UserBackground));
this.capaUserBackground = ko.observable(rl.settings.capa(Capa.UserBackground));
this.themeTrigger = ko.observable(SaveSettingsStep.Idle).extend({ throttle: 100 });