mirror of
https://github.com/the-djmaze/snappymail.git
synced 2024-12-24 08:04:16 +08:00
Improved boot.js with existing global window.rl
Put dev/Storage/Settings.js in boots.js global rl.settings
This commit is contained in:
parent
f90dbcc84b
commit
aeb5275648
57 changed files with 284 additions and 380 deletions
|
@ -14,7 +14,6 @@ module.exports = {
|
|||
},
|
||||
globals: {
|
||||
// RainLoop
|
||||
'RainLoop': "readonly",
|
||||
'rainloopI18N': "readonly",
|
||||
'rainloopTEMPLATES': "readonly",
|
||||
'rl': "readonly",
|
||||
|
|
22
README.md
22
README.md
|
@ -86,23 +86,23 @@ Things might work in Edge 18, Firefox 50-62 and Chrome 54-68 due to one polyfill
|
|||
|
||||
|js/* |1.14.0 |native |
|
||||
|----------- |--------: |--------: |
|
||||
|admin.js |2.130.942 | 958.397 |
|
||||
|app.js |4.184.455 |2.586.232 |
|
||||
|boot.js | 671.522 | 6.782 |
|
||||
|admin.js |2.130.942 | 942.565 |
|
||||
|app.js |4.184.455 |2.563.204 |
|
||||
|boot.js | 671.522 | 7.265 |
|
||||
|libs.js | 647.614 | 312.269 |
|
||||
|polyfills.js | 325.834 | 0 |
|
||||
|TOTAL |7.960.367 |3.863.680 |
|
||||
|TOTAL |7.960.367 |3.825.303 |
|
||||
|
||||
|js/min/* |1.14.0 |native |gzip 1.14 |gzip |brotli |
|
||||
|--------------- |--------: |--------: |--------: |--------: |--------: |
|
||||
|admin.min.js | 252.147 | 130.128 | 73.657 | 37.783 | 32.395 |
|
||||
|app.min.js | 511.202 | 350.575 |140.462 | 92.070 | 73.949 |
|
||||
|boot.min.js | 66.007 | 4.081 | 22.567 | 1.837 | 1.538 |
|
||||
|admin.min.js | 252.147 | 129.058 | 73.657 | 37.631 | 32.250 |
|
||||
|app.min.js | 511.202 | 350.074 |140.462 | 91.841 | 73.757 |
|
||||
|boot.min.js | 66.007 | 4.274 | 22.567 | 1.934 | 1.635 |
|
||||
|libs.min.js | 572.545 | 295.776 |176.720 | 91.524 | 80.746 |
|
||||
|polyfills.min.js | 32.452 | 0 | 11.312 | 0 | 0 |
|
||||
|TOTAL |1.434.353 | 780.560 |424.718 |223.214 |188.628 |
|
||||
|TOTAL |1.434.353 | 779.182 |424.718 |222.930 |188.388 |
|
||||
|
||||
653.793 bytes (201.504 gzip) is not much, but it feels faster.
|
||||
655.171 bytes (201.788 gzip) is not much, but it feels faster.
|
||||
|
||||
### CSS changes
|
||||
|
||||
|
@ -127,8 +127,8 @@ Things might work in Edge 18, Firefox 50-62 and Chrome 54-68 due to one polyfill
|
|||
|
||||
|css/* |1.14.0 |native |gzip 1.14 |gzip |brotli |
|
||||
|-------------- |-------: |-------: |------: |------: |------: |
|
||||
|app.css | 340.334 | 255.627 | 46,959 | 36.929 | 31.015 |
|
||||
|app.min.css | 274.791 | 208.711 | 39,618 | 32.226 | 27.364 |
|
||||
|app.css | 340.334 | 255.729 | 46,959 | 36.948 | 31.049 |
|
||||
|app.min.css | 274.791 | 208.793 | 39,618 | 32.238 | 27.339 |
|
||||
|
||||
|
||||
### PHP73 branch
|
||||
|
|
|
@ -8,9 +8,8 @@ import {
|
|||
} from 'Common/Globals';
|
||||
|
||||
import { KeyState } from 'Common/Enums';
|
||||
import { root, rootAdmin, rootUser, populateAuthSuffix } from 'Common/Links';
|
||||
import { root, rootAdmin, rootUser } from 'Common/Links';
|
||||
import { initOnStartOrLangChange, initNotificationLanguage } from 'Common/Translator';
|
||||
import * as Settings from 'Storage/Settings';
|
||||
|
||||
import LanguageStore from 'Stores/Language';
|
||||
import ThemeStore from 'Stores/Theme';
|
||||
|
@ -18,6 +17,8 @@ import ThemeStore from 'Stores/Theme';
|
|||
import { routeOff, setHash } from 'Knoin/Knoin';
|
||||
import { AbstractBoot } from 'Knoin/AbstractBoot';
|
||||
|
||||
const Settings = rl.settings;
|
||||
|
||||
class AbstractApp extends AbstractBoot {
|
||||
/**
|
||||
* @param {RemoteStorage|AdminRemoteStorage} Remote
|
||||
|
@ -57,10 +58,6 @@ class AbstractApp extends AbstractBoot {
|
|||
return null;
|
||||
}
|
||||
|
||||
getApplicationConfiguration(name, default_) {
|
||||
return this.applicationConfiguration[name] || default_;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {string} link
|
||||
* @returns {boolean}
|
||||
|
@ -79,40 +76,16 @@ class AbstractApp extends AbstractBoot {
|
|||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {string} title
|
||||
*/
|
||||
setWindowTitle(title) {
|
||||
title = null == title ? '' : '' + title;
|
||||
if (Settings.settingsGet('Title')) {
|
||||
title += (title ? ' - ' : '') + Settings.settingsGet('Title');
|
||||
}
|
||||
|
||||
document.title = title;
|
||||
}
|
||||
|
||||
redirectToAdminPanel() {
|
||||
setTimeout(() => {
|
||||
location.href = rootAdmin();
|
||||
}, 100);
|
||||
}
|
||||
|
||||
clearClientSideToken() {
|
||||
if (RainLoop.hash.clear) {
|
||||
RainLoop.hash.clear();
|
||||
}
|
||||
setTimeout(() => location.href = rootAdmin(), 100);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {string} token
|
||||
*/
|
||||
setClientSideToken(token) {
|
||||
if (RainLoop.hash.set) {
|
||||
RainLoop.hash.set(token);
|
||||
|
||||
Settings.settingsSet('AuthAccountHash', token);
|
||||
populateAuthSuffix();
|
||||
}
|
||||
rl.hash.set();
|
||||
Settings.set('AuthAccountHash', token);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -121,11 +94,11 @@ class AbstractApp extends AbstractBoot {
|
|||
* @param {boolean=} close = false
|
||||
*/
|
||||
loginAndLogoutReload(admin = false, logout = false, close = false) {
|
||||
const inIframe = !!Settings.appSettingsGet('inIframe'),
|
||||
const inIframe = !!Settings.app('inIframe'),
|
||||
logoutLink = admin ? rootAdmin() : rootUser();
|
||||
|
||||
if (logout) {
|
||||
this.clearClientSideToken();
|
||||
rl.hash.clear();
|
||||
}
|
||||
|
||||
if (logout && close && window.close) {
|
||||
|
@ -155,19 +128,15 @@ class AbstractApp extends AbstractBoot {
|
|||
}
|
||||
}
|
||||
|
||||
historyBack() {
|
||||
history.back();
|
||||
}
|
||||
|
||||
bootstart() {
|
||||
const mobile = Settings.appSettingsGet('mobile');
|
||||
const mobile = Settings.app('mobile');
|
||||
|
||||
ko.components.register('SaveTrigger', require('Component/SaveTrigger').default);
|
||||
ko.components.register('Input', require('Component/Input').default);
|
||||
ko.components.register('Select', require('Component/Select').default);
|
||||
ko.components.register('TextArea', require('Component/TextArea').default);
|
||||
|
||||
if (Settings.appSettingsGet('materialDesign') && !bMobileDevice) {
|
||||
if (Settings.app('materialDesign') && !bMobileDevice) {
|
||||
ko.components.register('Checkbox', require('Component/MaterialDesign/Checkbox').default);
|
||||
ko.components.register('CheckboxSimple', require('Component/Checkbox').default);
|
||||
} else {
|
||||
|
|
|
@ -3,8 +3,6 @@ import ko from 'ko';
|
|||
import { root } from 'Common/Links';
|
||||
import { StorageResultType } from 'Common/Enums';
|
||||
|
||||
import * as Settings from 'Storage/Settings';
|
||||
|
||||
import AppStore from 'Stores/Admin/App';
|
||||
import CapaStore from 'Stores/Admin/Capa';
|
||||
import DomainStore from 'Stores/Admin/Domain';
|
||||
|
@ -113,7 +111,7 @@ class AdminApp extends AbstractApp {
|
|||
|
||||
hideLoading();
|
||||
|
||||
if (!Settings.appSettingsGet('allowAdminPanel')) {
|
||||
if (!rl.settings.app('allowAdminPanel')) {
|
||||
routeOff();
|
||||
setHash(root(), true);
|
||||
routeOff();
|
||||
|
@ -122,7 +120,7 @@ class AdminApp extends AbstractApp {
|
|||
location.href = '/'
|
||||
, 1);
|
||||
} else {
|
||||
if (Settings.settingsGet('Auth')) {
|
||||
if (rl.settings.get('Auth')) {
|
||||
startScreens([SettingsAdminScreen]);
|
||||
} else {
|
||||
startScreens([LoginAdminScreen]);
|
||||
|
|
|
@ -56,7 +56,6 @@ import MessageStore from 'Stores/User/Message';
|
|||
import QuotaStore from 'Stores/User/Quota';
|
||||
|
||||
import * as Local from 'Storage/Client';
|
||||
import * as Settings from 'Storage/Settings';
|
||||
|
||||
import Remote from 'Remote/User/Ajax';
|
||||
import Promises from 'Promises/User/Ajax';
|
||||
|
@ -75,7 +74,7 @@ import { hideLoading, routeOff, routeOn, setHash, startScreens, showScreenPopup
|
|||
|
||||
import { AbstractApp } from 'App/Abstract';
|
||||
|
||||
const doc = document;
|
||||
const doc = document, Settings = rl.settings;
|
||||
|
||||
class AppUser extends AbstractApp {
|
||||
constructor() {
|
||||
|
@ -94,25 +93,25 @@ class AppUser extends AbstractApp {
|
|||
setInterval(() => {
|
||||
const currentTime = (new Date()).getTime();
|
||||
if (currentTime > (lastTime + interval + 1000)) {
|
||||
if (RainLoop.hash.check()) {
|
||||
if (rl.hash.check()) {
|
||||
this.reload();
|
||||
}
|
||||
Remote.jsVersion((sResult, oData) => {
|
||||
if (StorageResultType.Success === sResult && oData && !oData.Result) {
|
||||
this.reload();
|
||||
}
|
||||
}, Settings.appSettingsGet('version'));
|
||||
}, Settings.app('version'));
|
||||
}
|
||||
lastTime = currentTime;
|
||||
}, interval);
|
||||
|
||||
if (RainLoop.hash.check()) {
|
||||
if (rl.hash.check()) {
|
||||
this.reload();
|
||||
}
|
||||
|
||||
if (Settings.settingsGet('UserBackgroundHash')) {
|
||||
if (Settings.get('UserBackgroundHash')) {
|
||||
setTimeout(() => {
|
||||
const img = userBackground(Settings.settingsGet('UserBackgroundHash'));
|
||||
const img = userBackground(Settings.get('UserBackgroundHash'));
|
||||
if (img) {
|
||||
$htmlCL.add('UserBackground');
|
||||
doc.body.style.backgroundImage = "url("+img+")";
|
||||
|
@ -126,7 +125,7 @@ class AppUser extends AbstractApp {
|
|||
}
|
||||
|
||||
reload() {
|
||||
if (parent && !!Settings.appSettingsGet('inIframe')) {
|
||||
if (parent && !!Settings.app('inIframe')) {
|
||||
parent.location.reload();
|
||||
} else {
|
||||
location.reload();
|
||||
|
@ -489,7 +488,7 @@ class AppUser extends AbstractApp {
|
|||
if (StorageResultType.Success === sResult && oData.Result) {
|
||||
const counts = {},
|
||||
sAccountEmail = AccountStore.email();
|
||||
let parentEmail = Settings.settingsGet('ParentEmail') || sAccountEmail;
|
||||
let parentEmail = Settings.get('ParentEmail') || sAccountEmail;
|
||||
|
||||
if (Array.isArray(oData.Result.Accounts)) {
|
||||
AccountStore.accounts().forEach(oAccount => {
|
||||
|
@ -901,7 +900,7 @@ class AppUser extends AbstractApp {
|
|||
this.loginAndLogoutReload(
|
||||
false,
|
||||
true,
|
||||
0 < (Settings.settingsGet('ParentEmail')||{length:0}).length
|
||||
0 < (Settings.get('ParentEmail')||{length:0}).length
|
||||
);
|
||||
});
|
||||
}
|
||||
|
@ -932,27 +931,27 @@ class AppUser extends AbstractApp {
|
|||
AccountStore.populate();
|
||||
ContactStore.populate();
|
||||
|
||||
let contactsSyncInterval = pInt(Settings.settingsGet('ContactsSyncInterval'));
|
||||
let contactsSyncInterval = pInt(Settings.get('ContactsSyncInterval'));
|
||||
|
||||
const startupUrl = pString(Settings.settingsGet('StartupUrl'));
|
||||
const startupUrl = pString(Settings.get('StartupUrl'));
|
||||
|
||||
if (window.progressJs) {
|
||||
progressJs.set(90);
|
||||
}
|
||||
|
||||
this.setWindowTitle('');
|
||||
if (Settings.settingsGet('Auth')) {
|
||||
rl.setWindowTitle();
|
||||
if (Settings.get('Auth')) {
|
||||
$htmlCL.add('rl-user-auth');
|
||||
|
||||
if (
|
||||
Settings.capa(Capa.TwoFactor) &&
|
||||
Settings.capa(Capa.TwoFactorForce) &&
|
||||
Settings.settingsGet('RequireTwoFactor')
|
||||
Settings.get('RequireTwoFactor')
|
||||
) {
|
||||
this.bootend();
|
||||
this.bootstartTwoFactorScreen();
|
||||
} else {
|
||||
this.setWindowTitle(i18n('TITLES/LOADING'));
|
||||
rl.setWindowTitle(i18n('TITLES/LOADING'));
|
||||
|
||||
// require.ensure([], function() { // require code splitting
|
||||
|
||||
|
@ -1041,7 +1040,7 @@ class AppUser extends AbstractApp {
|
|||
addEventListener('rl.auto-logout', () => this.logout());
|
||||
|
||||
if (
|
||||
!!Settings.settingsGet('AccountSignMe') &&
|
||||
!!Settings.get('AccountSignMe') &&
|
||||
navigator.registerProtocolHandler &&
|
||||
Settings.capa(Capa.Composer)
|
||||
) {
|
||||
|
@ -1050,12 +1049,12 @@ class AppUser extends AbstractApp {
|
|||
navigator.registerProtocolHandler(
|
||||
'mailto',
|
||||
location.protocol + '//' + location.host + location.pathname + '?mailto&to=%s',
|
||||
'' + (Settings.settingsGet('Title') || 'RainLoop')
|
||||
'' + (Settings.get('Title') || 'RainLoop')
|
||||
);
|
||||
} catch (e) {} // eslint-disable-line no-empty
|
||||
|
||||
if (Settings.settingsGet('MailToEmail')) {
|
||||
mailToHelper(Settings.settingsGet('MailToEmail'), require('View/Popup/Compose'));
|
||||
if (Settings.get('MailToEmail')) {
|
||||
mailToHelper(Settings.get('MailToEmail'), require('View/Popup/Compose'));
|
||||
}
|
||||
}, 500);
|
||||
}
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
import { EventKeyCode } from 'Common/Enums';
|
||||
import * as Settings from 'Storage/Settings';
|
||||
|
||||
/**
|
||||
* @type {Object}
|
||||
|
@ -269,9 +268,9 @@ class HtmlEditor {
|
|||
if (this.element && !this.editor) {
|
||||
const initFunc = () => {
|
||||
const config = htmlEditorDefaultConfig,
|
||||
language = Settings.settingsGet('Language'),
|
||||
allowSource = !!Settings.appSettingsGet('allowHtmlEditorSourceButton'),
|
||||
biti = !!Settings.appSettingsGet('allowHtmlEditorBitiButtons');
|
||||
language = rl.settings.get('Language'),
|
||||
allowSource = !!rl.settings.app('allowHtmlEditorSourceButton'),
|
||||
biti = !!rl.settings.app('allowHtmlEditorBitiButtons');
|
||||
|
||||
if ((allowSource || !biti) && !config.toolbarGroups.__cfgInited) {
|
||||
config.toolbarGroups.__cfgInited = true;
|
||||
|
|
|
@ -1,25 +1,19 @@
|
|||
import { pString, pInt } from 'Common/Utils';
|
||||
import * as Settings from 'Storage/Settings';
|
||||
|
||||
const ROOT = './',
|
||||
const
|
||||
Settings = rl.settings,
|
||||
ROOT = './',
|
||||
HASH_PREFIX = '#/',
|
||||
SERVER_PREFIX = './?',
|
||||
SUB_QUERY_PREFIX = '&q[]=',
|
||||
VERSION = Settings.appSettingsGet('version'),
|
||||
WEB_PREFIX = Settings.appSettingsGet('webPath') || '',
|
||||
VERSION_PREFIX = Settings.appSettingsGet('webVersionPath') || 'rainloop/v/' + VERSION + '/',
|
||||
VERSION = Settings.app('version'),
|
||||
WEB_PREFIX = Settings.app('webPath') || '',
|
||||
VERSION_PREFIX = Settings.app('webVersionPath') || 'rainloop/v/' + VERSION + '/',
|
||||
STATIC_PREFIX = VERSION_PREFIX + 'static/',
|
||||
ADMIN_HOST_USE = !!Settings.appSettingsGet('adminHostUse'),
|
||||
ADMIN_PATH = Settings.appSettingsGet('adminPath') || 'admin';
|
||||
ADMIN_HOST_USE = !!Settings.app('adminHostUse'),
|
||||
ADMIN_PATH = Settings.app('adminPath') || 'admin',
|
||||
|
||||
let AUTH_PREFIX = Settings.settingsGet('AuthAccountHash') || '0';
|
||||
|
||||
/**
|
||||
* @returns {void}
|
||||
*/
|
||||
export function populateAuthSuffix() {
|
||||
AUTH_PREFIX = Settings.settingsGet('AuthAccountHash') || '0';
|
||||
}
|
||||
getHash = () => Settings.get('AuthAccountHash') || '0';
|
||||
|
||||
/**
|
||||
* @returns {string}
|
||||
|
@ -57,7 +51,7 @@ export function rootUser() {
|
|||
* @returns {string}
|
||||
*/
|
||||
export function attachmentRaw(type, download, customSpecSuffix) {
|
||||
customSpecSuffix = undefined === customSpecSuffix ? AUTH_PREFIX : customSpecSuffix;
|
||||
customSpecSuffix = undefined === customSpecSuffix ? getHash() : customSpecSuffix;
|
||||
return (
|
||||
SERVER_PREFIX +
|
||||
'/Raw/' +
|
||||
|
@ -123,7 +117,7 @@ export function attachmentFramed(download, customSpecSuffix) {
|
|||
* @returns {string}
|
||||
*/
|
||||
export function serverRequest(type) {
|
||||
return SERVER_PREFIX + '/' + type + '/' + SUB_QUERY_PREFIX + '/' + AUTH_PREFIX + '/';
|
||||
return SERVER_PREFIX + '/' + type + '/' + SUB_QUERY_PREFIX + '/' + getHash() + '/';
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -180,7 +174,7 @@ export function messageViewLink(requestHash) {
|
|||
'/Raw/' +
|
||||
SUB_QUERY_PREFIX +
|
||||
'/' +
|
||||
AUTH_PREFIX +
|
||||
getHash() +
|
||||
'/ViewAsPlain/' +
|
||||
SUB_QUERY_PREFIX +
|
||||
'/' +
|
||||
|
@ -194,7 +188,7 @@ export function messageViewLink(requestHash) {
|
|||
*/
|
||||
export function messageDownloadLink(requestHash) {
|
||||
return (
|
||||
SERVER_PREFIX + '/Raw/' + SUB_QUERY_PREFIX + '/' + AUTH_PREFIX + '/Download/' + SUB_QUERY_PREFIX + '/' + requestHash
|
||||
SERVER_PREFIX + '/Raw/' + SUB_QUERY_PREFIX + '/' + getHash() + '/Download/' + SUB_QUERY_PREFIX + '/' + requestHash
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -220,7 +214,7 @@ export function publicLink(hash) {
|
|||
*/
|
||||
export function userBackground(hash) {
|
||||
return (
|
||||
SERVER_PREFIX + '/Raw/' + SUB_QUERY_PREFIX + '/' + AUTH_PREFIX + '/UserBackground/' + SUB_QUERY_PREFIX + '/' + hash
|
||||
SERVER_PREFIX + '/Raw/' + SUB_QUERY_PREFIX + '/' + getHash() + '/UserBackground/' + SUB_QUERY_PREFIX + '/' + hash
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -237,14 +231,14 @@ export function langLink(lang, isAdmin) {
|
|||
* @returns {string}
|
||||
*/
|
||||
export function exportContactsVcf() {
|
||||
return SERVER_PREFIX + '/Raw/' + SUB_QUERY_PREFIX + '/' + AUTH_PREFIX + '/ContactsVcf/';
|
||||
return SERVER_PREFIX + '/Raw/' + SUB_QUERY_PREFIX + '/' + getHash() + '/ContactsVcf/';
|
||||
}
|
||||
|
||||
/**
|
||||
* @returns {string}
|
||||
*/
|
||||
export function exportContactsCsv() {
|
||||
return SERVER_PREFIX + '/Raw/' + SUB_QUERY_PREFIX + '/' + AUTH_PREFIX + '/ContactsCsv/';
|
||||
return SERVER_PREFIX + '/Raw/' + SUB_QUERY_PREFIX + '/' + getHash() + '/ContactsCsv/';
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
import { data as GlobalsData } from 'Common/Globals';
|
||||
import * as Settings from 'Storage/Settings';
|
||||
|
||||
const USER_VIEW_MODELS_HOOKS = [],
|
||||
ADMIN_VIEW_MODELS_HOOKS = [];
|
||||
|
@ -9,7 +8,7 @@ const USER_VIEW_MODELS_HOOKS = [],
|
|||
* @returns {?}
|
||||
*/
|
||||
export function mainSettingsGet(name) {
|
||||
return Settings.settingsGet(name);
|
||||
return rl.settings.get(name);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -60,7 +59,7 @@ export function runSettingsViewModelHooks(admin) {
|
|||
* @returns {?}
|
||||
*/
|
||||
export function settingsGet(pluginSection, name) {
|
||||
let plugins = Settings.settingsGet('Plugins');
|
||||
let plugins = rl.settings.get('Plugins');
|
||||
plugins = plugins && null != plugins[pluginSection] ? plugins[pluginSection] : null;
|
||||
return plugins ? (null == plugins[name] ? null : plugins[name]) : null;
|
||||
}
|
||||
|
|
|
@ -3,7 +3,6 @@ import { pInt, pString } from 'Common/Utils';
|
|||
import { DEFAULT_AJAX_TIMEOUT, TOKEN_ERROR_LIMIT, AJAX_ERROR_LIMIT } from 'Common/Consts';
|
||||
import { Notification } from 'Common/Enums';
|
||||
import { data as GlobalsData } from 'Common/Globals';
|
||||
import * as Settings from 'Storage/Settings';
|
||||
|
||||
import { AbstractBasicPromises } from 'Promises/AbstractBasic';
|
||||
|
||||
|
@ -51,7 +50,7 @@ class AbstractAjaxPromises extends AbstractBasicPromises {
|
|||
// 'Content-Type': 'application/json'
|
||||
'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8'
|
||||
};
|
||||
params.XToken = Settings.appSettingsGet('token');
|
||||
params.XToken = rl.settings.app('token');
|
||||
// init.body = JSON.stringify(params);
|
||||
const formData = new FormData(),
|
||||
buildFormData = (formData, data, parentKey) => {
|
||||
|
@ -86,8 +85,9 @@ class AbstractAjaxPromises extends AbstractBasicPromises {
|
|||
return Promise.reject(Notification.AjaxParse);
|
||||
}
|
||||
|
||||
if (data.UpdateToken && GlobalsData.__APP__ && GlobalsData.__APP__.setClientSideToken) {
|
||||
GlobalsData.__APP__.setClientSideToken(data.UpdateToken);
|
||||
if (data.UpdateToken) {
|
||||
rl.hash.set();
|
||||
rl.settings.set('AuthAccountHash', data.UpdateToken);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -136,12 +136,12 @@ class AbstractAjaxPromises extends AbstractBasicPromises {
|
|||
}
|
||||
|
||||
if (data.ClearAuth || data.Logout || AJAX_ERROR_LIMIT < GlobalsData.iAjaxErrorCount) {
|
||||
if (GlobalsData.__APP__ && GlobalsData.__APP__.clearClientSideToken) {
|
||||
GlobalsData.__APP__.clearClientSideToken();
|
||||
}
|
||||
if (GlobalsData.__APP__) {
|
||||
rl.hash.clear();
|
||||
|
||||
if (GlobalsData.__APP__ && !data.ClearAuth && GlobalsData.__APP__.loginAndLogoutReload) {
|
||||
GlobalsData.__APP__.loginAndLogoutReload(false, true);
|
||||
if (!data.ClearAuth && GlobalsData.__APP__.loginAndLogoutReload) {
|
||||
GlobalsData.__APP__.loginAndLogoutReload(false, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -3,7 +3,6 @@ import { pInt } from 'Common/Utils';
|
|||
import { ClientSideKeyName, ServerFolderType } from 'Common/Enums';
|
||||
import * as Cache from 'Common/Cache';
|
||||
|
||||
import * as Settings from 'Storage/Settings';
|
||||
import * as Local from 'Storage/Client';
|
||||
|
||||
import AppStore from 'Stores/User/App';
|
||||
|
@ -14,6 +13,8 @@ import Remote from 'Remote/User/Ajax';
|
|||
import { FolderModel } from 'Model/Folder';
|
||||
import { AbstractBasicPromises } from 'Promises/AbstractBasic';
|
||||
|
||||
const Settings = rl.settings;
|
||||
|
||||
class PromisesUserPopulator extends AbstractBasicPromises {
|
||||
/**
|
||||
* @param {string} sFullNameHash
|
||||
|
@ -109,7 +110,7 @@ class PromisesUserPopulator extends AbstractBasicPromises {
|
|||
const expandedFolders = Local.get(ClientSideKeyName.ExpandedFolders),
|
||||
cnt = pInt(oData.CountRec);
|
||||
|
||||
let limit = pInt(Settings.appSettingsGet('folderSpecLimit'));
|
||||
let limit = pInt(Settings.app('folderSpecLimit'));
|
||||
limit = 100 < limit ? 100 : 10 > limit ? 10 : limit;
|
||||
|
||||
FolderStore.displaySpecSetting(0 >= cnt || limit < cnt);
|
||||
|
@ -136,7 +137,7 @@ class PromisesUserPopulator extends AbstractBasicPromises {
|
|||
FolderStore.namespace = oData.Namespace;
|
||||
}
|
||||
|
||||
AppStore.threadsAllowed(!!Settings.appSettingsGet('useImapThread') && oData.IsThreadsSupported && true);
|
||||
AppStore.threadsAllowed(!!Settings.app('useImapThread') && oData.IsThreadsSupported && true);
|
||||
|
||||
FolderStore.folderList.optimized(!!oData.Optimized);
|
||||
|
||||
|
@ -145,27 +146,27 @@ class PromisesUserPopulator extends AbstractBasicPromises {
|
|||
if (
|
||||
oData.SystemFolders &&
|
||||
!('' +
|
||||
Settings.settingsGet('SentFolder') +
|
||||
Settings.settingsGet('DraftFolder') +
|
||||
Settings.settingsGet('SpamFolder') +
|
||||
Settings.settingsGet('TrashFolder') +
|
||||
Settings.settingsGet('ArchiveFolder') +
|
||||
Settings.settingsGet('NullFolder'))
|
||||
Settings.get('SentFolder') +
|
||||
Settings.get('DraftFolder') +
|
||||
Settings.get('SpamFolder') +
|
||||
Settings.get('TrashFolder') +
|
||||
Settings.get('ArchiveFolder') +
|
||||
Settings.get('NullFolder'))
|
||||
) {
|
||||
Settings.settingsSet('SentFolder', oData.SystemFolders[ServerFolderType.SENT] || null);
|
||||
Settings.settingsSet('DraftFolder', oData.SystemFolders[ServerFolderType.DRAFTS] || null);
|
||||
Settings.settingsSet('SpamFolder', oData.SystemFolders[ServerFolderType.JUNK] || null);
|
||||
Settings.settingsSet('TrashFolder', oData.SystemFolders[ServerFolderType.TRASH] || null);
|
||||
Settings.settingsSet('ArchiveFolder', oData.SystemFolders[ServerFolderType.ALL] || null);
|
||||
Settings.set('SentFolder', oData.SystemFolders[ServerFolderType.SENT] || null);
|
||||
Settings.set('DraftFolder', oData.SystemFolders[ServerFolderType.DRAFTS] || null);
|
||||
Settings.set('SpamFolder', oData.SystemFolders[ServerFolderType.JUNK] || null);
|
||||
Settings.set('TrashFolder', oData.SystemFolders[ServerFolderType.TRASH] || null);
|
||||
Settings.set('ArchiveFolder', oData.SystemFolders[ServerFolderType.ALL] || null);
|
||||
|
||||
update = true;
|
||||
}
|
||||
|
||||
FolderStore.sentFolder(this.normalizeFolder(Settings.settingsGet('SentFolder')));
|
||||
FolderStore.draftFolder(this.normalizeFolder(Settings.settingsGet('DraftFolder')));
|
||||
FolderStore.spamFolder(this.normalizeFolder(Settings.settingsGet('SpamFolder')));
|
||||
FolderStore.trashFolder(this.normalizeFolder(Settings.settingsGet('TrashFolder')));
|
||||
FolderStore.archiveFolder(this.normalizeFolder(Settings.settingsGet('ArchiveFolder')));
|
||||
FolderStore.sentFolder(this.normalizeFolder(Settings.get('SentFolder')));
|
||||
FolderStore.draftFolder(this.normalizeFolder(Settings.get('DraftFolder')));
|
||||
FolderStore.spamFolder(this.normalizeFolder(Settings.get('SpamFolder')));
|
||||
FolderStore.trashFolder(this.normalizeFolder(Settings.get('TrashFolder')));
|
||||
FolderStore.archiveFolder(this.normalizeFolder(Settings.get('ArchiveFolder')));
|
||||
|
||||
if (update) {
|
||||
Remote.saveSystemFolders(()=>{}, {
|
||||
|
|
|
@ -4,7 +4,6 @@ import { pInt, pString } from 'Common/Utils';
|
|||
import { data as GlobalsData } from 'Common/Globals';
|
||||
import { ajax } from 'Common/Links';
|
||||
|
||||
import * as Settings from 'Storage/Settings';
|
||||
|
||||
class AbstractAjaxRemote {
|
||||
constructor() {
|
||||
|
@ -67,8 +66,8 @@ class AbstractAjaxRemote {
|
|||
}
|
||||
|
||||
if (oData.ClearAuth || oData.Logout || AJAX_ERROR_LIMIT < GlobalsData.iAjaxErrorCount) {
|
||||
if (GlobalsData.__APP__ && GlobalsData.__APP__.clearClientSideToken) {
|
||||
GlobalsData.__APP__.clearClientSideToken();
|
||||
if (GlobalsData.__APP__) {
|
||||
rl.hash.clear();
|
||||
|
||||
if (!oData.ClearAuth && GlobalsData.__APP__.loginAndLogoutReload) {
|
||||
GlobalsData.__APP__.loginAndLogoutReload(false, true);
|
||||
|
@ -140,7 +139,7 @@ class AbstractAjaxRemote {
|
|||
// 'Content-Type': 'application/json'
|
||||
'Content-Type': 'application/x-www-form-urlencoded; charset=UTF-8'
|
||||
};
|
||||
params.XToken = Settings.appSettingsGet('token');
|
||||
params.XToken = rl.settings.app('token');
|
||||
// init.body = JSON.stringify(params);
|
||||
const formData = new FormData(),
|
||||
buildFormData = (formData, data, parentKey) => {
|
||||
|
@ -175,9 +174,8 @@ class AbstractAjaxRemote {
|
|||
}
|
||||
|
||||
if (oData && oData.UpdateToken) {
|
||||
if (GlobalsData.__APP__ && GlobalsData.__APP__.setClientSideToken) {
|
||||
GlobalsData.__APP__.setClientSideToken(oData.UpdateToken);
|
||||
}
|
||||
rl.hash.set();
|
||||
rl.settings.set('AuthAccountHash', oData.UpdateToken);
|
||||
}
|
||||
|
||||
let sType = 'success';
|
||||
|
|
|
@ -17,7 +17,6 @@ import {
|
|||
} from 'Common/Cache';
|
||||
|
||||
import { subQueryPrefix } from 'Common/Links';
|
||||
import * as Settings from 'Storage/Settings';
|
||||
|
||||
import AppStore from 'Stores/User/App';
|
||||
import SettingsStore from 'Stores/User/Settings';
|
||||
|
@ -44,15 +43,16 @@ class RemoteUserAjax extends AbstractAjaxRemote {
|
|||
* @param {?Function} fCallback
|
||||
*/
|
||||
folders(fCallback) {
|
||||
const settingsGet = rl.settings.get;
|
||||
this.defaultRequest(
|
||||
fCallback,
|
||||
'Folders',
|
||||
{
|
||||
SentFolder: Settings.settingsGet('SentFolder'),
|
||||
DraftFolder: Settings.settingsGet('DraftFolder'),
|
||||
SpamFolder: Settings.settingsGet('SpamFolder'),
|
||||
TrashFolder: Settings.settingsGet('TrashFolder'),
|
||||
ArchiveFolder: Settings.settingsGet('ArchiveFolder')
|
||||
SentFolder: settingsGet('SentFolder'),
|
||||
DraftFolder: settingsGet('DraftFolder'),
|
||||
SpamFolder: settingsGet('SpamFolder'),
|
||||
TrashFolder: settingsGet('TrashFolder'),
|
||||
ArchiveFolder: settingsGet('ArchiveFolder')
|
||||
},
|
||||
null,
|
||||
'',
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
import { AbstractScreen } from 'Knoin/AbstractScreen';
|
||||
|
||||
import { getApp } from 'Helper/Apps/Admin';
|
||||
|
||||
import { LoginAdminView } from 'View/Admin/Login';
|
||||
|
||||
class LoginAdminScreen extends AbstractScreen {
|
||||
|
@ -10,7 +8,7 @@ class LoginAdminScreen extends AbstractScreen {
|
|||
}
|
||||
|
||||
onShow() {
|
||||
getApp().setWindowTitle('');
|
||||
rl.setWindowTitle();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -12,8 +12,6 @@ import { PluginsAdminSettings } from 'Settings/Admin/Plugins';
|
|||
import { PackagesAdminSettings } from 'Settings/Admin/Packages';
|
||||
import { AboutAdminSettings } from 'Settings/Admin/About';
|
||||
|
||||
import { getApp } from 'Helper/Apps/Admin';
|
||||
|
||||
import { MenuSettingsAdminView } from 'View/Admin/Settings/Menu';
|
||||
import { PaneSettingsAdminView } from 'View/Admin/Settings/Pane';
|
||||
|
||||
|
@ -60,7 +58,7 @@ class SettingsAdminScreen extends AbstractSettingsScreen {
|
|||
}
|
||||
|
||||
onShow() {
|
||||
getApp().setWindowTitle('');
|
||||
rl.setWindowTitle();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -2,15 +2,13 @@ import { AbstractScreen } from 'Knoin/AbstractScreen';
|
|||
|
||||
import { LoginUserView } from 'View/User/Login';
|
||||
|
||||
import { getApp } from 'Helper/Apps/User';
|
||||
|
||||
class LoginUserScreen extends AbstractScreen {
|
||||
constructor() {
|
||||
super('login', [LoginUserView]);
|
||||
}
|
||||
|
||||
onShow() {
|
||||
getApp().setWindowTitle('');
|
||||
rl.setWindowTitle();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -4,8 +4,6 @@ import { pString, pInt } from 'Common/Utils';
|
|||
import { getFolderFromCacheList, getFolderFullNameRaw, getFolderInboxName } from 'Common/Cache';
|
||||
import { i18n } from 'Common/Translator';
|
||||
|
||||
import * as Settings from 'Storage/Settings';
|
||||
|
||||
import AppStore from 'Stores/User/App';
|
||||
import AccountStore from 'Stores/User/Account';
|
||||
import SettingsStore from 'Stores/User/Settings';
|
||||
|
@ -23,6 +21,8 @@ import { warmUpScreenPopup } from 'Knoin/Knoin';
|
|||
|
||||
import { AbstractScreen } from 'Knoin/AbstractScreen';
|
||||
|
||||
const Settings = rl.settings;
|
||||
|
||||
class MailBoxUserScreen extends AbstractScreen {
|
||||
constructor() {
|
||||
super('mailbox', [
|
||||
|
@ -40,11 +40,11 @@ class MailBoxUserScreen extends AbstractScreen {
|
|||
let foldersInboxUnreadCount = FolderStore.foldersInboxUnreadCount();
|
||||
const email = AccountStore.email();
|
||||
|
||||
if (Settings.appSettingsGet('listPermanentFiltered')) {
|
||||
if (Settings.app('listPermanentFiltered')) {
|
||||
foldersInboxUnreadCount = 0;
|
||||
}
|
||||
|
||||
getApp().setWindowTitle(
|
||||
rl.setWindowTitle(
|
||||
(email
|
||||
? '' + (0 < foldersInboxUnreadCount ? '(' + foldersInboxUnreadCount + ') ' : ' ') + email + ' - '
|
||||
: ''
|
||||
|
@ -61,7 +61,7 @@ class MailBoxUserScreen extends AbstractScreen {
|
|||
AppStore.focusedState(Focused.None);
|
||||
AppStore.focusedState(Focused.MessageList);
|
||||
|
||||
if (Settings.appSettingsGet('mobile')) {
|
||||
if (Settings.app('mobile')) {
|
||||
leftPanelDisabled(true);
|
||||
}
|
||||
|
||||
|
@ -122,7 +122,7 @@ class MailBoxUserScreen extends AbstractScreen {
|
|||
* @returns {void}
|
||||
*/
|
||||
onBuild() {
|
||||
if (!bMobileDevice && !Settings.appSettingsGet('mobile')) {
|
||||
if (!bMobileDevice && !Settings.app('mobile')) {
|
||||
setTimeout(() =>
|
||||
getApp().initHorizontalLayoutResizer(ClientSideKeyName.MessageListSize)
|
||||
, 1);
|
||||
|
|
|
@ -6,7 +6,6 @@ import { initOnStartOrLangChange, i18n } from 'Common/Translator';
|
|||
import AppStore from 'Stores/User/App';
|
||||
import AccountStore from 'Stores/User/Account';
|
||||
|
||||
import * as Settings from 'Storage/Settings';
|
||||
import { addSettingsViewModel } from 'Knoin/Knoin';
|
||||
|
||||
import { AbstractSettingsScreen } from 'Screen/AbstractSettings';
|
||||
|
@ -25,7 +24,7 @@ import { SystemDropDownSettingsUserView } from 'View/User/Settings/SystemDropDow
|
|||
import { MenuSettingsUserView } from 'View/User/Settings/Menu';
|
||||
import { PaneSettingsUserView } from 'View/User/Settings/Pane';
|
||||
|
||||
import { getApp } from 'Helper/Apps/User';
|
||||
const Settings = rl.settings;
|
||||
|
||||
class SettingsUserScreen extends AbstractSettingsScreen {
|
||||
constructor() {
|
||||
|
@ -113,14 +112,14 @@ class SettingsUserScreen extends AbstractSettingsScreen {
|
|||
keyScope(KeyState.Settings);
|
||||
leftPanelType('');
|
||||
|
||||
if (Settings.appSettingsGet('mobile')) {
|
||||
if (Settings.app('mobile')) {
|
||||
leftPanelDisabled(true);
|
||||
}
|
||||
}
|
||||
|
||||
setSettingsTitle() {
|
||||
const sEmail = AccountStore.email();
|
||||
getApp().setWindowTitle((sEmail ? sEmail + ' - ' : '') + this.sSettingsTitle);
|
||||
rl.setWindowTitle((sEmail ? sEmail + ' - ' : '') + this.sSettingsTitle);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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');
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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 });
|
||||
|
||||
|
|
|
@ -1,36 +0,0 @@
|
|||
let SETTINGS = RainLoop.data() || null;
|
||||
SETTINGS = null != SETTINGS ? SETTINGS : {};
|
||||
|
||||
/**
|
||||
* @param {string} name
|
||||
* @returns {*}
|
||||
*/
|
||||
export function settingsGet(name) {
|
||||
return null == SETTINGS[name] ? null : SETTINGS[name];
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {string} name
|
||||
* @param {*} value
|
||||
*/
|
||||
export function settingsSet(name, value) {
|
||||
SETTINGS[name] = value;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {string} name
|
||||
* @returns {*}
|
||||
*/
|
||||
export function appSettingsGet(name) {
|
||||
const APP_SETTINGS = SETTINGS.System || {};
|
||||
return null == APP_SETTINGS[name] ? null : APP_SETTINGS[name];
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {string} name
|
||||
* @returns {boolean}
|
||||
*/
|
||||
export function capa(name) {
|
||||
const values = SETTINGS.Capa;
|
||||
return Array.isArray(values) && null != name && values.includes(name);
|
||||
}
|
|
@ -1,5 +1,4 @@
|
|||
import ko from 'ko';
|
||||
import * as Settings from 'Storage/Settings';
|
||||
|
||||
class AbstractAppStore {
|
||||
constructor() {
|
||||
|
@ -9,9 +8,9 @@ class AbstractAppStore {
|
|||
}
|
||||
|
||||
populate() {
|
||||
this.allowLanguagesOnLogin(!!Settings.settingsGet('AllowLanguagesOnLogin'));
|
||||
this.allowLanguagesOnSettings(!!Settings.settingsGet('AllowLanguagesOnSettings'));
|
||||
this.newMoveToFolder(!!Settings.settingsGet('NewMoveToFolder'));
|
||||
this.allowLanguagesOnLogin(!!rl.settings.get('AllowLanguagesOnLogin'));
|
||||
this.allowLanguagesOnSettings(!!rl.settings.get('AllowLanguagesOnSettings'));
|
||||
this.newMoveToFolder(!!rl.settings.get('NewMoveToFolder'));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
import ko from 'ko';
|
||||
import { settingsGet } from 'Storage/Settings';
|
||||
import { AbstractAppStore } from 'Stores/AbstractApp';
|
||||
|
||||
class AppAdminStore extends AbstractAppStore {
|
||||
|
@ -18,6 +17,7 @@ class AppAdminStore extends AbstractAppStore {
|
|||
populate() {
|
||||
super.populate();
|
||||
|
||||
const settingsGet = rl.settings
|
||||
this.determineUserLanguage(!!settingsGet('DetermineUserLanguage'));
|
||||
this.determineUserDomain(!!settingsGet('DetermineUserDomain'));
|
||||
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
import ko from 'ko';
|
||||
import { Capa } from 'Common/Enums';
|
||||
import * as Settings from 'Storage/Settings';
|
||||
|
||||
class CapaAdminStore {
|
||||
constructor() {
|
||||
|
@ -18,17 +17,18 @@ class CapaAdminStore {
|
|||
}
|
||||
|
||||
populate() {
|
||||
this.additionalAccounts(Settings.capa(Capa.AdditionalAccounts));
|
||||
this.identities(Settings.capa(Capa.Identities));
|
||||
this.attachmentThumbnails(Settings.capa(Capa.AttachmentThumbnails));
|
||||
this.sieve(Settings.capa(Capa.Sieve));
|
||||
this.filters(Settings.capa(Capa.Filters));
|
||||
this.themes(Settings.capa(Capa.Themes));
|
||||
this.userBackground(Settings.capa(Capa.UserBackground));
|
||||
this.openPGP(Settings.capa(Capa.OpenPGP));
|
||||
this.twoFactorAuth(Settings.capa(Capa.TwoFactor));
|
||||
this.twoFactorAuthForce(Settings.capa(Capa.TwoFactorForce));
|
||||
this.templates(Settings.capa(Capa.Templates));
|
||||
let capa = rl.settings.capa;
|
||||
this.additionalAccounts(capa(Capa.AdditionalAccounts));
|
||||
this.identities(capa(Capa.Identities));
|
||||
this.attachmentThumbnails(capa(Capa.AttachmentThumbnails));
|
||||
this.sieve(capa(Capa.Sieve));
|
||||
this.filters(capa(Capa.Filters));
|
||||
this.themes(capa(Capa.Themes));
|
||||
this.userBackground(capa(Capa.UserBackground));
|
||||
this.openPGP(capa(Capa.OpenPGP));
|
||||
this.twoFactorAuth(capa(Capa.TwoFactor));
|
||||
this.twoFactorAuthForce(capa(Capa.TwoFactorForce));
|
||||
this.templates(capa(Capa.Templates));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
import ko from 'ko';
|
||||
import * as Settings from 'Storage/Settings';
|
||||
|
||||
class LanguageStore {
|
||||
constructor() {
|
||||
|
@ -21,17 +20,18 @@ class LanguageStore {
|
|||
}
|
||||
|
||||
populate() {
|
||||
const aLanguages = Settings.appSettingsGet('languages'),
|
||||
aLanguagesAdmin = Settings.appSettingsGet('languagesAdmin');
|
||||
const Settings = rl.settings,
|
||||
aLanguages = Settings.app('languages'),
|
||||
aLanguagesAdmin = Settings.app('languagesAdmin');
|
||||
|
||||
this.languages(Array.isArray(aLanguages) ? aLanguages : []);
|
||||
this.languagesAdmin(Array.isArray(aLanguagesAdmin) ? aLanguagesAdmin : []);
|
||||
|
||||
this.language(Settings.settingsGet('Language'));
|
||||
this.languageAdmin(Settings.settingsGet('LanguageAdmin'));
|
||||
this.language(Settings.get('Language'));
|
||||
this.languageAdmin(Settings.get('LanguageAdmin'));
|
||||
|
||||
this.userLanguage(Settings.settingsGet('UserLanguage'));
|
||||
this.userLanguageAdmin(Settings.settingsGet('UserLanguageAdmin'));
|
||||
this.userLanguage(Settings.get('UserLanguage'));
|
||||
this.userLanguageAdmin(Settings.get('UserLanguageAdmin'));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
import ko from 'ko';
|
||||
import * as Settings from 'Storage/Settings';
|
||||
|
||||
class ThemeStore {
|
||||
constructor() {
|
||||
|
@ -11,12 +10,13 @@ class ThemeStore {
|
|||
}
|
||||
|
||||
populate() {
|
||||
const themes = Settings.appSettingsGet('themes');
|
||||
const Settings = rl.settings,
|
||||
themes = Settings.app('themes');
|
||||
|
||||
this.themes(Array.isArray(themes) ? themes : []);
|
||||
this.theme(Settings.settingsGet('Theme'));
|
||||
this.themeBackgroundName(Settings.settingsGet('UserBackgroundName'));
|
||||
this.themeBackgroundHash(Settings.settingsGet('UserBackgroundHash'));
|
||||
this.theme(Settings.get('Theme'));
|
||||
this.themeBackgroundName(Settings.get('UserBackgroundName'));
|
||||
this.themeBackgroundHash(Settings.get('UserBackgroundHash'));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
import ko from 'ko';
|
||||
import * as Settings from 'Storage/Settings';
|
||||
|
||||
class AccountUserStore {
|
||||
constructor() {
|
||||
|
@ -33,8 +32,8 @@ class AccountUserStore {
|
|||
}
|
||||
|
||||
populate() {
|
||||
this.email(Settings.settingsGet('Email'));
|
||||
this.parentEmail(Settings.settingsGet('ParentEmail'));
|
||||
this.email(rl.settings.get('Email'));
|
||||
this.parentEmail(rl.settings.get('ParentEmail'));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -4,10 +4,10 @@ import { Focused, KeyState } from 'Common/Enums';
|
|||
import { keyScope, leftPanelDisabled } from 'Common/Globals';
|
||||
import { isNonEmptyArray } from 'Common/Utils';
|
||||
|
||||
import * as Settings from 'Storage/Settings';
|
||||
|
||||
import { AbstractAppStore } from 'Stores/AbstractApp';
|
||||
|
||||
const Settings = rl.settings;
|
||||
|
||||
class AppUserStore extends AbstractAppStore {
|
||||
constructor() {
|
||||
super();
|
||||
|
@ -16,7 +16,7 @@ class AppUserStore extends AbstractAppStore {
|
|||
|
||||
this.focusedState = ko.observable(Focused.None);
|
||||
|
||||
const isMobile = Settings.appSettingsGet('mobile');
|
||||
const isMobile = Settings.app('mobile');
|
||||
|
||||
this.focusedState.subscribe((value) => {
|
||||
switch (value) {
|
||||
|
@ -62,18 +62,18 @@ class AppUserStore extends AbstractAppStore {
|
|||
populate() {
|
||||
super.populate();
|
||||
|
||||
this.projectHash(Settings.settingsGet('ProjectHash'));
|
||||
this.projectHash(Settings.get('ProjectHash'));
|
||||
|
||||
this.contactsAutosave(!!Settings.settingsGet('ContactsAutosave'));
|
||||
this.useLocalProxyForExternalImages(!!Settings.settingsGet('UseLocalProxyForExternalImages'));
|
||||
this.contactsAutosave(!!Settings.get('ContactsAutosave'));
|
||||
this.useLocalProxyForExternalImages(!!Settings.get('UseLocalProxyForExternalImages'));
|
||||
|
||||
this.contactsIsAllowed(!!Settings.settingsGet('ContactsIsAllowed'));
|
||||
this.contactsIsAllowed(!!Settings.get('ContactsIsAllowed'));
|
||||
|
||||
const attachmentsActions = Settings.appSettingsGet('attachmentsActions');
|
||||
const attachmentsActions = Settings.app('attachmentsActions');
|
||||
this.attachmentsActions(isNonEmptyArray(attachmentsActions) ? attachmentsActions : []);
|
||||
|
||||
this.devEmail = Settings.settingsGet('DevEmail');
|
||||
this.devPassword = Settings.settingsGet('DevPassword');
|
||||
this.devEmail = Settings.get('DevEmail');
|
||||
this.devPassword = Settings.get('DevPassword');
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
import ko from 'ko';
|
||||
import * as Settings from 'Storage/Settings';
|
||||
|
||||
class ContactUserStore {
|
||||
constructor() {
|
||||
|
@ -18,12 +17,13 @@ class ContactUserStore {
|
|||
}
|
||||
|
||||
populate() {
|
||||
this.allowContactsSync(!!Settings.settingsGet('ContactsSyncIsAllowed'));
|
||||
this.enableContactsSync(!!Settings.settingsGet('EnableContactsSync'));
|
||||
const settingsGet = rl.settings.get;
|
||||
this.allowContactsSync(!!settingsGet('ContactsSyncIsAllowed'));
|
||||
this.enableContactsSync(!!settingsGet('EnableContactsSync'));
|
||||
|
||||
this.contactsSyncUrl(Settings.settingsGet('ContactsSyncUrl'));
|
||||
this.contactsSyncUser(Settings.settingsGet('ContactsSyncUser'));
|
||||
this.contactsSyncPass(Settings.settingsGet('ContactsSyncPassword'));
|
||||
this.contactsSyncUrl(settingsGet('ContactsSyncUrl'));
|
||||
this.contactsSyncUser(settingsGet('ContactsSyncUser'));
|
||||
this.contactsSyncPass(settingsGet('ContactsSyncPassword'));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
import ko from 'ko';
|
||||
|
||||
import { settingsGet } from 'Storage/Settings';
|
||||
|
||||
import { FolderType } from 'Common/Enums';
|
||||
import { UNUSED_OPTION_VALUE } from 'Common/Consts';
|
||||
import { folderListOptionsBuilder } from 'Common/Utils';
|
||||
|
@ -32,7 +30,7 @@ class FolderUserStore {
|
|||
|
||||
this.currentFolder = ko.observable(null).extend({ toggleSubscribeProperty: [this, 'selected'] });
|
||||
|
||||
this.sieveAllowFileintoInbox = !!settingsGet('SieveAllowFileintoInbox');
|
||||
this.sieveAllowFileintoInbox = !!rl.settings.get('SieveAllowFileintoInbox');
|
||||
|
||||
this.computers();
|
||||
this.subscribers();
|
||||
|
|
|
@ -3,7 +3,6 @@ import ko from 'ko';
|
|||
import { DesktopNotification } from 'Common/Enums';
|
||||
import Audio from 'Common/Audio';
|
||||
|
||||
import * as Settings from 'Storage/Settings';
|
||||
|
||||
class NotificationUserStore {
|
||||
constructor() {
|
||||
|
@ -159,8 +158,8 @@ class NotificationUserStore {
|
|||
}
|
||||
|
||||
populate() {
|
||||
this.enableSoundNotification(!!Settings.settingsGet('SoundNotification'));
|
||||
this.enableDesktopNotification(!!Settings.settingsGet('DesktopNotifications'));
|
||||
this.enableSoundNotification(!!rl.settings.get('SoundNotification'));
|
||||
this.enableDesktopNotification(!!rl.settings.get('DesktopNotifications'));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -4,8 +4,6 @@ import { MESSAGES_PER_PAGE, MESSAGES_PER_PAGE_VALUES } from 'Common/Consts';
|
|||
import { Layout, EditorDefaultType } from 'Common/Enums';
|
||||
import { pInt } from 'Common/Utils';
|
||||
|
||||
import * as Settings from 'Storage/Settings';
|
||||
|
||||
class SettingsUserStore {
|
||||
constructor() {
|
||||
this.iAutoLogoutTimer = 0;
|
||||
|
@ -52,21 +50,22 @@ class SettingsUserStore {
|
|||
}
|
||||
|
||||
populate() {
|
||||
this.layout(pInt(Settings.settingsGet('Layout')));
|
||||
this.editorDefaultType(Settings.settingsGet('EditorDefaultType'));
|
||||
const settingsGet = rl.settings.get;
|
||||
this.layout(pInt(settingsGet('Layout')));
|
||||
this.editorDefaultType(settingsGet('EditorDefaultType'));
|
||||
|
||||
this.autoLogout(pInt(Settings.settingsGet('AutoLogout')));
|
||||
this.messagesPerPage(Settings.settingsGet('MPP'));
|
||||
this.autoLogout(pInt(settingsGet('AutoLogout')));
|
||||
this.messagesPerPage(settingsGet('MPP'));
|
||||
|
||||
this.showImages(!!Settings.settingsGet('ShowImages'));
|
||||
this.useCheckboxesInList(!!Settings.settingsGet('UseCheckboxesInList'));
|
||||
this.allowDraftAutosave(!!Settings.settingsGet('AllowDraftAutosave'));
|
||||
this.useThreads(!!Settings.settingsGet('UseThreads'));
|
||||
this.replySameFolder(!!Settings.settingsGet('ReplySameFolder'));
|
||||
this.showImages(!!settingsGet('ShowImages'));
|
||||
this.useCheckboxesInList(!!settingsGet('UseCheckboxesInList'));
|
||||
this.allowDraftAutosave(!!settingsGet('AllowDraftAutosave'));
|
||||
this.useThreads(!!settingsGet('UseThreads'));
|
||||
this.replySameFolder(!!settingsGet('ReplySameFolder'));
|
||||
|
||||
const refresh = () => {
|
||||
clearTimeout(this.iAutoLogoutTimer);
|
||||
if (0 < this.autoLogout() && !Settings.settingsGet('AccountSignMe')) {
|
||||
if (0 < this.autoLogout() && !settingsGet('AccountSignMe')) {
|
||||
this.iAutoLogoutTimer = setTimeout(() =>
|
||||
dispatchEvent(new CustomEvent('rl.auto-logout'))
|
||||
, this.autoLogout() * 60000);
|
||||
|
|
|
@ -3,8 +3,6 @@ import ko from 'ko';
|
|||
import { StorageResultType, Notification } from 'Common/Enums';
|
||||
import { getNotification } from 'Common/Translator';
|
||||
|
||||
import * as Settings from 'Storage/Settings';
|
||||
|
||||
import Remote from 'Remote/Admin/Ajax';
|
||||
|
||||
import { getApp } from 'Helper/Apps/Admin';
|
||||
|
@ -21,10 +19,11 @@ class LoginAdminView extends AbstractViewNext {
|
|||
constructor() {
|
||||
super();
|
||||
|
||||
this.mobile = !!Settings.appSettingsGet('mobile');
|
||||
this.mobileDevice = !!Settings.appSettingsGet('mobileDevice');
|
||||
const appSettingsGet = rl.settings.app;
|
||||
this.mobile = !!appSettingsGet('mobile');
|
||||
this.mobileDevice = !!appSettingsGet('mobileDevice');
|
||||
|
||||
this.hideSubmitButton = Settings.appSettingsGet('hideSubmitButton') ? '' : null;
|
||||
this.hideSubmitButton = appSettingsGet('hideSubmitButton') ? '' : null;
|
||||
|
||||
this.login = ko.observable('');
|
||||
this.password = ko.observable('');
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
import ko from 'ko';
|
||||
|
||||
import * as Settings from 'Storage/Settings';
|
||||
|
||||
import Remote from 'Remote/Admin/Ajax';
|
||||
|
||||
import DomainStore from 'Stores/Admin/Domain';
|
||||
|
@ -22,7 +20,7 @@ class PaneSettingsAdminView extends AbstractViewNext {
|
|||
constructor() {
|
||||
super();
|
||||
|
||||
this.version = ko.observable(Settings.appSettingsGet('version'));
|
||||
this.version = ko.observable(rl.settings.app('version'));
|
||||
|
||||
this.adminManLoading = ko.computed(
|
||||
() =>
|
||||
|
|
|
@ -39,8 +39,6 @@ import MessageStore from 'Stores/User/Message';
|
|||
|
||||
import Remote from 'Remote/User/Ajax';
|
||||
|
||||
import * as Settings from 'Storage/Settings';
|
||||
|
||||
import { ComposeAttachmentModel } from 'Model/ComposeAttachment';
|
||||
|
||||
import { getApp } from 'Helper/Apps/User';
|
||||
|
@ -48,6 +46,8 @@ import { getApp } from 'Helper/Apps/User';
|
|||
import { popup, command, isPopupVisible, showScreenPopup, hideScreenPopup, routeOn, routeOff } from 'Knoin/Knoin';
|
||||
import { AbstractViewNext } from 'Knoin/AbstractViewNext';
|
||||
|
||||
const Settings = rl.settings;
|
||||
|
||||
@popup({
|
||||
name: 'View/Popup/Compose',
|
||||
templateID: 'PopupsCompose'
|
||||
|
@ -1138,7 +1138,7 @@ class ComposePopupView extends AbstractViewNext {
|
|||
});
|
||||
}
|
||||
|
||||
if (Settings.appSettingsGet('allowCtrlEnterOnCompose')) {
|
||||
if (Settings.app('allowCtrlEnterOnCompose')) {
|
||||
key('ctrl+enter, command+enter', KeyState.Compose, () => {
|
||||
this.sendCommand();
|
||||
return false;
|
||||
|
@ -1184,7 +1184,7 @@ class ComposePopupView extends AbstractViewNext {
|
|||
initUploader() {
|
||||
if (this.composeUploaderButton()) {
|
||||
const uploadCache = {},
|
||||
attachmentSizeLimit = pInt(Settings.settingsGet('AttachmentLimit')),
|
||||
attachmentSizeLimit = pInt(Settings.get('AttachmentLimit')),
|
||||
oJua = new Jua({
|
||||
action: upload(),
|
||||
name: 'uploader',
|
||||
|
|
|
@ -30,8 +30,6 @@ import ContactStore from 'Stores/User/Contact';
|
|||
|
||||
import Remote from 'Remote/User/Ajax';
|
||||
|
||||
import * as Settings from 'Storage/Settings';
|
||||
|
||||
import { EmailModel } from 'Model/Email';
|
||||
import { ContactModel } from 'Model/Contact';
|
||||
import { ContactPropertyModel } from 'Model/ContactProperty';
|
||||
|
@ -221,7 +219,7 @@ class ContactsPopupView extends AbstractViewNext {
|
|||
|
||||
@command((self) => 0 < self.contactsCheckedOrSelected().length)
|
||||
newMessageCommand() {
|
||||
if (!Settings.capa(Capa.Composer)) {
|
||||
if (!rl.settings.capa(Capa.Composer)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -658,7 +656,7 @@ class ContactsPopupView extends AbstractViewNext {
|
|||
if (this.bBackToCompose) {
|
||||
this.bBackToCompose = false;
|
||||
|
||||
if (Settings.capa(Capa.Composer)) {
|
||||
if (rl.settings.capa(Capa.Composer)) {
|
||||
showScreenPopup(require('View/Popup/Compose'));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -7,7 +7,6 @@ import { initOnStartOrLangChange, i18n } from 'Common/Translator';
|
|||
|
||||
import FolderStore from 'Stores/User/Folder';
|
||||
|
||||
import * as Settings from 'Storage/Settings';
|
||||
import Remote from 'Remote/User/Ajax';
|
||||
|
||||
import { popup } from 'Knoin/Knoin';
|
||||
|
@ -55,12 +54,13 @@ class FolderSystemPopupView extends AbstractViewNext {
|
|||
this.trashFolder = FolderStore.trashFolder;
|
||||
this.archiveFolder = FolderStore.archiveFolder;
|
||||
|
||||
const fSetSystemFolders = () => {
|
||||
Settings.settingsSet('SentFolder', FolderStore.sentFolder());
|
||||
Settings.settingsSet('DraftFolder', FolderStore.draftFolder());
|
||||
Settings.settingsSet('SpamFolder', FolderStore.spamFolder());
|
||||
Settings.settingsSet('TrashFolder', FolderStore.trashFolder());
|
||||
Settings.settingsSet('ArchiveFolder', FolderStore.archiveFolder());
|
||||
const settingsSet = rl.settings.set,
|
||||
fSetSystemFolders = () => {
|
||||
settingsSet('SentFolder', FolderStore.sentFolder());
|
||||
settingsSet('DraftFolder', FolderStore.draftFolder());
|
||||
settingsSet('SpamFolder', FolderStore.spamFolder());
|
||||
settingsSet('TrashFolder', FolderStore.trashFolder());
|
||||
settingsSet('ArchiveFolder', FolderStore.archiveFolder());
|
||||
},
|
||||
fSaveSystemFolders = (()=>{
|
||||
fSetSystemFolders();
|
||||
|
|
|
@ -4,8 +4,6 @@ import { Capa, StorageResultType } from 'Common/Enums';
|
|||
import { pString } from 'Common/Utils';
|
||||
import { i18n, trigger as translatorTrigger } from 'Common/Translator';
|
||||
|
||||
import * as Settings from 'Storage/Settings';
|
||||
|
||||
import Remote from 'Remote/User/Ajax';
|
||||
|
||||
import { getApp } from 'Helper/Apps/User';
|
||||
|
@ -23,7 +21,7 @@ class TwoFactorConfigurationPopupView extends AbstractViewNext {
|
|||
|
||||
this.lock = ko.observable(false);
|
||||
|
||||
this.capaTwoFactor = Settings.capa(Capa.TwoFactor);
|
||||
this.capaTwoFactor = rl.settings.capa(Capa.TwoFactor);
|
||||
|
||||
this.processing = ko.observable(false);
|
||||
this.clearing = ko.observable(false);
|
||||
|
|
|
@ -7,22 +7,23 @@ import MessageStore from 'Stores/User/Message';
|
|||
import { Capa, KeyState } from 'Common/Enums';
|
||||
import { settings } from 'Common/Links';
|
||||
|
||||
import * as Settings from 'Storage/Settings';
|
||||
|
||||
import { getApp } from 'Helper/Apps/User';
|
||||
|
||||
import { showScreenPopup, setHash } from 'Knoin/Knoin';
|
||||
import { AbstractViewNext } from 'Knoin/AbstractViewNext';
|
||||
|
||||
const Settings = rl.settings;
|
||||
|
||||
class AbstractSystemDropDownUserView extends AbstractViewNext {
|
||||
constructor() {
|
||||
super();
|
||||
|
||||
this.logoImg = (Settings.settingsGet('UserLogo')||'').trim();
|
||||
this.logoTitle = (Settings.settingsGet('UserLogoTitle')||'').trim();
|
||||
this.logoImg = (Settings.get('UserLogo')||'').trim();
|
||||
this.logoTitle = (Settings.get('UserLogoTitle')||'').trim();
|
||||
|
||||
this.mobile = !!Settings.appSettingsGet('mobile');
|
||||
this.mobileDevice = !!Settings.appSettingsGet('mobileDevice');
|
||||
this.mobile = !!Settings.app('mobile');
|
||||
this.mobileDevice = !!Settings.app('mobileDevice');
|
||||
|
||||
this.allowSettings = !!Settings.capa(Capa.Settings);
|
||||
this.allowHelp = !!Settings.capa(Capa.Help);
|
||||
|
|
|
@ -15,7 +15,6 @@ import { getNotification, getNotificationFromResponse, reload as translatorReloa
|
|||
import AppStore from 'Stores/User/App';
|
||||
import LanguageStore from 'Stores/Language';
|
||||
|
||||
import * as Settings from 'Storage/Settings';
|
||||
import * as Local from 'Storage/Client';
|
||||
|
||||
import Remote from 'Remote/User/Ajax';
|
||||
|
@ -25,6 +24,8 @@ import { getApp } from 'Helper/Apps/User';
|
|||
import { view, command, ViewType, routeOff, showScreenPopup } from 'Knoin/Knoin';
|
||||
import { AbstractViewNext } from 'Knoin/AbstractViewNext';
|
||||
|
||||
const Settings = rl.settings;
|
||||
|
||||
@view({
|
||||
name: ['View/App/Login', 'View/User/Login'],
|
||||
type: ViewType.Center,
|
||||
|
@ -34,9 +35,9 @@ class LoginUserView extends AbstractViewNext {
|
|||
constructor() {
|
||||
super();
|
||||
|
||||
this.hideSubmitButton = Settings.appSettingsGet('hideSubmitButton') ? '' : null;
|
||||
this.hideSubmitButton = Settings.app('hideSubmitButton') ? '' : null;
|
||||
|
||||
this.welcome = ko.observable(!!Settings.settingsGet('UseLoginWelcomePage'));
|
||||
this.welcome = ko.observable(!!Settings.get('UseLoginWelcomePage'));
|
||||
|
||||
this.email = ko.observable('');
|
||||
this.password = ko.observable('');
|
||||
|
@ -48,14 +49,14 @@ class LoginUserView extends AbstractViewNext {
|
|||
this.additionalCode.visibility = ko.observable(false);
|
||||
this.additionalCodeSignMe = ko.observable(false);
|
||||
|
||||
this.logoImg = (Settings.settingsGet('LoginLogo')||'').trim();
|
||||
this.loginDescription = (Settings.settingsGet('LoginDescription')||'').trim();
|
||||
this.logoImg = (Settings.get('LoginLogo')||'').trim();
|
||||
this.loginDescription = (Settings.get('LoginDescription')||'').trim();
|
||||
|
||||
this.mobile = !!Settings.appSettingsGet('mobile');
|
||||
this.mobileDevice = !!Settings.appSettingsGet('mobileDevice');
|
||||
this.mobile = !!Settings.app('mobile');
|
||||
this.mobileDevice = !!Settings.app('mobileDevice');
|
||||
|
||||
this.forgotPasswordLinkUrl = Settings.appSettingsGet('forgotPasswordLinkUrl');
|
||||
this.registrationLinkUrl = Settings.appSettingsGet('registrationLinkUrl');
|
||||
this.forgotPasswordLinkUrl = Settings.app('forgotPasswordLinkUrl');
|
||||
this.registrationLinkUrl = Settings.app('registrationLinkUrl');
|
||||
|
||||
this.emailError = ko.observable(false);
|
||||
this.passwordError = ko.observable(false);
|
||||
|
@ -130,8 +131,8 @@ class LoginUserView extends AbstractViewNext {
|
|||
|
||||
this.signMeVisibility = ko.computed(() => LoginSignMeType.Unused !== this.signMeType());
|
||||
|
||||
if (Settings.settingsGet('AdditionalLoginError') && !this.submitError()) {
|
||||
this.submitError(Settings.settingsGet('AdditionalLoginError'));
|
||||
if (Settings.get('AdditionalLoginError') && !this.submitError()) {
|
||||
this.submitError(Settings.get('AdditionalLoginError'));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -231,7 +232,7 @@ class LoginUserView extends AbstractViewNext {
|
|||
|
||||
onBuild() {
|
||||
const signMeLocal = Local.get(ClientSideKeyName.LastSignMe),
|
||||
signMe = (Settings.settingsGet('SignMe') || 'unused').toLowerCase();
|
||||
signMe = (Settings.get('SignMe') || 'unused').toLowerCase();
|
||||
|
||||
switch (signMe) {
|
||||
case LoginSignMeTypeAsString.DefaultOff:
|
||||
|
|
|
@ -10,13 +10,13 @@ import SettingsStore from 'Stores/User/Settings';
|
|||
import FolderStore from 'Stores/User/Folder';
|
||||
import MessageStore from 'Stores/User/Message';
|
||||
|
||||
import * as Settings from 'Storage/Settings';
|
||||
|
||||
import { getApp } from 'Helper/Apps/User';
|
||||
|
||||
import { view, ViewType, showScreenPopup, setHash } from 'Knoin/Knoin';
|
||||
import { AbstractViewNext } from 'Knoin/AbstractViewNext';
|
||||
|
||||
const Settings = rl.settings;
|
||||
|
||||
@view({
|
||||
name: 'View/User/MailBox/FolderList',
|
||||
type: ViewType.Left,
|
||||
|
@ -60,7 +60,7 @@ class FolderListMailBoxUserView extends AbstractViewNext {
|
|||
onBuild(dom) {
|
||||
const qs = s => dom.querySelector(s),
|
||||
eqs = (ev, s) => ev.target.closestWithin(s, dom),
|
||||
isMobile = Settings.appSettingsGet('mobile'),
|
||||
isMobile = Settings.app('mobile'),
|
||||
fSelectFolder = (el, event, starred) => {
|
||||
const isMove = moveAction();
|
||||
if (isMobile) {
|
||||
|
|
|
@ -35,7 +35,6 @@ import SettingsStore from 'Stores/User/Settings';
|
|||
import FolderStore from 'Stores/User/Folder';
|
||||
import MessageStore from 'Stores/User/Message';
|
||||
|
||||
import * as Settings from 'Storage/Settings';
|
||||
import Remote from 'Remote/User/Ajax';
|
||||
|
||||
import { getApp } from 'Helper/Apps/User';
|
||||
|
@ -44,6 +43,7 @@ import { view, command, ViewType, showScreenPopup, setHash, popupVisibility } fr
|
|||
import { AbstractViewNext } from 'Knoin/AbstractViewNext';
|
||||
|
||||
const
|
||||
Settings = rl.settings,
|
||||
canBeMovedHelper = (self) => self.canBeMoved(),
|
||||
ifvisible = window.ifvisible;
|
||||
|
||||
|
@ -62,7 +62,7 @@ class MessageListMailBoxUserView extends AbstractViewNext {
|
|||
|
||||
this.iGoToUpUpOrDownDownTimeout = 0;
|
||||
|
||||
this.mobile = !!Settings.appSettingsGet('mobile');
|
||||
this.mobile = !!Settings.app('mobile');
|
||||
this.newMoveToFolder = AppStore.newMoveToFolder;
|
||||
|
||||
this.allowReload = !!Settings.capa(Capa.Reload);
|
||||
|
@ -944,7 +944,7 @@ class MessageListMailBoxUserView extends AbstractViewNext {
|
|||
}
|
||||
|
||||
initUploaderForAppend() {
|
||||
if (!Settings.appSettingsGet('allowAppendMessage') || !this.dragOverArea()) {
|
||||
if (!Settings.app('allowAppendMessage') || !this.dragOverArea()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -38,7 +38,6 @@ import FolderStore from 'Stores/User/Folder';
|
|||
import MessageStore from 'Stores/User/Message';
|
||||
|
||||
import * as Local from 'Storage/Client';
|
||||
import * as Settings from 'Storage/Settings';
|
||||
|
||||
import Remote from 'Remote/User/Ajax';
|
||||
import Promises from 'Promises/User/Ajax';
|
||||
|
@ -48,6 +47,8 @@ import { getApp } from 'Helper/Apps/User';
|
|||
import { view, command, ViewType, showScreenPopup, createCommand } from 'Knoin/Knoin';
|
||||
import { AbstractViewNext } from 'Knoin/AbstractViewNext';
|
||||
|
||||
const Settings = rl.settings;
|
||||
|
||||
@view({
|
||||
name: 'View/User/MailBox/MessageView',
|
||||
type: ViewType.Right,
|
||||
|
@ -87,10 +88,10 @@ class MessageViewMailBoxUserView extends AbstractViewNext {
|
|||
this.allowMessageActions = !!Settings.capa(Capa.MessageActions);
|
||||
this.allowMessageListActions = !!Settings.capa(Capa.MessageListActions);
|
||||
|
||||
this.logoImg = (Settings.settingsGet('UserLogoMessage')||'').trim();
|
||||
this.logoIframe = (Settings.settingsGet('UserIframeMessage')||'').trim();
|
||||
this.logoImg = (Settings.get('UserLogoMessage')||'').trim();
|
||||
this.logoIframe = (Settings.get('UserIframeMessage')||'').trim();
|
||||
|
||||
this.mobile = !!Settings.appSettingsGet('mobile');
|
||||
this.mobile = !!Settings.app('mobile');
|
||||
|
||||
this.attachmentsActions = AppStore.attachmentsActions;
|
||||
|
||||
|
|
|
@ -3,8 +3,6 @@ import { leftPanelDisabled } from 'Common/Globals';
|
|||
import { settings, inbox } from 'Common/Links';
|
||||
import { getFolderInboxName } from 'Common/Cache';
|
||||
|
||||
import * as Settings from 'Storage/Settings';
|
||||
|
||||
import { view, ViewType, setHash, settingsMenuKeysHandler } from 'Knoin/Knoin';
|
||||
import { AbstractViewNext } from 'Knoin/AbstractViewNext';
|
||||
|
||||
|
@ -22,7 +20,7 @@ class MenuSettingsUserView extends AbstractViewNext {
|
|||
|
||||
this.leftPanelDisabled = leftPanelDisabled;
|
||||
|
||||
this.mobile = Settings.appSettingsGet('mobile');
|
||||
this.mobile = rl.settings.app('mobile');
|
||||
|
||||
this.menu = screen.menu;
|
||||
}
|
||||
|
|
|
@ -2,8 +2,6 @@ import { inbox } from 'Common/Links';
|
|||
import { getFolderInboxName } from 'Common/Cache';
|
||||
import { leftPanelDisabled } from 'Common/Globals';
|
||||
|
||||
import * as Settings from 'Storage/Settings';
|
||||
|
||||
import MessageStore from 'Stores/User/Message';
|
||||
|
||||
import { view, ViewType, setHash } from 'Knoin/Knoin';
|
||||
|
@ -18,7 +16,7 @@ class PaneSettingsUserView extends AbstractViewNext {
|
|||
constructor() {
|
||||
super();
|
||||
|
||||
this.mobile = Settings.appSettingsGet('mobile');
|
||||
this.mobile = rl.settings.app('mobile');
|
||||
|
||||
this.leftPanelDisabled = leftPanelDisabled;
|
||||
}
|
||||
|
|
47
dev/boot.js
47
dev/boot.js
|
@ -4,7 +4,7 @@
|
|||
const
|
||||
doc = win.document,
|
||||
app = doc.getElementById('rl-app'),
|
||||
setPercentWidth = percent => setTimeout(() => progress.style.width = parseInt(Math.min(percent, 100)) + '%', 50),
|
||||
options = app && app.dataset.boot && JSON.parse(app.dataset.boot) || {},
|
||||
|
||||
Storage = type => {
|
||||
let name = type+'Storage';
|
||||
|
@ -85,10 +85,10 @@ const
|
|||
},
|
||||
|
||||
p = win.progressJs = {
|
||||
set: percent => setPercentWidth(percent),
|
||||
set: percent => progress.style.width = Math.min(percent, 100) + '%',
|
||||
end: () => {
|
||||
if (container) {
|
||||
setPercentWidth(100);
|
||||
p.set(100);
|
||||
setTimeout(() => {
|
||||
container.remove();
|
||||
container = progress = null;
|
||||
|
@ -100,19 +100,19 @@ const
|
|||
let container = doc.createElement('div'),
|
||||
progress = container.appendChild(doc.createElement("div")),
|
||||
|
||||
RL_APP_DATA_STORAGE = null;
|
||||
RL_APP_DATA_STORAGE = {};
|
||||
|
||||
container.className = 'progressjs-progress progressjs-theme-rainloop';
|
||||
progress.className = "progressjs-inner";
|
||||
progress.appendChild(doc.createElement('div')).className = "progressjs-percent";
|
||||
|
||||
setPercentWidth(1);
|
||||
p.set(1);
|
||||
doc.body.append(container);
|
||||
|
||||
Storage('local');
|
||||
Storage('session');
|
||||
|
||||
win.RainLoop = {
|
||||
win.rl = {
|
||||
hash: {
|
||||
// getHash
|
||||
get: () => storage().getItem(STORAGE_KEY) || null,
|
||||
|
@ -131,13 +131,30 @@ win.RainLoop = {
|
|||
check: () => {
|
||||
if (timestamp() > (parseInt(storage().getItem(TIME_KEY) || 0, 10) || 0) + 3600000) {
|
||||
// 60m
|
||||
RainLoop.hash.clear();
|
||||
rl.hash.clear();
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
},
|
||||
data: () => RL_APP_DATA_STORAGE
|
||||
data: () => RL_APP_DATA_STORAGE,
|
||||
adminArea: () => options.admin,
|
||||
settings: {
|
||||
get: name => null == RL_APP_DATA_STORAGE[name] ? null : RL_APP_DATA_STORAGE[name],
|
||||
set: (name, value) => RL_APP_DATA_STORAGE[name] = value,
|
||||
app: name => {
|
||||
const APP_SETTINGS = RL_APP_DATA_STORAGE.System || {};
|
||||
return null == APP_SETTINGS[name] ? null : APP_SETTINGS[name];
|
||||
},
|
||||
capa: name => null != name && Array.isArray(RL_APP_DATA_STORAGE.Capa) && RL_APP_DATA_STORAGE.Capa.includes(name)
|
||||
},
|
||||
setWindowTitle: title => {
|
||||
title = null == title ? '' : '' + title;
|
||||
if (RL_APP_DATA_STORAGE.Title) {
|
||||
title += (title ? ' - ' : '') + RL_APP_DATA_STORAGE.Title;
|
||||
}
|
||||
document.title = null == title ? '' : '' + title;
|
||||
}
|
||||
};
|
||||
|
||||
// init section
|
||||
|
@ -150,7 +167,7 @@ setInterval(setTimestamp, 60000); // 1m
|
|||
win.__initAppData = appData => {
|
||||
RL_APP_DATA_STORAGE = appData;
|
||||
|
||||
RainLoop.hash.set();
|
||||
rl.hash.set();
|
||||
|
||||
if (appData) {
|
||||
const css = appData.IncludeCss,
|
||||
|
@ -188,7 +205,7 @@ win.__initAppData = appData => {
|
|||
loadScript(appData.StaticLibJsLink).then(() => {
|
||||
doc.getElementById('rl-check').remove();
|
||||
if (appData.IncludeBackground) {
|
||||
const img = appData.IncludeBackground.replace('{{USER}}', RainLoop.hash.get() || '0');
|
||||
const img = appData.IncludeBackground.replace('{{USER}}', rl.hash.get() || '0');
|
||||
if (img) {
|
||||
doc.documentElement.classList.add('UserBackground');
|
||||
doc.body.style.backgroundImage = "url("+img+")";
|
||||
|
@ -236,10 +253,6 @@ if (!navigator || !navigator.cookieEnabled) {
|
|||
writeCSS('#rl-content{display:none;}.internal-hiddden{display:none !important;}');
|
||||
|
||||
if (app) {
|
||||
const
|
||||
meta = doc.getElementById('app-boot-data'),
|
||||
options = meta ? JSON.parse(meta.getAttribute('content')) || {} : {};
|
||||
|
||||
app.innerHTML = '<div id="rl-loading" class="thm-loading" style="opacity:0">\
|
||||
<div id="rl-loading-desc"></div>\
|
||||
<div class="e-spinner">\
|
||||
|
@ -248,9 +261,7 @@ if (app) {
|
|||
<div class="e-bounce bounce3"></div>\
|
||||
</div>\
|
||||
</div>\
|
||||
<div id="rl-loading-error" class="thm-loading">\
|
||||
An error occurred. <br /> Please refresh the page and try again.\
|
||||
</div>\
|
||||
<div id="rl-loading-error" class="thm-loading">An error occurred.<br/>Please refresh the page and try again.</div>\
|
||||
<div id="rl-content">\
|
||||
<div id="rl-popups"></div>\
|
||||
<div id="rl-center">\
|
||||
|
@ -268,7 +279,7 @@ if (app) {
|
|||
+ (options.mobile ? 'mobile' : 'no-mobile')
|
||||
+ (options.mobileDevice ? '-1' : '-0')
|
||||
+ '/'
|
||||
+ (RainLoop.hash.get() || '0')
|
||||
+ (rl.hash.get() || '0')
|
||||
+ '/'
|
||||
+ Math.random().toString().substr(2)
|
||||
+ '/').then(() => {});
|
||||
|
|
7
dev/bootstrap.js
vendored
7
dev/bootstrap.js
vendored
|
@ -64,12 +64,7 @@ export default (App) => {
|
|||
cb = () => setTimeout(() => {
|
||||
if (window.rainloopTEMPLATES && rainloopTEMPLATES[0]) {
|
||||
doc.getElementById('rl-templates').innerHTML = rainloopTEMPLATES[0];
|
||||
setTimeout(() => {
|
||||
$htmlCL.remove('no-js', 'rl-booted-trigger');
|
||||
$htmlCL.add('rl-booted');
|
||||
|
||||
App.bootstart();
|
||||
}, 10);
|
||||
setTimeout(() => App.bootstart(), 10);
|
||||
} else {
|
||||
fErrorCallback();
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<!DOCTYPE html>
|
||||
<html class="no-js rl-booted-trigger rl-started-trigger glass" dir="{{BaseDir}}">
|
||||
<html class="rl-started-trigger glass" dir="{{BaseDir}}">
|
||||
|
||||
<head>
|
||||
<noscript>
|
||||
|
@ -10,7 +10,6 @@
|
|||
<meta name="apple-mobile-web-app-capable" content="yes" />
|
||||
<meta name="google" content="notranslate" />
|
||||
<meta name="robots" content="noindex,nofollow,noodp" />
|
||||
<meta name="AppBootData" content='{{RainloopBootData}}' id="app-boot-data" />
|
||||
<title></title>
|
||||
{{BaseAppFaviconPngLinkTag}}
|
||||
{{BaseAppFaviconTouchLinkTag}}
|
||||
|
@ -20,7 +19,7 @@
|
|||
</head>
|
||||
|
||||
<body class="thm-body">
|
||||
<div id="rl-app"></div>
|
||||
<div id="rl-app" data-boot='{{RainloopBootData}}'></div>
|
||||
<div id="rl-check"></div>
|
||||
<script type="text/javascript" data-cfasync="false" src="{{BaseAppBootScriptLink}}"></script>
|
||||
</body>
|
||||
|
|
10
vendors/bootstrap/less/mixins.less
vendored
10
vendors/bootstrap/less/mixins.less
vendored
|
@ -36,6 +36,16 @@
|
|||
// FORMS
|
||||
// --------------------------------------------------
|
||||
|
||||
// Block level inputs
|
||||
.input-block-level {
|
||||
display: block;
|
||||
width: 100%;
|
||||
min-height: 30px; // Make inputs at least the height of their button counterpart
|
||||
box-sizing: border-box; // Makes inputs behave like true block-level elements
|
||||
}
|
||||
|
||||
|
||||
|
||||
// Mixin for form field states
|
||||
.formFieldState(@textColor: #555, @borderColor: #ccc, @backgroundColor: #f5f5f5) {
|
||||
// Set the text color
|
||||
|
|
Loading…
Reference in a new issue