mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-08-28 03:29:20 +03:00
Improve Settings handling
This commit is contained in:
parent
e7b1ce7509
commit
34b25eedea
39 changed files with 160 additions and 150 deletions
|
|
@ -1,7 +1,8 @@
|
|||
import ko from 'ko';
|
||||
import { Settings } from 'Common/Globals';
|
||||
|
||||
export class AboutAdminSettings {
|
||||
constructor() {
|
||||
this.version = ko.observable(rl.settings.app('version'));
|
||||
this.version = ko.observable(Settings.app('version'));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,15 +1,15 @@
|
|||
import ko from 'ko';
|
||||
|
||||
import { SettingsGet } from 'Common/Globals';
|
||||
import { settingsSaveHelperSimpleFunction } from 'Common/Utils';
|
||||
|
||||
import Remote from 'Remote/Admin/Fetch';
|
||||
|
||||
export 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();
|
||||
this.title = ko.observable(SettingsGet('Title')).idleTrigger();
|
||||
this.loadingDesc = ko.observable(SettingsGet('LoadingDescription')).idleTrigger();
|
||||
this.faviconUrl = ko.observable(SettingsGet('FaviconUrl')).idleTrigger();
|
||||
}
|
||||
|
||||
onBuild() {
|
||||
|
|
|
|||
|
|
@ -1,25 +1,24 @@
|
|||
import ko from 'ko';
|
||||
|
||||
import { SaveSettingsStep, StorageResultType } from 'Common/Enums';
|
||||
import { SettingsGet } from 'Common/Globals';
|
||||
import { settingsSaveHelperSimpleFunction, defaultOptionsAfterRender } from 'Common/Utils';
|
||||
|
||||
import { SaveSettingsStep, StorageResultType } from 'Common/Enums';
|
||||
import Remote from 'Remote/Admin/Fetch';
|
||||
import { decorateKoCommands } from 'Knoin/Knoin';
|
||||
|
||||
const settingsGet = rl.settings.get;
|
||||
|
||||
export class ContactsAdminSettings {
|
||||
constructor() {
|
||||
this.defaultOptionsAfterRender = defaultOptionsAfterRender;
|
||||
|
||||
ko.addObservablesTo(this, {
|
||||
enableContacts: !!settingsGet('ContactsEnable'),
|
||||
contactsSync: !!settingsGet('ContactsSync'),
|
||||
enableContacts: !!SettingsGet('ContactsEnable'),
|
||||
contactsSync: !!SettingsGet('ContactsSync'),
|
||||
contactsType: '',
|
||||
|
||||
pdoDsn: settingsGet('ContactsPdoDsn'),
|
||||
pdoUser: settingsGet('ContactsPdoUser'),
|
||||
pdoPassword: settingsGet('ContactsPdoPassword'),
|
||||
pdoDsn: SettingsGet('ContactsPdoDsn'),
|
||||
pdoUser: SettingsGet('ContactsPdoUser'),
|
||||
pdoPassword: SettingsGet('ContactsPdoPassword'),
|
||||
|
||||
pdoDsnTrigger: SaveSettingsStep.Idle,
|
||||
pdoUserTrigger: SaveSettingsStep.Idle,
|
||||
|
|
@ -32,7 +31,7 @@ export class ContactsAdminSettings {
|
|||
testContactsErrorMessage: ''
|
||||
});
|
||||
|
||||
const supportedTypes = settingsGet('supportedPdoDrivers') || [],
|
||||
const supportedTypes = SettingsGet('supportedPdoDrivers') || [],
|
||||
types = [{
|
||||
id:'sqlite',
|
||||
name:'SQLite'
|
||||
|
|
@ -71,7 +70,7 @@ export class ContactsAdminSettings {
|
|||
this.testContactsErrorMessage('');
|
||||
});
|
||||
|
||||
this.contactsType(settingsGet('ContactsPdoType'));
|
||||
this.contactsType(SettingsGet('ContactsPdoType'));
|
||||
|
||||
this.onTestContactsResponse = this.onTestContactsResponse.bind(this);
|
||||
|
||||
|
|
@ -162,7 +161,7 @@ export class ContactsAdminSettings {
|
|||
});
|
||||
});
|
||||
|
||||
this.contactsType(settingsGet('ContactsPdoType'));
|
||||
this.contactsType(SettingsGet('ContactsPdoType'));
|
||||
}, 50);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -8,6 +8,7 @@ import {
|
|||
} from 'Common/Utils';
|
||||
|
||||
import { SaveSettingsStep } from 'Common/Enums';
|
||||
import { Settings, SettingsGet } from 'Common/Globals';
|
||||
import { reload as translatorReload, convertLangName } from 'Common/Translator';
|
||||
|
||||
import { showScreenPopup } from 'Knoin/Knoin';
|
||||
|
|
@ -20,17 +21,15 @@ import { AppAdminStore } from 'Stores/Admin/App';
|
|||
import { CapaAdminStore } from 'Stores/Admin/Capa';
|
||||
import LanguagesPopupView from 'View/Popup/Languages';
|
||||
|
||||
const settingsGet = rl.settings.get;
|
||||
|
||||
export class GeneralAdminSettings {
|
||||
constructor() {
|
||||
this.language = LanguageStore.language;
|
||||
this.languages = LanguageStore.languages;
|
||||
|
||||
const aLanguagesAdmin = rl.settings.app('languagesAdmin');
|
||||
const aLanguagesAdmin = Settings.app('languagesAdmin');
|
||||
this.languagesAdmin = ko.observableArray(Array.isArray(aLanguagesAdmin) ? aLanguagesAdmin : []);
|
||||
this.languageAdmin = ko
|
||||
.observable(settingsGet('LanguageAdmin'))
|
||||
.observable(SettingsGet('LanguageAdmin'))
|
||||
.extend({ limitedList: this.languagesAdmin });
|
||||
|
||||
this.theme = ThemeStore.theme;
|
||||
|
|
@ -44,8 +43,8 @@ export class GeneralAdminSettings {
|
|||
this.capaTemplates = CapaAdminStore.templates;
|
||||
|
||||
ko.addObservablesTo(this, {
|
||||
allowLanguagesOnSettings: !!settingsGet('AllowLanguagesOnSettings'),
|
||||
newMoveToFolder: !!settingsGet('NewMoveToFolder'),
|
||||
allowLanguagesOnSettings: !!SettingsGet('AllowLanguagesOnSettings'),
|
||||
newMoveToFolder: !!SettingsGet('NewMoveToFolder'),
|
||||
attachmentLimitTrigger: SaveSettingsStep.Idle,
|
||||
languageTrigger: SaveSettingsStep.Idle,
|
||||
themeTrigger: SaveSettingsStep.Idle
|
||||
|
|
@ -56,10 +55,10 @@ export class GeneralAdminSettings {
|
|||
this.dataFolderAccess = AppAdminStore.dataFolderAccess;
|
||||
|
||||
this.mainAttachmentLimit = ko
|
||||
.observable(pInt(settingsGet('AttachmentLimit')) / (1024 * 1024))
|
||||
.observable(pInt(SettingsGet('AttachmentLimit')) / (1024 * 1024))
|
||||
.extend({ debounce: 500 });
|
||||
|
||||
this.uploadData = settingsGet('PhpUploadSizes');
|
||||
this.uploadData = SettingsGet('PhpUploadSizes');
|
||||
this.uploadDataDesc =
|
||||
this.uploadData && (this.uploadData.upload_max_filesize || this.uploadData.post_max_size)
|
||||
? [
|
||||
|
|
@ -178,7 +177,7 @@ export class GeneralAdminSettings {
|
|||
showScreenPopup(LanguagesPopupView, [
|
||||
this.languageAdmin,
|
||||
this.languagesAdmin(),
|
||||
settingsGet('UserLanguageAdmin')
|
||||
SettingsGet('UserLanguageAdmin')
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,20 +1,20 @@
|
|||
import ko from 'ko';
|
||||
|
||||
import { Settings, SettingsGet } from 'Common/Globals';
|
||||
import { settingsSaveHelperSimpleFunction } from 'Common/Utils';
|
||||
|
||||
import Remote from 'Remote/Admin/Fetch';
|
||||
|
||||
export class LoginAdminSettings {
|
||||
constructor() {
|
||||
const settingsGet = rl.settings.get;
|
||||
ko.addObservablesTo(this, {
|
||||
determineUserLanguage: !!settingsGet('DetermineUserLanguage'),
|
||||
determineUserDomain: !!settingsGet('DetermineUserDomain'),
|
||||
allowLanguagesOnLogin: !!settingsGet('AllowLanguagesOnLogin'),
|
||||
hideSubmitButton: !!rl.settings.app('hideSubmitButton')
|
||||
determineUserLanguage: !!SettingsGet('DetermineUserLanguage'),
|
||||
determineUserDomain: !!SettingsGet('DetermineUserDomain'),
|
||||
allowLanguagesOnLogin: !!SettingsGet('AllowLanguagesOnLogin'),
|
||||
hideSubmitButton: !!Settings.app('hideSubmitButton')
|
||||
});
|
||||
|
||||
this.defaultDomain = ko.observable(settingsGet('LoginDefaultDomain')).idleTrigger();
|
||||
this.defaultDomain = ko.observable(SettingsGet('LoginDefaultDomain')).idleTrigger();
|
||||
}
|
||||
|
||||
onBuild() {
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
import ko from 'ko';
|
||||
|
||||
import { StorageResultType, Notification } from 'Common/Enums';
|
||||
import { SettingsGet } from 'Common/Globals';
|
||||
import { getNotification } from 'Common/Translator';
|
||||
|
||||
import { showScreenPopup } from 'Knoin/Knoin';
|
||||
|
|
@ -13,7 +14,7 @@ import { PluginPopupView } from 'View/Popup/Plugin';
|
|||
|
||||
export class PluginsAdminSettings {
|
||||
constructor() {
|
||||
this.enabledPlugins = ko.observable(!!rl.settings.get('EnabledPlugins'));
|
||||
this.enabledPlugins = ko.observable(!!SettingsGet('EnabledPlugins'));
|
||||
|
||||
this.plugins = PluginAdminStore;
|
||||
this.pluginsError = PluginAdminStore.error;
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
import ko from 'ko';
|
||||
|
||||
import { StorageResultType } from 'Common/Enums';
|
||||
import { SettingsGet } from 'Common/Globals';
|
||||
|
||||
import { AppAdminStore } from 'Stores/Admin/App';
|
||||
import { CapaAdminStore } from 'Stores/Admin/Capa';
|
||||
|
|
@ -9,8 +10,6 @@ import Remote from 'Remote/Admin/Fetch';
|
|||
|
||||
import { decorateKoCommands } from 'Knoin/Knoin';
|
||||
|
||||
const settingsGet = rl.settings.get;
|
||||
|
||||
export class SecurityAdminSettings {
|
||||
constructor() {
|
||||
this.weakPassword = AppAdminStore.weakPassword;
|
||||
|
|
@ -21,16 +20,16 @@ export class SecurityAdminSettings {
|
|||
this.capaTwoFactorAuthForce = CapaAdminStore.twoFactorAuthForce;
|
||||
|
||||
ko.addObservablesTo(this, {
|
||||
useLocalProxyForExternalImages: !!rl.settings.get('UseLocalProxyForExternalImages'),
|
||||
useLocalProxyForExternalImages: !!SettingsGet('UseLocalProxyForExternalImages'),
|
||||
|
||||
verifySslCertificate: !!settingsGet('VerifySslCertificate'),
|
||||
allowSelfSigned: !!settingsGet('AllowSelfSigned'),
|
||||
verifySslCertificate: !!SettingsGet('VerifySslCertificate'),
|
||||
allowSelfSigned: !!SettingsGet('AllowSelfSigned'),
|
||||
|
||||
isTwoFactorDropperShown: false,
|
||||
twoFactorDropperUser: '',
|
||||
twoFactorDropperUserFocused: false,
|
||||
|
||||
adminLogin: settingsGet('AdminLogin'),
|
||||
adminLogin: SettingsGet('AdminLogin'),
|
||||
adminLoginError: false,
|
||||
adminPassword: '',
|
||||
adminPasswordNew: '',
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
import ko from 'ko';
|
||||
|
||||
import { Capa, StorageResultType } from 'Common/Enums';
|
||||
import { Settings } from 'Common/Globals';
|
||||
|
||||
import AccountStore from 'Stores/User/Account';
|
||||
import { IdentityUserStore } from 'Stores/User/Identity';
|
||||
|
|
@ -13,8 +14,8 @@ import { IdentityPopupView } from 'View/Popup/Identity';
|
|||
|
||||
export class AccountsUserSettings {
|
||||
constructor() {
|
||||
this.allowAdditionalAccount = rl.settings.capa(Capa.AdditionalAccounts);
|
||||
this.allowIdentities = rl.settings.capa(Capa.Identities);
|
||||
this.allowAdditionalAccount = Settings.capa(Capa.AdditionalAccounts);
|
||||
this.allowIdentities = Settings.capa(Capa.Identities);
|
||||
|
||||
this.accounts = AccountStore.accounts;
|
||||
this.identities = IdentityUserStore;
|
||||
|
|
|
|||
|
|
@ -1,12 +1,10 @@
|
|||
import ko from 'ko';
|
||||
|
||||
import { MESSAGES_PER_PAGE_VALUES } from 'Common/Consts';
|
||||
|
||||
import { SaveSettingsStep } from 'Common/Enums';
|
||||
import { EditorDefaultType, Layout } from 'Common/EnumsUser';
|
||||
|
||||
import { SettingsGet } from 'Common/Globals';
|
||||
import { settingsSaveHelperSimpleFunction } from 'Common/Utils';
|
||||
|
||||
import { i18n, trigger as translatorTrigger, reload as translatorReload, convertLangName } from 'Common/Translator';
|
||||
|
||||
import { showScreenPopup } from 'Knoin/Knoin';
|
||||
|
|
@ -44,7 +42,7 @@ export class GeneralUserSettings {
|
|||
this.threadsAllowed = AppStore.threadsAllowed;
|
||||
this.useThreads = SettingsStore.useThreads;
|
||||
this.replySameFolder = SettingsStore.replySameFolder;
|
||||
this.allowLanguagesOnSettings = !!rl.settings.get('AllowLanguagesOnSettings');
|
||||
this.allowLanguagesOnSettings = !!SettingsGet('AllowLanguagesOnSettings');
|
||||
|
||||
this.languageFullName = ko.computed(() => convertLangName(this.language()));
|
||||
this.languageTrigger = ko.observable(SaveSettingsStep.Idle).extend({ debounce: 100 });
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ import ko from 'ko';
|
|||
|
||||
import { pInt, settingsSaveHelperSimpleFunction } from 'Common/Utils';
|
||||
import { Capa, SaveSettingsStep } from 'Common/Enums';
|
||||
import { Settings } from 'Common/Globals';
|
||||
import { i18n, trigger as translatorTrigger } from 'Common/Translator';
|
||||
|
||||
import { showScreenPopup } from 'Knoin/Knoin';
|
||||
|
|
@ -14,8 +15,8 @@ import { TwoFactorConfigurationPopupView } from 'View/Popup/TwoFactorConfigurati
|
|||
|
||||
export class SecurityUserSettings {
|
||||
constructor() {
|
||||
this.capaAutoLogout = rl.settings.capa(Capa.AutoLogout);
|
||||
this.capaTwoFactor = rl.settings.capa(Capa.TwoFactor);
|
||||
this.capaAutoLogout = Settings.capa(Capa.AutoLogout);
|
||||
this.capaTwoFactor = Settings.capa(Capa.TwoFactor);
|
||||
|
||||
this.autoLogout = SettinsStore.autoLogout;
|
||||
this.autoLogout.trigger = ko.observable(SaveSettingsStep.Idle);
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ import { SaveSettingsStep, UploadErrorCode, Capa } from 'Common/Enums';
|
|||
import { changeTheme, convertThemeName } from 'Common/Utils';
|
||||
import { userBackground, themePreviewLink, serverRequest } from 'Common/Links';
|
||||
import { i18n } from 'Common/Translator';
|
||||
import { doc, $htmlCL } from 'Common/Globals';
|
||||
import { doc, $htmlCL, Settings } from 'Common/Globals';
|
||||
|
||||
import { ThemeStore } from 'Stores/Theme';
|
||||
|
||||
|
|
@ -23,7 +23,7 @@ export class ThemesUserSettings {
|
|||
this.background.loading = ko.observable(false);
|
||||
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 });
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue