mirror of
https://github.com/the-djmaze/snappymail.git
synced 2026-08-27 19:19:21 +03:00
Also reduce admin remote fetch
This commit is contained in:
parent
c1228d09f0
commit
35bce8cf62
11 changed files with 148 additions and 260 deletions
|
|
@ -43,7 +43,7 @@ class LoginAdminView extends AbstractViewLogin {
|
|||
if (valid) {
|
||||
this.submitRequest(true);
|
||||
|
||||
Remote.adminLogin(
|
||||
Remote.request('AdminLogin',
|
||||
(iError, oData) => {
|
||||
if (iError) {
|
||||
this.submitRequest(false);
|
||||
|
|
@ -51,11 +51,11 @@ class LoginAdminView extends AbstractViewLogin {
|
|||
} else {
|
||||
rl.setData(oData.Result);
|
||||
}
|
||||
},
|
||||
name,
|
||||
pass,
|
||||
this.totp()
|
||||
);
|
||||
}, {
|
||||
Login: name,
|
||||
Password: pass,
|
||||
TOTP: this.totp()
|
||||
});
|
||||
}
|
||||
|
||||
return valid;
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ class PaneSettingsAdminView extends AbstractViewRight {
|
|||
}
|
||||
|
||||
logoutClick() {
|
||||
Remote.adminLogout(() => rl.logoutReload());
|
||||
Remote.request('AdminLogout', () => rl.logoutReload());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -8,6 +8,25 @@ import { AbstractViewPopup } from 'Knoin/AbstractViews';
|
|||
|
||||
import { DomainAdminStore } from 'Stores/Admin/Domain';
|
||||
|
||||
const domainToParams = oDomain => ({
|
||||
Name: oDomain.name(),
|
||||
|
||||
IncHost: oDomain.imapServer(),
|
||||
IncPort: oDomain.imapPort(),
|
||||
IncSecure: oDomain.imapSecure(),
|
||||
|
||||
UseSieve: oDomain.useSieve() ? 1 : 0,
|
||||
SieveHost: oDomain.sieveServer(),
|
||||
SievePort: oDomain.sievePort(),
|
||||
SieveSecure: oDomain.sieveSecure(),
|
||||
|
||||
OutHost: oDomain.smtpServer(),
|
||||
OutPort: oDomain.smtpPort(),
|
||||
OutSecure: oDomain.smtpSecure(),
|
||||
OutAuth: oDomain.smtpAuth() ? 1 : 0,
|
||||
OutUsePhpMail: oDomain.smtpPhpMail() ? 1 : 0
|
||||
});
|
||||
|
||||
class DomainPopupView extends AbstractViewPopup {
|
||||
constructor() {
|
||||
super('Domain');
|
||||
|
|
@ -144,9 +163,18 @@ class DomainPopupView extends AbstractViewPopup {
|
|||
|
||||
createOrAddCommand() {
|
||||
this.saving(true);
|
||||
Remote.createOrUpdateDomain(
|
||||
Remote.request('AdminDomainSave',
|
||||
this.onDomainCreateOrSaveResponse.bind(this),
|
||||
this
|
||||
Object.assign(domainToParams(this), {
|
||||
Create: this.edit() ? 0 : 1,
|
||||
|
||||
IncShortLogin: this.imapShortLogin() ? 1 : 0,
|
||||
|
||||
OutShortLogin: this.smtpShortLogin() ? 1 : 0,
|
||||
OutSetSender: this.smtpSetSender() ? 1 : 0,
|
||||
|
||||
WhiteList: this.whiteList()
|
||||
})
|
||||
);
|
||||
}
|
||||
|
||||
|
|
@ -157,7 +185,7 @@ class DomainPopupView extends AbstractViewPopup {
|
|||
this.testingSmtpError(false);
|
||||
this.testing(true);
|
||||
|
||||
Remote.testConnectionForDomain(
|
||||
Remote.request('AdminDomainTest',
|
||||
(iError, oData) => {
|
||||
this.testing(false);
|
||||
if (iError) {
|
||||
|
|
@ -186,7 +214,7 @@ class DomainPopupView extends AbstractViewPopup {
|
|||
}
|
||||
}
|
||||
},
|
||||
this
|
||||
domainToParams(this)
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -35,15 +35,19 @@ class DomainAliasPopupView extends AbstractViewPopup {
|
|||
|
||||
createCommand() {
|
||||
this.saving(true);
|
||||
Remote.createDomainAlias(iError => {
|
||||
this.saving(false);
|
||||
if (iError) {
|
||||
this.savingError(getNotification(iError));
|
||||
} else {
|
||||
DomainAdminStore.fetch();
|
||||
this.closeCommand();
|
||||
}
|
||||
}, this.name(), this.alias());
|
||||
Remote.request('AdminDomainAliasSave',
|
||||
iError => {
|
||||
this.saving(false);
|
||||
if (iError) {
|
||||
this.savingError(getNotification(iError));
|
||||
} else {
|
||||
DomainAdminStore.fetch();
|
||||
this.closeCommand();
|
||||
}
|
||||
}, {
|
||||
Name: this.name(),
|
||||
Alias: this.alias()
|
||||
});
|
||||
}
|
||||
|
||||
onShow() {
|
||||
|
|
|
|||
|
|
@ -39,7 +39,7 @@ class PluginPopupView extends AbstractViewPopup {
|
|||
}
|
||||
|
||||
saveCommand() {
|
||||
const list = {
|
||||
const oConfig = {
|
||||
Id: this.id(),
|
||||
Settings: {}
|
||||
};
|
||||
|
|
@ -49,15 +49,15 @@ class PluginPopupView extends AbstractViewPopup {
|
|||
if (false === value || true === value) {
|
||||
value = value ? 1 : 0;
|
||||
}
|
||||
list.Settings[oItem.Name] = value;
|
||||
oConfig.Settings[oItem.Name] = value;
|
||||
});
|
||||
|
||||
this.saveError('');
|
||||
Remote.pluginSettingsUpdate(iError =>
|
||||
iError
|
||||
Remote.request('AdminPluginSettingsUpdate',
|
||||
iError => iError
|
||||
? this.saveError(getNotification(iError))
|
||||
: this.cancelCommand()
|
||||
, list);
|
||||
: this.cancelCommand(),
|
||||
oConfig);
|
||||
}
|
||||
|
||||
onShow(oPlugin) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue