mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-08-31 21:19:21 +03:00
prettier --write
This commit is contained in:
parent
450528ff00
commit
8a0be3212d
164 changed files with 7053 additions and 9008 deletions
|
|
@ -1,15 +1,14 @@
|
|||
import ko from 'ko';
|
||||
|
||||
import {i18n, trigger as translatorTrigger} from 'Common/Translator';
|
||||
import {appSettingsGet, settingsGet} from 'Storage/Settings';
|
||||
import { i18n, trigger as translatorTrigger } from 'Common/Translator';
|
||||
import { appSettingsGet, settingsGet } from 'Storage/Settings';
|
||||
|
||||
import AppStore from 'Stores/Admin/App';
|
||||
import CoreStore from 'Stores/Admin/Core';
|
||||
|
||||
import {getApp} from 'Helper/Apps/Admin';
|
||||
import { getApp } from 'Helper/Apps/Admin';
|
||||
|
||||
class AboutAdminSettings
|
||||
{
|
||||
class AboutAdminSettings {
|
||||
constructor() {
|
||||
this.version = ko.observable(appSettingsGet('version'));
|
||||
this.access = ko.observable(!!settingsGet('CoreAccess'));
|
||||
|
|
@ -32,35 +31,25 @@ class AboutAdminSettings
|
|||
|
||||
this.coreRemoteVersionHtmlDesc = ko.computed(() => {
|
||||
translatorTrigger();
|
||||
return i18n('TAB_ABOUT/HTML_NEW_VERSION', {'VERSION': this.coreRemoteVersion()});
|
||||
return i18n('TAB_ABOUT/HTML_NEW_VERSION', { 'VERSION': this.coreRemoteVersion() });
|
||||
});
|
||||
|
||||
this.statusType = ko.computed(() => {
|
||||
let type = '';
|
||||
const
|
||||
versionToCompare = this.coreVersionCompare(),
|
||||
const versionToCompare = this.coreVersionCompare(),
|
||||
isChecking = this.coreChecking(),
|
||||
isUpdating = this.coreUpdating(),
|
||||
isReal = this.coreReal();
|
||||
|
||||
if (isChecking)
|
||||
{
|
||||
if (isChecking) {
|
||||
type = 'checking';
|
||||
}
|
||||
else if (isUpdating)
|
||||
{
|
||||
} else if (isUpdating) {
|
||||
type = 'updating';
|
||||
}
|
||||
else if (isReal && 0 === versionToCompare)
|
||||
{
|
||||
} else if (isReal && 0 === versionToCompare) {
|
||||
type = 'up-to-date';
|
||||
}
|
||||
else if (isReal && -1 === versionToCompare)
|
||||
{
|
||||
} else if (isReal && -1 === versionToCompare) {
|
||||
type = 'available';
|
||||
}
|
||||
else if (!isReal)
|
||||
{
|
||||
} else if (!isReal) {
|
||||
type = 'error';
|
||||
this.errorDesc('Cannot access the repository at the moment.');
|
||||
}
|
||||
|
|
@ -70,18 +59,16 @@ class AboutAdminSettings
|
|||
}
|
||||
|
||||
onBuild() {
|
||||
if (this.access() && !this.community)
|
||||
{
|
||||
if (this.access() && !this.community) {
|
||||
getApp().reloadCoreData();
|
||||
}
|
||||
}
|
||||
|
||||
updateCoreData() {
|
||||
if (!this.coreUpdating() && !this.community)
|
||||
{
|
||||
if (!this.coreUpdating() && !this.community) {
|
||||
getApp().updateCoreData();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export {AboutAdminSettings, AboutAdminSettings as default};
|
||||
export { AboutAdminSettings, AboutAdminSettings as default };
|
||||
|
|
|
|||
|
|
@ -1,18 +1,16 @@
|
|||
|
||||
import _ from '_';
|
||||
import ko from 'ko';
|
||||
|
||||
import {Magics} from 'Common/Enums';
|
||||
import {settingsSaveHelperSimpleFunction, trim} from 'Common/Utils';
|
||||
import {i18n, trigger as translatorTrigger} from 'Common/Translator';
|
||||
import { Magics } from 'Common/Enums';
|
||||
import { settingsSaveHelperSimpleFunction, trim } from 'Common/Utils';
|
||||
import { i18n, trigger as translatorTrigger } from 'Common/Translator';
|
||||
|
||||
import Remote from 'Remote/Admin/Ajax';
|
||||
import AppStore from 'Stores/Admin/App';
|
||||
|
||||
import {settingsGet} from 'Storage/Settings';
|
||||
import { settingsGet } from 'Storage/Settings';
|
||||
|
||||
class BrandingAdminSettings
|
||||
{
|
||||
class BrandingAdminSettings {
|
||||
constructor() {
|
||||
this.capa = AppStore.prem;
|
||||
|
||||
|
|
@ -33,9 +31,9 @@ class BrandingAdminSettings
|
|||
this.welcomePageDisplay.options = ko.computed(() => {
|
||||
translatorTrigger();
|
||||
return [
|
||||
{optValue: 'none', optText: i18n('TAB_BRANDING/OPTION_WELCOME_PAGE_DISPLAY_NONE')},
|
||||
{optValue: 'once', optText: i18n('TAB_BRANDING/OPTION_WELCOME_PAGE_DISPLAY_ONCE')},
|
||||
{optValue: 'always', optText: i18n('TAB_BRANDING/OPTION_WELCOME_PAGE_DISPLAY_ALWAYS')}
|
||||
{ optValue: 'none', optText: i18n('TAB_BRANDING/OPTION_WELCOME_PAGE_DISPLAY_NONE') },
|
||||
{ optValue: 'once', optText: i18n('TAB_BRANDING/OPTION_WELCOME_PAGE_DISPLAY_ONCE') },
|
||||
{ optValue: 'always', optText: i18n('TAB_BRANDING/OPTION_WELCOME_PAGE_DISPLAY_ALWAYS') }
|
||||
];
|
||||
});
|
||||
|
||||
|
|
@ -45,8 +43,7 @@ class BrandingAdminSettings
|
|||
|
||||
onBuild() {
|
||||
_.delay(() => {
|
||||
const
|
||||
f1 = settingsSaveHelperSimpleFunction(this.title.trigger, this),
|
||||
const f1 = settingsSaveHelperSimpleFunction(this.title.trigger, this),
|
||||
f2 = settingsSaveHelperSimpleFunction(this.loadingDesc.trigger, this),
|
||||
f3 = settingsSaveHelperSimpleFunction(this.faviconUrl.trigger, this);
|
||||
|
||||
|
|
@ -71,4 +68,4 @@ class BrandingAdminSettings
|
|||
}
|
||||
}
|
||||
|
||||
export {BrandingAdminSettings, BrandingAdminSettings as default};
|
||||
export { BrandingAdminSettings, BrandingAdminSettings as default };
|
||||
|
|
|
|||
|
|
@ -1,32 +1,24 @@
|
|||
|
||||
import _ from '_';
|
||||
import ko from 'ko';
|
||||
|
||||
import {
|
||||
settingsSaveHelperSimpleFunction,
|
||||
defautOptionsAfterRender,
|
||||
inArray, trim, boolToAjax
|
||||
} from 'Common/Utils';
|
||||
import { settingsSaveHelperSimpleFunction, defautOptionsAfterRender, inArray, trim, boolToAjax } from 'Common/Utils';
|
||||
|
||||
import {SaveSettingsStep, StorageResultType, Magics} from 'Common/Enums';
|
||||
import {i18n} from 'Common/Translator';
|
||||
import {settingsGet} from 'Storage/Settings';
|
||||
import { SaveSettingsStep, StorageResultType, Magics } from 'Common/Enums';
|
||||
import { i18n } from 'Common/Translator';
|
||||
import { settingsGet } from 'Storage/Settings';
|
||||
import Remote from 'Remote/Admin/Ajax';
|
||||
import {command} from 'Knoin/Knoin';
|
||||
import { command } from 'Knoin/Knoin';
|
||||
|
||||
class ContactsAdminSettings
|
||||
{
|
||||
class ContactsAdminSettings {
|
||||
constructor() {
|
||||
this.defautOptionsAfterRender = defautOptionsAfterRender;
|
||||
this.enableContacts = ko.observable(!!settingsGet('ContactsEnable'));
|
||||
this.contactsSync = ko.observable(!!settingsGet('ContactsSync'));
|
||||
|
||||
const
|
||||
supportedTypes = [],
|
||||
const supportedTypes = [],
|
||||
types = ['sqlite', 'mysql', 'pgsql'],
|
||||
getTypeName = (name) => {
|
||||
switch (name)
|
||||
{
|
||||
switch (name) {
|
||||
case 'sqlite':
|
||||
name = 'SQLite';
|
||||
break;
|
||||
|
|
@ -42,16 +34,13 @@ class ContactsAdminSettings
|
|||
return name;
|
||||
};
|
||||
|
||||
if (settingsGet('SQLiteIsSupported'))
|
||||
{
|
||||
if (settingsGet('SQLiteIsSupported')) {
|
||||
supportedTypes.push('sqlite');
|
||||
}
|
||||
if (settingsGet('MySqlIsSupported'))
|
||||
{
|
||||
if (settingsGet('MySqlIsSupported')) {
|
||||
supportedTypes.push('mysql');
|
||||
}
|
||||
if (settingsGet('PostgreSqlIsSupported'))
|
||||
{
|
||||
if (settingsGet('PostgreSqlIsSupported')) {
|
||||
supportedTypes.push('pgsql');
|
||||
}
|
||||
|
||||
|
|
@ -70,26 +59,22 @@ class ContactsAdminSettings
|
|||
this.contactsTypes(types);
|
||||
this.contactsType = ko.observable('');
|
||||
|
||||
this.mainContactsType = ko.computed({
|
||||
read: this.contactsType,
|
||||
write: (value) => {
|
||||
if (value !== this.contactsType())
|
||||
{
|
||||
if (-1 < inArray(value, supportedTypes))
|
||||
{
|
||||
this.contactsType(value);
|
||||
}
|
||||
else if (0 < supportedTypes.length)
|
||||
{
|
||||
this.contactsType('');
|
||||
this.mainContactsType = ko
|
||||
.computed({
|
||||
read: this.contactsType,
|
||||
write: (value) => {
|
||||
if (value !== this.contactsType()) {
|
||||
if (-1 < inArray(value, supportedTypes)) {
|
||||
this.contactsType(value);
|
||||
} else if (0 < supportedTypes.length) {
|
||||
this.contactsType('');
|
||||
}
|
||||
} else {
|
||||
this.contactsType.valueHasMutated();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
this.contactsType.valueHasMutated();
|
||||
}
|
||||
}
|
||||
}).extend({notify: 'always'});
|
||||
})
|
||||
.extend({ notify: 'always' });
|
||||
|
||||
this.contactsType.subscribe(() => {
|
||||
this.testContactsSuccess(false);
|
||||
|
|
@ -136,19 +121,13 @@ class ContactsAdminSettings
|
|||
this.testContactsError(false);
|
||||
this.testContactsErrorMessage('');
|
||||
|
||||
if (StorageResultType.Success === result && data && data.Result && data.Result.Result)
|
||||
{
|
||||
if (StorageResultType.Success === result && data && data.Result && data.Result.Result) {
|
||||
this.testContactsSuccess(true);
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
this.testContactsError(true);
|
||||
if (data && data.Result)
|
||||
{
|
||||
if (data && data.Result) {
|
||||
this.testContactsErrorMessage(data.Result.Message || '');
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
this.testContactsErrorMessage('');
|
||||
}
|
||||
}
|
||||
|
|
@ -164,8 +143,7 @@ class ContactsAdminSettings
|
|||
|
||||
onBuild() {
|
||||
_.delay(() => {
|
||||
const
|
||||
f1 = settingsSaveHelperSimpleFunction(this.pdoDsnTrigger, this),
|
||||
const f1 = settingsSaveHelperSimpleFunction(this.pdoDsnTrigger, this),
|
||||
f3 = settingsSaveHelperSimpleFunction(this.pdoUserTrigger, this),
|
||||
f4 = settingsSaveHelperSimpleFunction(this.pdoPasswordTrigger, this),
|
||||
f5 = settingsSaveHelperSimpleFunction(this.contactsTypeTrigger, this);
|
||||
|
|
@ -211,4 +189,4 @@ class ContactsAdminSettings
|
|||
}
|
||||
}
|
||||
|
||||
export {ContactsAdminSettings, ContactsAdminSettings as default};
|
||||
export { ContactsAdminSettings, ContactsAdminSettings as default };
|
||||
|
|
|
|||
|
|
@ -1,17 +1,15 @@
|
|||
|
||||
import _ from '_';
|
||||
import ko from 'ko';
|
||||
|
||||
import {StorageResultType} from 'Common/Enums';
|
||||
import {showScreenPopup} from 'Knoin/Knoin';
|
||||
import { StorageResultType } from 'Common/Enums';
|
||||
import { showScreenPopup } from 'Knoin/Knoin';
|
||||
|
||||
import DomainStore from 'Stores/Admin/Domain';
|
||||
import Remote from 'Remote/Admin/Ajax';
|
||||
|
||||
import {getApp} from 'Helper/Apps/Admin';
|
||||
import { getApp } from 'Helper/Apps/Admin';
|
||||
|
||||
class DomainsAdminSettings
|
||||
{
|
||||
class DomainsAdminSettings {
|
||||
constructor() {
|
||||
this.domains = DomainStore.domains;
|
||||
|
||||
|
|
@ -43,21 +41,19 @@ class DomainsAdminSettings
|
|||
|
||||
onBuild(oDom) {
|
||||
const self = this;
|
||||
oDom
|
||||
.on('click', '.b-admin-domains-list-table .e-item .e-action', function() { // eslint-disable-line prefer-arrow-callback
|
||||
const domainItem = ko.dataFor(this); // eslint-disable-line no-invalid-this
|
||||
if (domainItem)
|
||||
{
|
||||
Remote.domain(self.onDomainLoadRequest, domainItem.name);
|
||||
}
|
||||
});
|
||||
oDom.on('click', '.b-admin-domains-list-table .e-item .e-action', function() {
|
||||
// eslint-disable-line prefer-arrow-callback
|
||||
const domainItem = ko.dataFor(this); // eslint-disable-line no-invalid-this
|
||||
if (domainItem) {
|
||||
Remote.domain(self.onDomainLoadRequest, domainItem.name);
|
||||
}
|
||||
});
|
||||
|
||||
getApp().reloadDomainList();
|
||||
}
|
||||
|
||||
onDomainLoadRequest(sResult, oData) {
|
||||
if (StorageResultType.Success === sResult && oData && oData.Result)
|
||||
{
|
||||
if (StorageResultType.Success === sResult && oData && oData.Result) {
|
||||
showScreenPopup(require('View/Popup/Domain'), [oData.Result]);
|
||||
}
|
||||
}
|
||||
|
|
@ -67,4 +63,4 @@ class DomainsAdminSettings
|
|||
}
|
||||
}
|
||||
|
||||
export {DomainsAdminSettings, DomainsAdminSettings as default};
|
||||
export { DomainsAdminSettings, DomainsAdminSettings as default };
|
||||
|
|
|
|||
|
|
@ -1,18 +1,22 @@
|
|||
|
||||
import _ from '_';
|
||||
import ko from 'ko';
|
||||
|
||||
import {
|
||||
trim, pInt, boolToAjax, settingsSaveHelperSimpleFunction,
|
||||
changeTheme, convertThemeName, convertLangName
|
||||
trim,
|
||||
pInt,
|
||||
boolToAjax,
|
||||
settingsSaveHelperSimpleFunction,
|
||||
changeTheme,
|
||||
convertThemeName,
|
||||
convertLangName
|
||||
} from 'Common/Utils';
|
||||
|
||||
import {SaveSettingsStep, Magics} from 'Common/Enums';
|
||||
import {reload as translatorReload} from 'Common/Translator';
|
||||
import {phpInfo} from 'Common/Links';
|
||||
import { SaveSettingsStep, Magics } from 'Common/Enums';
|
||||
import { reload as translatorReload } from 'Common/Translator';
|
||||
import { phpInfo } from 'Common/Links';
|
||||
|
||||
import {settingsGet} from 'Storage/Settings';
|
||||
import {showScreenPopup} from 'Knoin/Knoin';
|
||||
import { settingsGet } from 'Storage/Settings';
|
||||
import { showScreenPopup } from 'Knoin/Knoin';
|
||||
|
||||
import Remote from 'Remote/Admin/Ajax';
|
||||
|
||||
|
|
@ -21,8 +25,7 @@ import LanguageStore from 'Stores/Language';
|
|||
import AppAdminStore from 'Stores/Admin/App';
|
||||
import CapaAdminStore from 'Stores/Admin/Capa';
|
||||
|
||||
class GeneralAdminSettings
|
||||
{
|
||||
class GeneralAdminSettings {
|
||||
constructor() {
|
||||
this.language = LanguageStore.language;
|
||||
this.languages = LanguageStore.languages;
|
||||
|
|
@ -46,29 +49,37 @@ class GeneralAdminSettings
|
|||
|
||||
this.dataFolderAccess = AppAdminStore.dataFolderAccess;
|
||||
|
||||
this.mainAttachmentLimit = ko.observable(pInt(settingsGet('AttachmentLimit')) / (Magics.BitLength1024 * Magics.BitLength1024)).extend({posInterer: 25});
|
||||
this.mainAttachmentLimit = ko
|
||||
.observable(pInt(settingsGet('AttachmentLimit')) / (Magics.BitLength1024 * Magics.BitLength1024))
|
||||
.extend({ posInterer: 25 });
|
||||
|
||||
this.uploadData = settingsGet('PhpUploadSizes');
|
||||
this.uploadDataDesc = this.uploadData && (this.uploadData.upload_max_filesize || this.uploadData.post_max_size) ? [
|
||||
this.uploadData.upload_max_filesize ? 'upload_max_filesize = ' + this.uploadData.upload_max_filesize + '; ' : '',
|
||||
this.uploadData.post_max_size ? 'post_max_size = ' + this.uploadData.post_max_size : ''
|
||||
].join('') : '';
|
||||
this.uploadDataDesc =
|
||||
this.uploadData && (this.uploadData.upload_max_filesize || this.uploadData.post_max_size)
|
||||
? [
|
||||
this.uploadData.upload_max_filesize
|
||||
? 'upload_max_filesize = ' + this.uploadData.upload_max_filesize + '; '
|
||||
: '',
|
||||
this.uploadData.post_max_size ? 'post_max_size = ' + this.uploadData.post_max_size : ''
|
||||
].join('')
|
||||
: '';
|
||||
|
||||
this.themesOptions = ko.computed(() => _.map(this.themes(), (theme) => ({optValue: theme, optText: convertThemeName(theme)})));
|
||||
this.themesOptions = ko.computed(() =>
|
||||
_.map(this.themes(), (theme) => ({ optValue: theme, optText: convertThemeName(theme) }))
|
||||
);
|
||||
|
||||
this.languageFullName = ko.computed(() => convertLangName(this.language()));
|
||||
this.languageAdminFullName = ko.computed(() => convertLangName(this.languageAdmin()));
|
||||
|
||||
this.attachmentLimitTrigger = ko.observable(SaveSettingsStep.Idle);
|
||||
this.languageTrigger = ko.observable(SaveSettingsStep.Idle);
|
||||
this.languageAdminTrigger = ko.observable(SaveSettingsStep.Idle).extend({throttle: Magics.Time100ms});
|
||||
this.languageAdminTrigger = ko.observable(SaveSettingsStep.Idle).extend({ throttle: Magics.Time100ms });
|
||||
this.themeTrigger = ko.observable(SaveSettingsStep.Idle);
|
||||
}
|
||||
|
||||
onBuild() {
|
||||
_.delay(() => {
|
||||
const
|
||||
f1 = settingsSaveHelperSimpleFunction(this.attachmentLimitTrigger, this),
|
||||
const f1 = settingsSaveHelperSimpleFunction(this.attachmentLimitTrigger, this),
|
||||
f2 = settingsSaveHelperSimpleFunction(this.languageTrigger, this),
|
||||
f3 = settingsSaveHelperSimpleFunction(this.themeTrigger, this),
|
||||
fReloadLanguageHelper = (saveSettingsStep) => () => {
|
||||
|
|
@ -90,14 +101,13 @@ class GeneralAdminSettings
|
|||
|
||||
this.languageAdmin.subscribe((value) => {
|
||||
this.languageAdminTrigger(SaveSettingsStep.Animate);
|
||||
translatorReload(true, value).then(
|
||||
fReloadLanguageHelper(SaveSettingsStep.TrueResult),
|
||||
fReloadLanguageHelper(SaveSettingsStep.FalseResult)
|
||||
).then(() => {
|
||||
Remote.saveAdminConfig(null, {
|
||||
'LanguageAdmin': trim(value)
|
||||
translatorReload(true, value)
|
||||
.then(fReloadLanguageHelper(SaveSettingsStep.TrueResult), fReloadLanguageHelper(SaveSettingsStep.FalseResult))
|
||||
.then(() => {
|
||||
Remote.saveAdminConfig(null, {
|
||||
'LanguageAdmin': trim(value)
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
this.theme.subscribe((value) => {
|
||||
|
|
@ -164,14 +174,14 @@ class GeneralAdminSettings
|
|||
}
|
||||
|
||||
selectLanguage() {
|
||||
showScreenPopup(require('View/Popup/Languages'), [
|
||||
this.language, this.languages(), LanguageStore.userLanguage()
|
||||
]);
|
||||
showScreenPopup(require('View/Popup/Languages'), [this.language, this.languages(), LanguageStore.userLanguage()]);
|
||||
}
|
||||
|
||||
selectLanguageAdmin() {
|
||||
showScreenPopup(require('View/Popup/Languages'), [
|
||||
this.languageAdmin, this.languagesAdmin(), LanguageStore.userLanguageAdmin()
|
||||
this.languageAdmin,
|
||||
this.languagesAdmin(),
|
||||
LanguageStore.userLanguageAdmin()
|
||||
]);
|
||||
}
|
||||
|
||||
|
|
@ -183,4 +193,4 @@ class GeneralAdminSettings
|
|||
}
|
||||
}
|
||||
|
||||
export {GeneralAdminSettings, GeneralAdminSettings as default};
|
||||
export { GeneralAdminSettings, GeneralAdminSettings as default };
|
||||
|
|
|
|||
|
|
@ -1,16 +1,14 @@
|
|||
|
||||
import _ from '_';
|
||||
import ko from 'ko';
|
||||
|
||||
import {settingsSaveHelperSimpleFunction, boolToAjax, trim} from 'Common/Utils';
|
||||
import {settingsGet} from 'Storage/Settings';
|
||||
import { settingsSaveHelperSimpleFunction, boolToAjax, trim } from 'Common/Utils';
|
||||
import { settingsGet } from 'Storage/Settings';
|
||||
|
||||
import AppStore from 'Stores/Admin/App';
|
||||
|
||||
import Remote from 'Remote/Admin/Ajax';
|
||||
|
||||
class LoginAdminSettings
|
||||
{
|
||||
class LoginAdminSettings {
|
||||
constructor() {
|
||||
this.determineUserLanguage = AppStore.determineUserLanguage;
|
||||
this.determineUserDomain = AppStore.determineUserDomain;
|
||||
|
|
@ -52,4 +50,4 @@ class LoginAdminSettings
|
|||
}
|
||||
}
|
||||
|
||||
export {LoginAdminSettings, LoginAdminSettings as default};
|
||||
export { LoginAdminSettings, LoginAdminSettings as default };
|
||||
|
|
|
|||
|
|
@ -1,18 +1,16 @@
|
|||
|
||||
import window from 'window';
|
||||
import _ from '_';
|
||||
import ko from 'ko';
|
||||
|
||||
import {StorageResultType, Notification} from 'Common/Enums';
|
||||
import {getNotification} from 'Common/Translator';
|
||||
import { StorageResultType, Notification } from 'Common/Enums';
|
||||
import { getNotification } from 'Common/Translator';
|
||||
|
||||
import PackageStore from 'Stores/Admin/Package';
|
||||
import Remote from 'Remote/Admin/Ajax';
|
||||
|
||||
import {getApp} from 'Helper/Apps/Admin';
|
||||
import { getApp } from 'Helper/Apps/Admin';
|
||||
|
||||
class PackagesAdminSettings
|
||||
{
|
||||
class PackagesAdminSettings {
|
||||
constructor() {
|
||||
this.packagesError = ko.observable('');
|
||||
|
||||
|
|
@ -37,54 +35,44 @@ class PackagesAdminSettings
|
|||
|
||||
requestHelper(packageToRequest, install) {
|
||||
return (result, data) => {
|
||||
|
||||
if (StorageResultType.Success !== result || !data || !data.Result)
|
||||
{
|
||||
if (data && data.ErrorCode)
|
||||
{
|
||||
if (StorageResultType.Success !== result || !data || !data.Result) {
|
||||
if (data && data.ErrorCode) {
|
||||
this.packagesError(getNotification(data.ErrorCode));
|
||||
}
|
||||
else
|
||||
{
|
||||
this.packagesError(getNotification(
|
||||
install ? Notification.CantInstallPackage : Notification.CantDeletePackage));
|
||||
} else {
|
||||
this.packagesError(
|
||||
getNotification(install ? Notification.CantInstallPackage : Notification.CantDeletePackage)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
_.each(this.packages(), (item) => {
|
||||
if (item && packageToRequest && item.loading && item.loading() && packageToRequest.file === item.file)
|
||||
{
|
||||
if (item && packageToRequest && item.loading && item.loading() && packageToRequest.file === item.file) {
|
||||
packageToRequest.loading(false);
|
||||
item.loading(false);
|
||||
}
|
||||
});
|
||||
|
||||
if (StorageResultType.Success === result && data && data.Result && data.Result.Reload)
|
||||
{
|
||||
if (StorageResultType.Success === result && data && data.Result && data.Result.Reload) {
|
||||
window.location.reload();
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
getApp().reloadPackagesList();
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
deletePackage(packageToDelete) {
|
||||
if (packageToDelete)
|
||||
{
|
||||
if (packageToDelete) {
|
||||
packageToDelete.loading(true);
|
||||
Remote.packageDelete(this.requestHelper(packageToDelete, false), packageToDelete);
|
||||
}
|
||||
}
|
||||
|
||||
installPackage(packageToInstall) {
|
||||
if (packageToInstall)
|
||||
{
|
||||
if (packageToInstall) {
|
||||
packageToInstall.loading(true);
|
||||
Remote.packageInstall(this.requestHelper(packageToInstall, true), packageToInstall);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export {PackagesAdminSettings, PackagesAdminSettings as default};
|
||||
export { PackagesAdminSettings, PackagesAdminSettings as default };
|
||||
|
|
|
|||
|
|
@ -1,22 +1,21 @@
|
|||
import _ from '_';
|
||||
import ko from 'ko';
|
||||
|
||||
import {StorageResultType, Notification} from 'Common/Enums';
|
||||
import {getNotification} from 'Common/Translator';
|
||||
import {boolToAjax} from 'Common/Utils';
|
||||
import { StorageResultType, Notification } from 'Common/Enums';
|
||||
import { getNotification } from 'Common/Translator';
|
||||
import { boolToAjax } from 'Common/Utils';
|
||||
|
||||
import {settingsGet} from 'Storage/Settings';
|
||||
import {showScreenPopup} from 'Knoin/Knoin';
|
||||
import { settingsGet } from 'Storage/Settings';
|
||||
import { showScreenPopup } from 'Knoin/Knoin';
|
||||
|
||||
import AppStore from 'Stores/Admin/App';
|
||||
import PluginStore from 'Stores/Admin/Plugin';
|
||||
|
||||
import Remote from 'Remote/Admin/Ajax';
|
||||
|
||||
import {getApp} from 'Helper/Apps/Admin';
|
||||
import { getApp } from 'Helper/Apps/Admin';
|
||||
|
||||
class PluginsAdminSettings
|
||||
{
|
||||
class PluginsAdminSettings {
|
||||
constructor() {
|
||||
this.enabledPlugins = ko.observable(!!settingsGet('EnabledPlugins'));
|
||||
|
||||
|
|
@ -41,21 +40,20 @@ class PluginsAdminSettings
|
|||
}
|
||||
|
||||
onBuild(oDom) {
|
||||
|
||||
const self = this;
|
||||
|
||||
oDom
|
||||
.on('click', '.e-item .configure-plugin-action', function() { // eslint-disable-line prefer-arrow-callback
|
||||
.on('click', '.e-item .configure-plugin-action', function() {
|
||||
// eslint-disable-line prefer-arrow-callback
|
||||
const plugin = ko.dataFor(this); // eslint-disable-line no-invalid-this
|
||||
if (plugin)
|
||||
{
|
||||
if (plugin) {
|
||||
self.configurePlugin(plugin);
|
||||
}
|
||||
})
|
||||
.on('click', '.e-item .disabled-plugin', function() { // eslint-disable-line prefer-arrow-callback
|
||||
.on('click', '.e-item .disabled-plugin', function() {
|
||||
// eslint-disable-line prefer-arrow-callback
|
||||
const plugin = ko.dataFor(this); // eslint-disable-line no-invalid-this
|
||||
if (plugin)
|
||||
{
|
||||
if (plugin) {
|
||||
self.disablePlugin(plugin);
|
||||
}
|
||||
});
|
||||
|
|
@ -73,23 +71,17 @@ class PluginsAdminSettings
|
|||
}
|
||||
|
||||
onPluginLoadRequest(result, data) {
|
||||
if (StorageResultType.Success === result && data && data.Result)
|
||||
{
|
||||
if (StorageResultType.Success === result && data && data.Result) {
|
||||
showScreenPopup(require('View/Popup/Plugin'), [data.Result]);
|
||||
}
|
||||
}
|
||||
|
||||
onPluginDisableRequest(result, data) {
|
||||
if (StorageResultType.Success === result && data)
|
||||
{
|
||||
if (!data.Result && data.ErrorCode)
|
||||
{
|
||||
if (Notification.UnsupportedPluginPackage === data.ErrorCode && data.ErrorMessage && '' !== data.ErrorMessage)
|
||||
{
|
||||
if (StorageResultType.Success === result && data) {
|
||||
if (!data.Result && data.ErrorCode) {
|
||||
if (Notification.UnsupportedPluginPackage === data.ErrorCode && data.ErrorMessage && '' !== data.ErrorMessage) {
|
||||
PluginStore.plugins.error(data.ErrorMessage);
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
PluginStore.plugins.error(getNotification(data.ErrorCode));
|
||||
}
|
||||
}
|
||||
|
|
@ -99,4 +91,4 @@ class PluginsAdminSettings
|
|||
}
|
||||
}
|
||||
|
||||
export {PluginsAdminSettings, PluginsAdminSettings as default};
|
||||
export { PluginsAdminSettings, PluginsAdminSettings as default };
|
||||
|
|
|
|||
|
|
@ -1,23 +1,18 @@
|
|||
|
||||
import _ from '_';
|
||||
import {settingsSaveHelperSimpleFunction, trim, boolToAjax} from 'Common/Utils';
|
||||
import {Magics} from 'Common/Enums';
|
||||
import { settingsSaveHelperSimpleFunction, trim, boolToAjax } from 'Common/Utils';
|
||||
import { Magics } from 'Common/Enums';
|
||||
|
||||
import Remote from 'Remote/Admin/Ajax';
|
||||
|
||||
import {BrandingAdminSettings} from 'Settings/Admin/Branding';
|
||||
import { BrandingAdminSettings } from 'Settings/Admin/Branding';
|
||||
|
||||
class BrandingPremAdminSettings extends BrandingAdminSettings
|
||||
{
|
||||
class BrandingPremAdminSettings extends BrandingAdminSettings {
|
||||
onBuild(dom) {
|
||||
super.onBuild(dom);
|
||||
|
||||
if (this.capa && this.capa() && !this.community)
|
||||
{
|
||||
if (this.capa && this.capa() && !this.community) {
|
||||
_.delay(() => {
|
||||
|
||||
const
|
||||
f1 = settingsSaveHelperSimpleFunction(this.loginLogo.trigger, this),
|
||||
const f1 = settingsSaveHelperSimpleFunction(this.loginLogo.trigger, this),
|
||||
f2 = settingsSaveHelperSimpleFunction(this.loginDescription.trigger, this),
|
||||
f3 = settingsSaveHelperSimpleFunction(this.loginCss.trigger, this),
|
||||
f4 = settingsSaveHelperSimpleFunction(this.userLogo.trigger, this),
|
||||
|
|
@ -100,10 +95,9 @@ class BrandingPremAdminSettings extends BrandingAdminSettings
|
|||
'LoginPowered': boolToAjax(value)
|
||||
});
|
||||
});
|
||||
|
||||
}, Magics.Time50ms);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export {BrandingPremAdminSettings, BrandingPremAdminSettings as default};
|
||||
export { BrandingPremAdminSettings, BrandingPremAdminSettings as default };
|
||||
|
|
|
|||
|
|
@ -1,16 +1,14 @@
|
|||
|
||||
import ko from 'ko';
|
||||
import moment from 'moment';
|
||||
|
||||
import {settingsGet} from 'Storage/Settings';
|
||||
import {showScreenPopup} from 'Knoin/Knoin';
|
||||
import { settingsGet } from 'Storage/Settings';
|
||||
import { showScreenPopup } from 'Knoin/Knoin';
|
||||
|
||||
import LicenseStore from 'Stores/Admin/License';
|
||||
|
||||
import {getApp} from 'Helper/Apps/Admin';
|
||||
import { getApp } from 'Helper/Apps/Admin';
|
||||
|
||||
class LicensingPremAdminSettings
|
||||
{
|
||||
class LicensingPremAdminSettings {
|
||||
constructor() {
|
||||
this.licensing = LicenseStore.licensing;
|
||||
this.licensingProcess = LicenseStore.licensingProcess;
|
||||
|
|
@ -23,16 +21,14 @@ class LicensingPremAdminSettings
|
|||
this.subscriptionEnabled = ko.observable(!!settingsGet('SubscriptionEnabled'));
|
||||
|
||||
this.licenseTrigger.subscribe(() => {
|
||||
if (this.subscriptionEnabled())
|
||||
{
|
||||
if (this.subscriptionEnabled()) {
|
||||
getApp().reloadLicensing(true);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
onBuild() {
|
||||
if (this.subscriptionEnabled())
|
||||
{
|
||||
if (this.subscriptionEnabled()) {
|
||||
getApp().reloadLicensing(false);
|
||||
}
|
||||
}
|
||||
|
|
@ -60,12 +56,11 @@ class LicensingPremAdminSettings
|
|||
* @returns {string}
|
||||
*/
|
||||
licenseExpiredMomentValue() {
|
||||
const
|
||||
time = this.licenseExpired(),
|
||||
const time = this.licenseExpired(),
|
||||
momentUnix = moment.unix(time);
|
||||
|
||||
return this.licenseIsUnlim() ? 'Never' : (time && (momentUnix.format('LL') + ' (' + momentUnix.from(moment()) + ')'));
|
||||
return this.licenseIsUnlim() ? 'Never' : time && momentUnix.format('LL') + ' (' + momentUnix.from(moment()) + ')';
|
||||
}
|
||||
}
|
||||
|
||||
export {LicensingPremAdminSettings, LicensingPremAdminSettings as default};
|
||||
export { LicensingPremAdminSettings, LicensingPremAdminSettings as default };
|
||||
|
|
|
|||
|
|
@ -1,22 +1,20 @@
|
|||
|
||||
import _ from '_';
|
||||
import ko from 'ko';
|
||||
|
||||
import {trim, boolToAjax} from 'Common/Utils';
|
||||
import {phpInfo} from 'Common/Links';
|
||||
import {StorageResultType, Magics} from 'Common/Enums';
|
||||
import { trim, boolToAjax } from 'Common/Utils';
|
||||
import { phpInfo } from 'Common/Links';
|
||||
import { StorageResultType, Magics } from 'Common/Enums';
|
||||
|
||||
import {settingsGet} from 'Storage/Settings';
|
||||
import { settingsGet } from 'Storage/Settings';
|
||||
|
||||
import AppAdminStore from 'Stores/Admin/App';
|
||||
import CapaAdminStore from 'Stores/Admin/Capa';
|
||||
|
||||
import Remote from 'Remote/Admin/Ajax';
|
||||
|
||||
import {command} from 'Knoin/Knoin';
|
||||
import { command } from 'Knoin/Knoin';
|
||||
|
||||
class SecurityAdminSettings
|
||||
{
|
||||
class SecurityAdminSettings {
|
||||
constructor() {
|
||||
this.useLocalProxyForExternalImages = AppAdminStore.useLocalProxyForExternalImages;
|
||||
|
||||
|
|
@ -28,8 +26,7 @@ class SecurityAdminSettings
|
|||
this.capaTwoFactorAuthForce = CapaAdminStore.twoFactorAuthForce;
|
||||
|
||||
this.capaTwoFactorAuth.subscribe((value) => {
|
||||
if (!value)
|
||||
{
|
||||
if (!value) {
|
||||
this.capaTwoFactorAuthForce(false);
|
||||
}
|
||||
});
|
||||
|
|
@ -38,8 +35,7 @@ class SecurityAdminSettings
|
|||
this.allowSelfSigned = ko.observable(!!settingsGet('AllowSelfSigned'));
|
||||
|
||||
this.verifySslCertificate.subscribe((value) => {
|
||||
if (!value)
|
||||
{
|
||||
if (!value) {
|
||||
this.allowSelfSigned(true);
|
||||
}
|
||||
});
|
||||
|
|
@ -84,15 +80,12 @@ class SecurityAdminSettings
|
|||
|
||||
@command((self) => '' !== trim(self.adminLogin()) && '' !== self.adminPassword())
|
||||
saveNewAdminPasswordCommand() {
|
||||
|
||||
if ('' === trim(this.adminLogin()))
|
||||
{
|
||||
if ('' === trim(this.adminLogin())) {
|
||||
this.adminLoginError(true);
|
||||
return false;
|
||||
}
|
||||
|
||||
if (this.adminPasswordNew() !== this.adminPasswordNew2())
|
||||
{
|
||||
if (this.adminPasswordNew() !== this.adminPasswordNew2()) {
|
||||
this.adminPasswordNewError(true);
|
||||
return false;
|
||||
}
|
||||
|
|
@ -119,8 +112,7 @@ class SecurityAdminSettings
|
|||
}
|
||||
|
||||
onNewAdminPasswordResponse(result, data) {
|
||||
if (StorageResultType.Success === result && data && data.Result)
|
||||
{
|
||||
if (StorageResultType.Success === result && data && data.Result) {
|
||||
this.adminPassword('');
|
||||
this.adminPasswordNew('');
|
||||
this.adminPasswordNew2('');
|
||||
|
|
@ -128,9 +120,7 @@ class SecurityAdminSettings
|
|||
this.adminPasswordUpdateSuccess(true);
|
||||
|
||||
this.weakPassword(!!data.Result.Weak);
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
this.adminPasswordUpdateError(true);
|
||||
}
|
||||
}
|
||||
|
|
@ -191,4 +181,4 @@ class SecurityAdminSettings
|
|||
}
|
||||
}
|
||||
|
||||
export {SecurityAdminSettings, SecurityAdminSettings as default};
|
||||
export { SecurityAdminSettings, SecurityAdminSettings as default };
|
||||
|
|
|
|||
|
|
@ -1,16 +1,14 @@
|
|||
|
||||
import _ from '_';
|
||||
import ko from 'ko';
|
||||
|
||||
import {SaveSettingsStep, Magics} from 'Common/Enums';
|
||||
import {settingsSaveHelperSimpleFunction, trim, boolToAjax} from 'Common/Utils';
|
||||
import { SaveSettingsStep, Magics } from 'Common/Enums';
|
||||
import { settingsSaveHelperSimpleFunction, trim, boolToAjax } from 'Common/Utils';
|
||||
|
||||
import SocialStore from 'Stores/Social';
|
||||
|
||||
import Remote from 'Remote/Admin/Ajax';
|
||||
|
||||
class SocialAdminSettings
|
||||
{
|
||||
class SocialAdminSettings {
|
||||
constructor() {
|
||||
this.googleEnable = SocialStore.google.enabled;
|
||||
this.googleEnableAuth = SocialStore.google.capa.auth;
|
||||
|
|
@ -52,8 +50,7 @@ class SocialAdminSettings
|
|||
|
||||
onBuild() {
|
||||
_.delay(() => {
|
||||
const
|
||||
f1 = settingsSaveHelperSimpleFunction(this.facebookTrigger1, this),
|
||||
const f1 = settingsSaveHelperSimpleFunction(this.facebookTrigger1, this),
|
||||
f2 = settingsSaveHelperSimpleFunction(this.facebookTrigger2, this),
|
||||
f3 = settingsSaveHelperSimpleFunction(this.twitterTrigger1, this),
|
||||
f4 = settingsSaveHelperSimpleFunction(this.twitterTrigger2, this),
|
||||
|
|
@ -63,8 +60,7 @@ class SocialAdminSettings
|
|||
f8 = settingsSaveHelperSimpleFunction(this.dropboxTrigger1, this);
|
||||
|
||||
this.facebookEnable.subscribe((value) => {
|
||||
if (this.facebookSupported())
|
||||
{
|
||||
if (this.facebookSupported()) {
|
||||
Remote.saveAdminConfig(null, {
|
||||
'FacebookEnable': boolToAjax(value)
|
||||
});
|
||||
|
|
@ -72,8 +68,7 @@ class SocialAdminSettings
|
|||
});
|
||||
|
||||
this.facebookAppID.subscribe((value) => {
|
||||
if (this.facebookSupported())
|
||||
{
|
||||
if (this.facebookSupported()) {
|
||||
Remote.saveAdminConfig(f1, {
|
||||
'FacebookAppID': trim(value)
|
||||
});
|
||||
|
|
@ -81,8 +76,7 @@ class SocialAdminSettings
|
|||
});
|
||||
|
||||
this.facebookAppSecret.subscribe((value) => {
|
||||
if (this.facebookSupported())
|
||||
{
|
||||
if (this.facebookSupported()) {
|
||||
Remote.saveAdminConfig(f2, {
|
||||
'FacebookAppSecret': trim(value)
|
||||
});
|
||||
|
|
@ -107,4 +101,4 @@ class SocialAdminSettings
|
|||
}
|
||||
}
|
||||
|
||||
export {SocialAdminSettings, SocialAdminSettings as default};
|
||||
export { SocialAdminSettings, SocialAdminSettings as default };
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue