mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-08-30 04:29:21 +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: '',
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue