mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-08-29 20:19:22 +03:00
Road to the MIT
This commit is contained in:
parent
13d05dc2ff
commit
aa5d3fc89d
75 changed files with 392 additions and 2283 deletions
|
|
@ -3,7 +3,6 @@ import ko from 'ko';
|
|||
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';
|
||||
|
|
@ -27,8 +26,6 @@ class AboutAdminSettings {
|
|||
this.coreRemoteRelease = CoreStore.coreRemoteRelease;
|
||||
this.coreVersionCompare = CoreStore.coreVersionCompare;
|
||||
|
||||
this.community = RL_COMMUNITY || AppStore.community();
|
||||
|
||||
this.coreRemoteVersionHtmlDesc = ko.computed(() => {
|
||||
translatorTrigger();
|
||||
return i18n('TAB_ABOUT/HTML_NEW_VERSION', { 'VERSION': this.coreRemoteVersion() });
|
||||
|
|
@ -59,13 +56,13 @@ class AboutAdminSettings {
|
|||
}
|
||||
|
||||
onBuild() {
|
||||
if (this.access() && !this.community) {
|
||||
if (this.access()) {
|
||||
getApp().reloadCoreData();
|
||||
}
|
||||
}
|
||||
|
||||
updateCoreData() {
|
||||
if (!this.coreUpdating() && !this.community) {
|
||||
if (!this.coreUpdating()) {
|
||||
getApp().updateCoreData();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,14 +6,11 @@ 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';
|
||||
|
||||
class BrandingAdminSettings {
|
||||
constructor() {
|
||||
this.capa = AppStore.prem;
|
||||
|
||||
this.title = ko.observable(settingsGet('Title')).idleTrigger();
|
||||
this.loadingDesc = ko.observable(settingsGet('LoadingDescription')).idleTrigger();
|
||||
this.faviconUrl = ko.observable(settingsGet('FaviconUrl')).idleTrigger();
|
||||
|
|
@ -36,8 +33,6 @@ class BrandingAdminSettings {
|
|||
{ optValue: 'always', optText: i18n('TAB_BRANDING/OPTION_WELCOME_PAGE_DISPLAY_ALWAYS') }
|
||||
];
|
||||
});
|
||||
|
||||
this.community = RL_COMMUNITY || AppStore.community();
|
||||
}
|
||||
|
||||
onBuild() {
|
||||
|
|
@ -64,6 +59,86 @@ class BrandingAdminSettings {
|
|||
});
|
||||
});
|
||||
}, Magics.Time50ms);
|
||||
|
||||
_.delay(() => {
|
||||
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),
|
||||
f5 = settingsSaveHelperSimpleFunction(this.userLogoTitle.trigger, this),
|
||||
f6 = settingsSaveHelperSimpleFunction(this.loginBackground.trigger, this),
|
||||
f7 = settingsSaveHelperSimpleFunction(this.userCss.trigger, this),
|
||||
f8 = settingsSaveHelperSimpleFunction(this.welcomePageUrl.trigger, this),
|
||||
f9 = settingsSaveHelperSimpleFunction(this.welcomePageDisplay.trigger, this),
|
||||
f10 = settingsSaveHelperSimpleFunction(this.userLogoMessage.trigger, this),
|
||||
f11 = settingsSaveHelperSimpleFunction(this.userIframeMessage.trigger, this);
|
||||
|
||||
this.loginLogo.subscribe((value) => {
|
||||
Remote.saveAdminConfig(f1, {
|
||||
'LoginLogo': trim(value)
|
||||
});
|
||||
});
|
||||
|
||||
this.loginDescription.subscribe((value) => {
|
||||
Remote.saveAdminConfig(f2, {
|
||||
'LoginDescription': trim(value)
|
||||
});
|
||||
});
|
||||
|
||||
this.loginCss.subscribe((value) => {
|
||||
Remote.saveAdminConfig(f3, {
|
||||
'LoginCss': trim(value)
|
||||
});
|
||||
});
|
||||
|
||||
this.userLogo.subscribe((value) => {
|
||||
Remote.saveAdminConfig(f4, {
|
||||
'UserLogo': trim(value)
|
||||
});
|
||||
});
|
||||
|
||||
this.userLogoTitle.subscribe((value) => {
|
||||
Remote.saveAdminConfig(f5, {
|
||||
'UserLogoTitle': trim(value)
|
||||
});
|
||||
});
|
||||
|
||||
this.userLogoMessage.subscribe((value) => {
|
||||
Remote.saveAdminConfig(f10, {
|
||||
'UserLogoMessage': trim(value)
|
||||
});
|
||||
});
|
||||
|
||||
this.userIframeMessage.subscribe((value) => {
|
||||
Remote.saveAdminConfig(f11, {
|
||||
'UserIframeMessage': trim(value)
|
||||
});
|
||||
});
|
||||
|
||||
this.loginBackground.subscribe((value) => {
|
||||
Remote.saveAdminConfig(f6, {
|
||||
'LoginBackground': trim(value)
|
||||
});
|
||||
});
|
||||
|
||||
this.userCss.subscribe((value) => {
|
||||
Remote.saveAdminConfig(f7, {
|
||||
'UserCss': trim(value)
|
||||
});
|
||||
});
|
||||
|
||||
this.welcomePageUrl.subscribe((value) => {
|
||||
Remote.saveAdminConfig(f8, {
|
||||
'WelcomePageUrl': trim(value)
|
||||
});
|
||||
});
|
||||
|
||||
this.welcomePageDisplay.subscribe((value) => {
|
||||
Remote.saveAdminConfig(f9, {
|
||||
'WelcomePageDisplay': trim(value)
|
||||
});
|
||||
});
|
||||
}, Magics.Time50ms);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -8,7 +8,6 @@ import { boolToAjax } from 'Common/Utils';
|
|||
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';
|
||||
|
|
@ -22,8 +21,6 @@ class PluginsAdminSettings {
|
|||
this.plugins = PluginStore.plugins;
|
||||
this.pluginsError = PluginStore.plugins.error;
|
||||
|
||||
this.community = RL_COMMUNITY || AppStore.community();
|
||||
|
||||
this.visibility = ko.computed(() => (PluginStore.plugins.loading() ? 'visible' : 'hidden'));
|
||||
|
||||
this.onPluginLoadRequest = _.bind(this.onPluginLoadRequest, this);
|
||||
|
|
|
|||
|
|
@ -1,97 +0,0 @@
|
|||
import _ from '_';
|
||||
import { settingsSaveHelperSimpleFunction, trim } from 'Common/Utils';
|
||||
import { Magics } from 'Common/Enums';
|
||||
|
||||
import Remote from 'Remote/Admin/Ajax';
|
||||
|
||||
import { BrandingAdminSettings } from 'Settings/Admin/Branding';
|
||||
|
||||
class BrandingPremAdminSettings extends BrandingAdminSettings {
|
||||
onBuild(dom) {
|
||||
super.onBuild(dom);
|
||||
|
||||
if (this.capa && this.capa() && !this.community) {
|
||||
_.delay(() => {
|
||||
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),
|
||||
f5 = settingsSaveHelperSimpleFunction(this.userLogoTitle.trigger, this),
|
||||
f6 = settingsSaveHelperSimpleFunction(this.loginBackground.trigger, this),
|
||||
f7 = settingsSaveHelperSimpleFunction(this.userCss.trigger, this),
|
||||
f8 = settingsSaveHelperSimpleFunction(this.welcomePageUrl.trigger, this),
|
||||
f9 = settingsSaveHelperSimpleFunction(this.welcomePageDisplay.trigger, this),
|
||||
f10 = settingsSaveHelperSimpleFunction(this.userLogoMessage.trigger, this),
|
||||
f11 = settingsSaveHelperSimpleFunction(this.userIframeMessage.trigger, this);
|
||||
|
||||
this.loginLogo.subscribe((value) => {
|
||||
Remote.saveAdminConfig(f1, {
|
||||
'LoginLogo': trim(value)
|
||||
});
|
||||
});
|
||||
|
||||
this.loginDescription.subscribe((value) => {
|
||||
Remote.saveAdminConfig(f2, {
|
||||
'LoginDescription': trim(value)
|
||||
});
|
||||
});
|
||||
|
||||
this.loginCss.subscribe((value) => {
|
||||
Remote.saveAdminConfig(f3, {
|
||||
'LoginCss': trim(value)
|
||||
});
|
||||
});
|
||||
|
||||
this.userLogo.subscribe((value) => {
|
||||
Remote.saveAdminConfig(f4, {
|
||||
'UserLogo': trim(value)
|
||||
});
|
||||
});
|
||||
|
||||
this.userLogoTitle.subscribe((value) => {
|
||||
Remote.saveAdminConfig(f5, {
|
||||
'UserLogoTitle': trim(value)
|
||||
});
|
||||
});
|
||||
|
||||
this.userLogoMessage.subscribe((value) => {
|
||||
Remote.saveAdminConfig(f10, {
|
||||
'UserLogoMessage': trim(value)
|
||||
});
|
||||
});
|
||||
|
||||
this.userIframeMessage.subscribe((value) => {
|
||||
Remote.saveAdminConfig(f11, {
|
||||
'UserIframeMessage': trim(value)
|
||||
});
|
||||
});
|
||||
|
||||
this.loginBackground.subscribe((value) => {
|
||||
Remote.saveAdminConfig(f6, {
|
||||
'LoginBackground': trim(value)
|
||||
});
|
||||
});
|
||||
|
||||
this.userCss.subscribe((value) => {
|
||||
Remote.saveAdminConfig(f7, {
|
||||
'UserCss': trim(value)
|
||||
});
|
||||
});
|
||||
|
||||
this.welcomePageUrl.subscribe((value) => {
|
||||
Remote.saveAdminConfig(f8, {
|
||||
'WelcomePageUrl': trim(value)
|
||||
});
|
||||
});
|
||||
|
||||
this.welcomePageDisplay.subscribe((value) => {
|
||||
Remote.saveAdminConfig(f9, {
|
||||
'WelcomePageDisplay': trim(value)
|
||||
});
|
||||
});
|
||||
}, Magics.Time50ms);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export { BrandingPremAdminSettings, BrandingPremAdminSettings as default };
|
||||
|
|
@ -1,66 +0,0 @@
|
|||
import ko from 'ko';
|
||||
import moment from 'moment';
|
||||
|
||||
import { settingsGet } from 'Storage/Settings';
|
||||
import { showScreenPopup } from 'Knoin/Knoin';
|
||||
|
||||
import LicenseStore from 'Stores/Admin/License';
|
||||
|
||||
import { getApp } from 'Helper/Apps/Admin';
|
||||
|
||||
class LicensingPremAdminSettings {
|
||||
constructor() {
|
||||
this.licensing = LicenseStore.licensing;
|
||||
this.licensingProcess = LicenseStore.licensingProcess;
|
||||
this.licenseValid = LicenseStore.licenseValid;
|
||||
this.licenseExpired = LicenseStore.licenseExpired;
|
||||
this.licenseError = LicenseStore.licenseError;
|
||||
this.licenseTrigger = LicenseStore.licenseTrigger;
|
||||
|
||||
this.adminDomain = ko.observable('');
|
||||
this.subscriptionEnabled = ko.observable(!!settingsGet('SubscriptionEnabled'));
|
||||
|
||||
this.licenseTrigger.subscribe(() => {
|
||||
if (this.subscriptionEnabled()) {
|
||||
getApp().reloadLicensing(true);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
onBuild() {
|
||||
if (this.subscriptionEnabled()) {
|
||||
getApp().reloadLicensing(false);
|
||||
}
|
||||
}
|
||||
|
||||
onShow() {
|
||||
this.adminDomain(settingsGet('AdminDomain'));
|
||||
}
|
||||
|
||||
showActivationForm() {
|
||||
showScreenPopup(require('View/Popup/Activate'));
|
||||
}
|
||||
|
||||
showTrialForm() {
|
||||
showScreenPopup(require('View/Popup/Activate'), [true]);
|
||||
}
|
||||
|
||||
/**
|
||||
* @returns {boolean}
|
||||
*/
|
||||
licenseIsUnlim() {
|
||||
return 1898625600 === this.licenseExpired() || 1898625700 === this.licenseExpired(); // eslint-disable-line no-magic-numbers
|
||||
}
|
||||
|
||||
/**
|
||||
* @returns {string}
|
||||
*/
|
||||
licenseExpiredMomentValue() {
|
||||
const time = this.licenseExpired(),
|
||||
momentUnix = moment.unix(time);
|
||||
|
||||
return this.licenseIsUnlim() ? 'Never' : time && momentUnix.format('LL') + ' (' + momentUnix.from(moment()) + ')';
|
||||
}
|
||||
}
|
||||
|
||||
export { LicensingPremAdminSettings, LicensingPremAdminSettings as default };
|
||||
Loading…
Add table
Add a link
Reference in a new issue