snappymail/dev/Stores/Admin/App.js

38 lines
990 B
JavaScript
Raw Normal View History

2017-10-07 02:52:00 +08:00
import window from 'window';
import $ from '$';
2015-11-19 01:32:29 +08:00
import ko from 'ko';
2016-07-16 03:54:37 +08:00
import {settingsGet} from 'Storage/Settings';
2015-11-19 01:32:29 +08:00
import {AbstractAppStore} from 'Stores/AbstractApp';
2015-11-19 01:32:29 +08:00
class AppAdminStore extends AbstractAppStore
{
2016-07-16 05:29:42 +08:00
constructor() {
2015-11-19 01:32:29 +08:00
super();
this.determineUserLanguage = ko.observable(false);
this.determineUserDomain = ko.observable(false);
this.weakPassword = ko.observable(false);
this.useLocalProxyForExternalImages = ko.observable(false);
2017-10-02 01:54:50 +08:00
this.dataFolderAccess = ko.observable(false);
}
2015-11-19 01:32:29 +08:00
populate() {
super.populate();
2016-07-16 03:54:37 +08:00
this.determineUserLanguage(!!settingsGet('DetermineUserLanguage'));
this.determineUserDomain(!!settingsGet('DetermineUserDomain'));
2016-07-16 03:54:37 +08:00
this.weakPassword(!!settingsGet('WeakPassword'));
this.useLocalProxyForExternalImages(!!settingsGet('UseLocalProxyForExternalImages'));
2017-10-02 01:54:50 +08:00
if (settingsGet('Auth')) {
2017-10-07 02:52:00 +08:00
$.get('./data/VERSION?' + window.Math.random()).then(() => this.dataFolderAccess(true));
2017-10-02 01:54:50 +08:00
}
}
2015-11-19 01:32:29 +08:00
}
export default new AppAdminStore();