Found more JSON properties to change into JavaScript camelCase

This commit is contained in:
the-djmaze 2023-01-26 10:41:55 +01:00
parent b9ef8ae2c9
commit 974350ebee
45 changed files with 361 additions and 412 deletions

View file

@ -79,7 +79,7 @@ export class AppUser extends AbstractApp {
(currentTime > (lastTime + interval + 1000)) (currentTime > (lastTime + interval + 1000))
&& Remote.request('Version', && Remote.request('Version',
iError => (100 < iError) && location.reload(), iError => (100 < iError) && location.reload(),
{ Version: Settings.app('version') } { version: Settings.app('version') }
); );
lastTime = currentTime; lastTime = currentTime;
}, interval); }, interval);

View file

@ -198,7 +198,7 @@ folderInformationMultiply = (boot = false) => {
boot && setTimeout(() => folderInformationMultiply(true), 2000); boot && setTimeout(() => folderInformationMultiply(true), 2000);
} }
}, { }, {
Folders: folders folders: folders
}); });
} }
}, },
@ -226,11 +226,11 @@ messagesMoveHelper = (fromFolderFullName, toFolderFullName, uidsForMove) => {
Remote.abort('MessageList').request('MessageMove', Remote.abort('MessageList').request('MessageMove',
moveOrDeleteResponseHelper, moveOrDeleteResponseHelper,
{ {
FromFolder: fromFolderFullName, fromFolder: fromFolderFullName,
ToFolder: toFolderFullName, toFolder: toFolderFullName,
Uids: [...uidsForMove].join(','), uids: [...uidsForMove].join(','),
MarkAsRead: (isSpam || FolderUserStore.trashFolder() === toFolderFullName) ? 1 : 0, markAsRead: (isSpam || FolderUserStore.trashFolder() === toFolderFullName) ? 1 : 0,
Learning: isSpam ? 'SPAM' : isHam ? 'HAM' : '' learning: isSpam ? 'SPAM' : isHam ? 'HAM' : ''
} }
); );
}, },
@ -240,7 +240,7 @@ messagesDeleteHelper = (sFromFolderFullName, aUidForRemove) => {
moveOrDeleteResponseHelper, moveOrDeleteResponseHelper,
{ {
folder: sFromFolderFullName, folder: sFromFolderFullName,
Uids: [...aUidForRemove].join(',') uids: [...aUidForRemove].join(',')
} }
); );
}, },
@ -259,9 +259,9 @@ moveMessagesToFolder = (sFromFolderFullName, oUids, sToFolderFullName, bCopy) =>
if (oFromFolder && oToFolder) { if (oFromFolder && oToFolder) {
bCopy bCopy
? Remote.request('MessageCopy', null, { ? Remote.request('MessageCopy', null, {
FromFolder: oFromFolder.fullName, fromFolder: oFromFolder.fullName,
ToFolder: oToFolder.fullName, toFolder: oToFolder.fullName,
Uids: [...oUids].join(',') uids: [...oUids].join(',')
}) })
: messagesMoveHelper(oFromFolder.fullName, oToFolder.fullName, oUids); : messagesMoveHelper(oFromFolder.fullName, oToFolder.fullName, oUids);
@ -283,7 +283,7 @@ dropFilesInFolder = (sFolderFullName, files) => {
++count; ++count;
let data = new FormData; let data = new FormData;
data.append('folder', sFolderFullName); data.append('folder', sFolderFullName);
data.append('AppendFile', file); data.append('appendFile', file);
data.XToken = Settings.app('token'); data.XToken = Settings.app('token');
fetch(serverRequest('Append'), { fetch(serverRequest('Append'), {
method: 'POST', method: 'POST',

View file

@ -12,6 +12,7 @@ import { SettingsUserStore } from 'Stores/User/Settings';
import * as Local from 'Storage/Client'; import * as Local from 'Storage/Client';
import { ThemeStore } from 'Stores/Theme'; import { ThemeStore } from 'Stores/Theme';
import Remote from 'Remote/User/Fetch'; import Remote from 'Remote/User/Fetch';
import { attachmentDownload } from 'Common/Links';
export const export const
@ -42,6 +43,28 @@ download = (link, name = "") => {
} }
}, },
downloadZip = (hashes, onError, fTrigger, folder) => {
if (hashes.length) {
let params = {
target: 'zip',
hashes: hashes
};
if (!onError) {
onError = () => alert('Download failed');
}
if (folder) {
params.folder = folder;
// params.uids = uids;
}
Remote.post('AttachmentsActions', fTrigger || null, params)
.then(result => {
let hash = result?.Result?.fileHash;
hash ? download(attachmentDownload(hash), hash+'.zip') : onError();
})
.catch(onError);
}
},
/** /**
* @returns {function} * @returns {function}
*/ */

View file

@ -301,8 +301,8 @@ export class FolderModel extends AbstractModel {
this.exists = true; this.exists = true;
this.hash = ''; this.hash = '';
// this.id = null; this.id = 0;
this.uidNext = null; this.uidNext = 0;
addObservablesTo(this, { addObservablesTo(this, {
name: '', name: '',

View file

@ -44,9 +44,9 @@ const
} }
}, { }, {
folder: message.folder, folder: message.folder,
Uids: message.uid, uids: message.uid,
Keyword: keyword, keyword: keyword,
SetAction: isSet ? 0 : 1 setAction: isSet ? 0 : 1
}) })
}, },

View file

@ -59,10 +59,10 @@ export class AdminSettingsAbout /*extends AbstractViewSettings*/ {
this.coreChecking(false); this.coreChecking(false);
if (!iError && data?.Result) { if (!iError && data?.Result) {
this.coreReal(true); this.coreReal(true);
this.coreUpdatable(!!data.Result.Updatable); this.coreUpdatable(!!data.Result.updatable);
this.coreWarning(!!data.Result.Warning); this.coreWarning(!!data.Result.warning);
this.coreVersion(data.Result.Version || ''); this.coreVersion(data.Result.version || '');
this.coreVersionCompare(data.Result.VersionCompare); this.coreVersionCompare(data.Result.versionCompare);
} else { } else {
this.coreReal(false); this.coreReal(false);
this.coreWarning(false); this.coreWarning(false);

View file

@ -25,7 +25,7 @@ export class AdminSettingsDomains /*extends AbstractViewSettings*/ {
} }
}, },
{ {
username: this.username() username: this.username
} }
); );
} }
@ -41,15 +41,15 @@ export class AdminSettingsDomains /*extends AbstractViewSettings*/ {
deleteDomain(domain) { deleteDomain(domain) {
DomainAdminStore.remove(domain); DomainAdminStore.remove(domain);
Remote.request('AdminDomainDelete', DomainAdminStore.fetch, { Remote.request('AdminDomainDelete', DomainAdminStore.fetch, {
Name: domain.name name: domain.name
}); });
} }
disableDomain(domain) { disableDomain(domain) {
domain.disabled(!domain.disabled()); domain.disabled(!domain.disabled());
Remote.request('AdminDomainDisable', DomainAdminStore.fetch, { Remote.request('AdminDomainDisable', DomainAdminStore.fetch, {
Name: domain.name, name: domain.name,
Disabled: domain.disabled() ? 1 : 0 disabled: domain.disabled() ? 1 : 0
}); });
} }
@ -59,7 +59,7 @@ export class AdminSettingsDomains /*extends AbstractViewSettings*/ {
el && ko.dataFor(el) && Remote.request('AdminDomainLoad', el && ko.dataFor(el) && Remote.request('AdminDomainLoad',
(iError, oData) => iError || showScreenPopup(DomainPopupView, [oData.Result]), (iError, oData) => iError || showScreenPopup(DomainPopupView, [oData.Result]),
{ {
Name: ko.dataFor(el).name name: ko.dataFor(el).name
} }
); );

View file

@ -46,7 +46,7 @@ export class AdminSettingsPackages extends AbstractViewSettings {
data && Remote.request('AdminPluginLoad', data && Remote.request('AdminPluginLoad',
(iError, data) => iError || showScreenPopup(PluginPopupView, [data.Result]), (iError, data) => iError || showScreenPopup(PluginPopupView, [data.Result]),
{ {
Id: data.id id: data.id
} }
); );
// disablePlugin // disablePlugin
@ -84,7 +84,7 @@ export class AdminSettingsPackages extends AbstractViewSettings {
Remote.request('AdminPackageDelete', Remote.request('AdminPackageDelete',
this.requestHelper(packageToDelete, false), this.requestHelper(packageToDelete, false),
{ {
Id: packageToDelete.id id: packageToDelete.id
} }
); );
} }
@ -96,9 +96,9 @@ export class AdminSettingsPackages extends AbstractViewSettings {
Remote.request('AdminPackageInstall', Remote.request('AdminPackageInstall',
this.requestHelper(packageToInstall, true), this.requestHelper(packageToInstall, true),
{ {
Id: packageToInstall.id, id: packageToInstall.id,
Type: packageToInstall.type, type: packageToInstall.type,
File: packageToInstall.file file: packageToInstall.file
}, },
60000 60000
); );
@ -120,8 +120,8 @@ export class AdminSettingsPackages extends AbstractViewSettings {
} }
// PackageAdminStore.fetch(); // PackageAdminStore.fetch();
}, { }, {
Id: plugin.id, id: plugin.id,
Disabled: disable ? 1 : 0 disabled: disable ? 1 : 0
} }
); );
} }

View file

@ -102,10 +102,10 @@ export class AdminSettingsSecurity extends AbstractViewSettings {
this.weakPassword(!!data.Result.Weak); this.weakPassword(!!data.Result.Weak);
} }
}, { }, {
'Login': this.adminLogin(), Login: this.adminLogin(),
'Password': this.adminPassword(), Password: this.adminPassword(),
'NewPassword': this.adminPasswordNew(), newPassword: this.adminPasswordNew(),
'TOTP': this.adminTOTP() TOTP: this.adminTOTP()
}); });
return true; return true;

View file

@ -67,7 +67,7 @@ export class UserSettingsAccounts /*extends AbstractViewSettings*/ {
rl.app.accountsAndIdentities(); rl.app.accountsAndIdentities();
} }
}, { }, {
EmailToDelete: accountToRemove.email emailToDelete: accountToRemove.email
}); });
} }
} }
@ -81,7 +81,7 @@ export class UserSettingsAccounts /*extends AbstractViewSettings*/ {
this.identityForDeletion(null); this.identityForDeletion(null);
IdentityUserStore.remove(oIdentity => identityToRemove === oIdentity); IdentityUserStore.remove(oIdentity => identityToRemove === oIdentity);
Remote.request('IdentityDelete', () => rl.app.accountsAndIdentities(), { Remote.request('IdentityDelete', () => rl.app.accountsAndIdentities(), {
IdToDelete: identityToRemove.id() idToDelete: identityToRemove.id()
}); });
} }
} }

View file

@ -160,8 +160,8 @@ export class UserSettingsFolders /*extends AbstractViewSettings*/ {
// TODO: append '.default' ? // TODO: append '.default' ?
Remote.request('FolderSetMetadata', null, { Remote.request('FolderSetMetadata', null, {
folder: folder.fullName, folder: folder.fullName,
Key: FolderMetadataKeys.KolabFolderType, key: FolderMetadataKeys.KolabFolderType,
Value: type value: type
}); });
folder.kolabType(type); folder.kolabType(type);
} }

View file

@ -20,6 +20,6 @@ DomainAdminStore.fetch = () => {
); );
} }
}, { }, {
IncludeAliases: 1 includeAliases: 1
}); });
}; };

View file

@ -79,7 +79,7 @@ export const GnuPGUserStore = new class {
}, { }, {
keyId: key.id, keyId: key.id,
isPrivate: isPrivate, isPrivate: isPrivate,
Passphrase: pass passphrase: pass
} }
); );
if (isPrivate) { if (isPrivate) {
@ -115,7 +115,7 @@ export const GnuPGUserStore = new class {
} }
callback?.(iError, oData); callback?.(iError, oData);
}, { }, {
Key: key key: key
} }
); );
} }
@ -181,10 +181,10 @@ export const GnuPGUserStore = new class {
uid: message.uid, uid: message.uid,
partId: pgpInfo.PartId, partId: pgpInfo.PartId,
keyId: key.id, keyId: key.id,
Passphrase: await askPassphrase(key, 'BUTTON_DECRYPT'), passphrase: await askPassphrase(key, 'BUTTON_DECRYPT'),
Data: '' // message.plain() optional data: '' // message.plain() optional
} }
if (null !== params.Passphrase) { if (null !== params.passphrase) {
const result = await Remote.post('GnupgDecrypt', null, params); const result = await Remote.post('GnupgDecrypt', null, params);
if (result?.Result && false !== result.Result.data) { if (result?.Result && false !== result.Result.data) {
return result.Result; return result.Result;
@ -202,9 +202,9 @@ export const GnuPGUserStore = new class {
// let mode = await this.hasPublicKeyForEmails([sender]); // let mode = await this.hasPublicKeyForEmails([sender]);
data.folder = message.folder; data.folder = message.folder;
data.uid = message.uid; data.uid = message.uid;
if (data.BodyPart) { if (data.bodyPart) {
data.BodyPart = data.BodyPart.raw; data.bodyPart = data.bodyPart.raw;
data.SigPart = data.SigPart.body; data.sigPart = data.sigPart.body;
} }
let response = await Remote.post('MessagePgpVerify', null, data); let response = await Remote.post('MessagePgpVerify', null, data);
if (response?.Result) { if (response?.Result) {

View file

@ -331,8 +331,8 @@ MessagelistUserStore.setAction = (sFolderFullName, iSetAction, messages) => {
} }
Remote.request('MessageSetSeen', null, { Remote.request('MessageSetSeen', null, {
folder: sFolderFullName, folder: sFolderFullName,
Uids: rootUids.join(','), uids: rootUids.join(','),
SetAction: iSetAction == MessageSetAction.SetSeen ? 1 : 0 setAction: iSetAction == MessageSetAction.SetSeen ? 1 : 0
}); });
break; break;
@ -340,8 +340,8 @@ MessagelistUserStore.setAction = (sFolderFullName, iSetAction, messages) => {
case MessageSetAction.UnsetFlag: case MessageSetAction.UnsetFlag:
Remote.request('MessageSetFlagged', null, { Remote.request('MessageSetFlagged', null, {
folder: sFolderFullName, folder: sFolderFullName,
Uids: rootUids.join(','), uids: rootUids.join(','),
SetAction: iSetAction == MessageSetAction.SetFlag ? 1 : 0 setAction: iSetAction == MessageSetAction.SetFlag ? 1 : 0
}); });
break; break;
// no default // no default

View file

@ -219,12 +219,13 @@ export const OpenPGPUserStore = new class {
if (data && publicKey) { if (data && publicKey) {
data.folder = message.folder; data.folder = message.folder;
data.uid = message.uid; data.uid = message.uid;
data.GnuPG = 0; data.tryGnuPG = 0;
let response; let response;
if (data.sigPartId) { if (data.sigPartId) {
response = await Remote.post('MessagePgpVerify', null, data); response = await Remote.post('MessagePgpVerify', null, data);
} else if (data.BodyPart) { } else if (data.bodyPart) {
response = { Result: { text: data.BodyPart.raw, signature: data.SigPart.body } }; // MimePart
response = { Result: { text: data.bodyPart.raw, signature: data.sigPart.body } };
} else { } else {
response = { Result: { text: message.plain(), signature: null } }; response = { Result: { text: message.plain(), signature: null } };
} }

View file

@ -29,7 +29,7 @@ export class AccountPopupView extends AbstractViewPopup {
submitForm(form) { submitForm(form) {
if (!this.submitRequest() && form.reportValidity()) { if (!this.submitRequest() && form.reportValidity()) {
const data = new FormData(form); const data = new FormData(form);
data.set('New', this.isNew() ? 1 : 0); data.set('new', this.isNew() ? 1 : 0);
this.submitRequest(true); this.submitRequest(true);
Remote.request('AccountSetup', (iError, data) => { Remote.request('AccountSetup', (iError, data) => {
this.submitRequest(false); this.submitRequest(false);

View file

@ -1482,7 +1482,7 @@ export class ComposePopupView extends AbstractViewPopup {
signature.body = await OpenPGPUserStore.sign(data.toString(), sign[1], 1); signature.body = await OpenPGPUserStore.sign(data.toString(), sign[1], 1);
signed.children.push(signature); signed.children.push(signature);
params.signed = signed.toString(); params.signed = signed.toString();
params.Boundary = signed.boundary; params.boundary = signed.boundary;
data = signed; data = signed;
} else if ('gnupg' == sign[0]) { } else if ('gnupg' == sign[0]) {
// TODO: sign in PHP fails // TODO: sign in PHP fails

View file

@ -104,10 +104,10 @@ export class ContactsPopupView extends AbstractViewPopup {
const contacts = this.contactsCheckedOrSelected(); const contacts = this.contactsCheckedOrSelected();
if (contacts.length) { if (contacts.length) {
let selectorContact = this.selectorContact(), let selectorContact = this.selectorContact(),
Uids = [], uids = [],
count = 0; count = 0;
contacts.forEach(contact => { contacts.forEach(contact => {
Uids.push(contact.id()); uids.push(contact.id());
if (selectorContact && selectorContact.id() === contact.id()) { if (selectorContact && selectorContact.id() === contact.id()) {
this.selectorContact(selectorContact = null); this.selectorContact(selectorContact = null);
} }
@ -127,7 +127,7 @@ export class ContactsPopupView extends AbstractViewPopup {
} }
this.reloadContactList(); this.reloadContactList();
}, { }, {
Uids: Uids.join(',') uids: uids.join(',')
} }
); );
} }

View file

@ -14,13 +14,64 @@ import { AskPopupView } from 'View/Popup/Ask';
const const
capitalize = string => string.charAt(0).toUpperCase() + string.slice(1), capitalize = string => string.charAt(0).toUpperCase() + string.slice(1),
domainDefaults = {
enableSmartPorts: false,
savingError: '',
name: '',
imapHost: '',
imapPort: 143,
imapType: 0,
imapTimeout: 300,
imapShortLogin: false,
// SSL
imapSslVerify_peer: false,
imapSslAllow_self_signed: false,
// Options
imapDisable_list_status: false,
imapDisable_metadata: false,
imapDisable_move: false,
imapDisable_sort: false,
imapDisable_thread: false,
imapExpunge_all_on_delete: false,
imapFast_simple_search: true,
imapFetch_new_messages: true,
imapForce_select: false,
imapFolder_list_limit: 200,
imapMessage_all_headers: false,
imapMessage_list_limit: 0,
imapSearch_filter: '',
sieveEnabled: false,
sieveHost: '',
sievePort: 4190,
sieveType: 0,
sieveTimeout: 10,
smtpHost: '',
smtpPort: 25,
smtpType: 0,
smtpTimeout: 60,
smtpShortLogin: false,
smtpUseAuth: true,
smtpSetSender: false,
smtpUsePhpMail: false,
// SSL
smtpSslVerify_peer: false,
smtpSslAllow_self_signed: false,
whiteList: '',
aliasName: ''
},
domainToParams = oDomain => ({ domainToParams = oDomain => ({
Name: oDomain.name(), name: oDomain.name,
IMAP: { IMAP: {
host: oDomain.imapHost(), host: oDomain.imapHost,
port: oDomain.imapPort(), port: oDomain.imapPort,
secure: pInt(oDomain.imapType()), secure: pInt(oDomain.imapType()),
timeout: oDomain.imapTimeout(), timeout: oDomain.imapTimeout,
shortLogin: !!oDomain.imapShortLogin(), shortLogin: !!oDomain.imapShortLogin(),
ssl: { ssl: {
verify_peer: !!oDomain.imapSslVerify_peer(), verify_peer: !!oDomain.imapSslVerify_peer(),
@ -44,10 +95,10 @@ const
*/ */
}, },
SMTP: { SMTP: {
host: oDomain.smtpHost(), host: oDomain.smtpHost,
port: oDomain.smtpPort(), port: oDomain.smtpPort,
secure: pInt(oDomain.smtpType()), secure: pInt(oDomain.smtpType()),
timeout: oDomain.smtpTimeout(), timeout: oDomain.smtpTimeout,
shortLogin: !!oDomain.smtpShortLogin(), shortLogin: !!oDomain.smtpShortLogin(),
ssl: { ssl: {
verify_peer: !!oDomain.smtpSslVerify_peer(), verify_peer: !!oDomain.smtpSslVerify_peer(),
@ -60,10 +111,10 @@ const
}, },
Sieve: { Sieve: {
enabled: !!oDomain.sieveEnabled(), enabled: !!oDomain.sieveEnabled(),
host: oDomain.sieveHost(), host: oDomain.sieveHost,
port: oDomain.sievePort(), port: oDomain.sievePort,
secure: pInt(oDomain.sieveType()), secure: pInt(oDomain.sieveType()),
timeout: oDomain.sieveTimeout(), timeout: oDomain.sieveTimeout,
shortLogin: !!oDomain.imapShortLogin(), shortLogin: !!oDomain.imapShortLogin(),
ssl: { ssl: {
verify_peer: !!oDomain.imapSslVerify_peer(), verify_peer: !!oDomain.imapSslVerify_peer(),
@ -71,14 +122,14 @@ const
allow_self_signed: !!oDomain.imapSslAllow_self_signed() allow_self_signed: !!oDomain.imapSslAllow_self_signed()
} }
}, },
whiteList: oDomain.whiteList() whiteList: oDomain.whiteList
}); });
export class DomainPopupView extends AbstractViewPopup { export class DomainPopupView extends AbstractViewPopup {
constructor() { constructor() {
super('Domain'); super('Domain');
addObservablesTo(this, this.getDefaults()); addObservablesTo(this, domainDefaults);
addObservablesTo(this, { addObservablesTo(this, {
edit: false, edit: false,
@ -99,21 +150,11 @@ export class DomainPopupView extends AbstractViewPopup {
headerText: () => { headerText: () => {
const name = this.name(), const name = this.name(),
aliasName = this.aliasName(); aliasName = this.aliasName();
return this.edit()
let result = ''; ? i18n('POPUPS_DOMAIN/TITLE_EDIT_DOMAIN', { NAME: name }) + (aliasName ? ' ⫘ ' + aliasName : '')
: (name
if (this.edit()) {
result = i18n('POPUPS_DOMAIN/TITLE_EDIT_DOMAIN', { NAME: name });
if (aliasName) {
result += ' ⫘ ' + aliasName;
}
} else {
result = name
? i18n('POPUPS_DOMAIN/TITLE_ADD_DOMAIN_WITH_NAME', { NAME: name }) ? i18n('POPUPS_DOMAIN/TITLE_ADD_DOMAIN_WITH_NAME', { NAME: name })
: i18n('POPUPS_DOMAIN/TITLE_ADD_DOMAIN'); : i18n('POPUPS_DOMAIN/TITLE_ADD_DOMAIN'));
}
return result;
}, },
domainDesc: () => { domainDesc: () => {
@ -213,7 +254,7 @@ export class DomainPopupView extends AbstractViewPopup {
} }
}, },
Object.assign(domainToParams(this), { Object.assign(domainToParams(this), {
Create: this.edit() ? 0 : 1 create: this.edit() ? 0 : 1
}) })
); );
} }
@ -260,7 +301,9 @@ export class DomainPopupView extends AbstractViewPopup {
onShow(oDomain) { onShow(oDomain) {
this.saving(false); this.saving(false);
this.clearTesting(); this.clearTesting();
this.clearForm(); this.edit(false);
forEachObjectEntry(domainDefaults, (key, value) => this[key](value));
this.enableSmartPorts(true);
if (oDomain) { if (oDomain) {
this.enableSmartPorts(false); this.enableSmartPorts(false);
this.edit(true); this.edit(true);
@ -284,64 +327,4 @@ export class DomainPopupView extends AbstractViewPopup {
this.enableSmartPorts(true); this.enableSmartPorts(true);
} }
} }
getDefaults() {
return {
enableSmartPorts: false,
savingError: '',
name: '',
imapHost: '',
imapPort: 143,
imapType: 0,
imapTimeout: 300,
imapShortLogin: false,
// SSL
imapSslVerify_peer: false,
imapSslAllow_self_signed: false,
// Options
imapDisable_list_status: false,
imapDisable_metadata: false,
imapDisable_move: false,
imapDisable_sort: false,
imapDisable_thread: false,
imapExpunge_all_on_delete: false,
imapFast_simple_search: true,
imapFetch_new_messages: true,
imapForce_select: false,
imapFolder_list_limit: 200,
imapMessage_all_headers: false,
imapMessage_list_limit: 0,
imapSearch_filter: '',
sieveEnabled: false,
sieveHost: '',
sievePort: 4190,
sieveType: 0,
sieveTimeout: 10,
smtpHost: '',
smtpPort: 25,
smtpType: 0,
smtpTimeout: 60,
smtpShortLogin: false,
smtpUseAuth: true,
smtpSetSender: false,
smtpUsePhpMail: false,
// SSL
smtpSslVerify_peer: false,
smtpSslAllow_self_signed: false,
whiteList: '',
aliasName: ''
};
}
clearForm() {
this.edit(false);
forEachObjectEntry(this.getDefaults(), (key, value) => this[key](value));
this.enableSmartPorts(true);
}
} }

View file

@ -46,21 +46,15 @@ export class DomainAliasPopupView extends AbstractViewPopup {
this.close(); this.close();
} }
}, { }, {
Name: this.name(), name: this.name,
Alias: this.alias() alias: this.alias
}); });
} }
onShow() { onShow() {
this.clearForm();
}
clearForm() {
this.saving(false); this.saving(false);
this.savingError(''); this.savingError('');
this.name(''); this.name('');
this.alias(''); this.alias('');
} }
} }

View file

@ -41,19 +41,19 @@ export class PluginPopupView extends AbstractViewPopup {
saveCommand() { saveCommand() {
const oConfig = { const oConfig = {
Id: this.id(), id: this.id,
Settings: {} settings: {}
}, },
setItem = item => { setItem = item => {
let value = item.value(); let value = item.value();
if (false === value || true === value) { if (false === value || true === value) {
value = value ? 1 : 0; value = value ? 1 : 0;
} }
oConfig.Settings[item.Name] = value; oConfig.settings[item.name] = value;
}; };
this.config.forEach(oItem => { this.config.forEach(oItem => {
if (7 == oItem.Type) { if (7 == oItem.type) {
// Group // Group
oItem.config.forEach(oSubItem => setItem(oSubItem)); oItem.config.forEach(oSubItem => setItem(oSubItem));
} else { } else {
@ -76,15 +76,15 @@ export class PluginPopupView extends AbstractViewPopup {
this.config([]); this.config([]);
if (oPlugin) { if (oPlugin) {
this.id(oPlugin.Id); this.id(oPlugin.id);
this.name(oPlugin.Name); this.name(oPlugin.name);
this.readme(oPlugin.Readme); this.readme(oPlugin.readme);
const config = oPlugin.Config; const config = oPlugin.config;
if (arrayLength(config)) { if (arrayLength(config)) {
this.config( this.config(
config.map(item => { config.map(item => {
if (7 == item.Type) { if (7 == item.type) {
// Group // Group
item.config.forEach(subItem => { item.config.forEach(subItem => {
subItem.value = ko.observable(subItem.value); subItem.value = ko.observable(subItem.value);

View file

@ -13,11 +13,11 @@ import { doc,
} from 'Common/Globals'; } from 'Common/Globals';
import { arrayLength } from 'Common/Utils'; import { arrayLength } from 'Common/Utils';
import { computedPaginatorHelper, showMessageComposer, populateMessageBody, download, moveAction } from 'Common/UtilsUser'; import { computedPaginatorHelper, showMessageComposer, populateMessageBody, downloadZip, moveAction } from 'Common/UtilsUser';
import { FileInfo } from 'Common/File'; import { FileInfo } from 'Common/File';
import { isFullscreen, toggleFullscreen } from 'Common/Fullscreen'; import { isFullscreen, toggleFullscreen } from 'Common/Fullscreen';
import { mailBox, attachmentDownload } from 'Common/Links'; import { mailBox } from 'Common/Links';
import { Selector } from 'Common/Selector'; import { Selector } from 'Common/Selector';
import { i18n } from 'Common/Translator'; import { i18n } from 'Common/Translator';
@ -367,23 +367,7 @@ export class MailMessageList extends AbstractViewRight {
let hashes = []/*, uids = []*/; let hashes = []/*, uids = []*/;
// MessagelistUserStore.forEach(message => message.checked() && uids.push(message.uid)); // MessagelistUserStore.forEach(message => message.checked() && uids.push(message.uid));
MessagelistUserStore.forEach(message => message.checked() && hashes.push(message.requestHash)); MessagelistUserStore.forEach(message => message.checked() && hashes.push(message.requestHash));
if (hashes.length) { downloadZip(hashes, null, null, MessagelistUserStore().folder);
Remote.post('AttachmentsActions', null, {
Do: 'Zip',
folder: MessagelistUserStore().folder,
// Uids: uids,
Hashes: hashes
})
.then(result => {
let hash = result?.Result?.fileHash;
if (hash) {
download(attachmentDownload(hash), hash+'.zip');
} else {
alert('Download failed');
}
})
.catch(() => alert('Download failed'));
}
} }
downloadAttachCommand() { downloadAttachCommand() {
@ -397,21 +381,7 @@ export class MailMessageList extends AbstractViewRight {
}); });
} }
}); });
if (hashes.length) { downloadZip(hashes);
Remote.post('AttachmentsActions', null, {
Do: 'Zip',
Hashes: hashes
})
.then(result => {
let hash = result?.Result?.fileHash;
if (hash) {
download(attachmentDownload(hash), hash+'.zip');
} else {
alert('Download failed');
}
})
.catch(() => alert('Download failed'));
}
} }
deleteWithoutMoveCommand() { deleteWithoutMoveCommand() {
@ -505,8 +475,8 @@ export class MailMessageList extends AbstractViewRight {
Remote.request('MessageSetSeenToAll', null, { Remote.request('MessageSetSeenToAll', null, {
folder: sFolderFullName, folder: sFolderFullName,
SetAction: 1, setAction: 1,
ThreadUids: uids.join(',') threadUids: uids.join(',')
}); });
MessagelistUserStore.reloadFlagsAndCachedMessage(); MessagelistUserStore.reloadFlagsAndCachedMessage();

View file

@ -23,13 +23,12 @@ import {
} from 'Common/Globals'; } from 'Common/Globals';
import { arrayLength } from 'Common/Utils'; import { arrayLength } from 'Common/Utils';
import { download, mailToHelper, showMessageComposer, moveAction } from 'Common/UtilsUser'; import { download, downloadZip, mailToHelper, showMessageComposer, moveAction } from 'Common/UtilsUser';
import { isFullscreen, exitFullscreen, toggleFullscreen } from 'Common/Fullscreen'; import { isFullscreen, exitFullscreen, toggleFullscreen } from 'Common/Fullscreen';
import { SMAudio } from 'Common/Audio'; import { SMAudio } from 'Common/Audio';
import { i18n } from 'Common/Translator'; import { i18n } from 'Common/Translator';
import { attachmentDownload } from 'Common/Links';
import { MessageFlagsCache } from 'Common/Cache'; import { MessageFlagsCache } from 'Common/Cache';
@ -486,21 +485,10 @@ export class MailMessageView extends AbstractViewRight {
const hashes = (currentMessage()?.attachments || []) const hashes = (currentMessage()?.attachments || [])
.map(item => item?.checked() /*&& !item?.isLinked()*/ ? item.download : '') .map(item => item?.checked() /*&& !item?.isLinked()*/ ? item.download : '')
.filter(v => v); .filter(v => v);
if (hashes.length) { downloadZip(hashes,
Remote.post('AttachmentsActions', this.downloadAsZipLoading, { () => this.downloadAsZipError(true),
Do: 'Zip', this.downloadAsZipLoading
Hashes: hashes );
})
.then(result => {
let hash = result?.Result?.fileHash;
if (hash) {
download(attachmentDownload(hash), hash+'.zip');
} else {
this.downloadAsZipError(true);
}
})
.catch(() => this.downloadAsZipError(true));
}
} }
/** /**

View file

@ -455,11 +455,18 @@ Converts HTML to text
Converts text to HTML Converts text to HTML
## rl.addSettingsViewModel(SettingsViewModelClass, template, labelName, route) ## rl.addSettingsViewModel(SettingsViewModelClass, template, labelName, route)
Examples in
* ./change-password/js/ChangePasswordUserSettings.js
* ./example/js/ExampleUserSettings.js
* ./kolab/js/settings.js
* ./two-factor-auth/js/TwoFactorAuthSettings.js
## rl.addSettingsViewModelForAdmin(SettingsViewModelClass, template, labelName, route) ## rl.addSettingsViewModelForAdmin(SettingsViewModelClass, template, labelName, route)
Examples in
* ./example/js/ExampleAdminSettings.js:34: rl.addSettingsViewModelForAdmin(ExampleAdminSettings, 'ExampleAdminSettingsTab',
## rl.adminArea() ## rl.adminArea()
Returns true or false Returns true or false when in '?admin' area
## rl.app.Remote.abort(action) ## rl.app.Remote.abort(action)

View file

@ -63,8 +63,8 @@
if (folder) { if (folder) {
rl.fetchJSON('./?/Json/&q[]=/0/', {}, { rl.fetchJSON('./?/Json/&q[]=/0/', {}, {
Action: 'AttachmentsActions', Action: 'AttachmentsActions',
Do: 'nextcloud', target: 'nextcloud',
Hashes: hashes, hashes: hashes,
NcFolder: folder NcFolder: folder
}) })
.then(result => { .then(result => {

View file

@ -28,9 +28,8 @@
} }
}); });
let template = document.getElementById('MailMessageList'); const msgMenu = document.getElementById('MailMessageList')
.content.querySelector('#more-list-dropdown-id + menu [data-bind*="forwardCommand"]');
const msgMenu = template.content.querySelector('#more-list-dropdown-id + menu [data-bind*="forwardCommand"]');
if (msgMenu) { if (msgMenu) {
msgMenu.after(Element.fromHTML(`<li role="presentation" data-bind="css:{disabled:!messageList.hasChecked()}"> msgMenu.after(Element.fromHTML(`<li role="presentation" data-bind="css:{disabled:!messageList.hasChecked()}">
<a href="#" tabindex="-1" data-icon="📥" data-bind="click: nextcloudSaveMsgs" data-i18n="NEXTCLOUD/SAVE_EML"></a> <a href="#" tabindex="-1" data-icon="📥" data-bind="click: nextcloudSaveMsgs" data-i18n="NEXTCLOUD/SAVE_EML"></a>

View file

@ -926,7 +926,7 @@ class Actions
public function DoVersion(): array public function DoVersion(): array
{ {
return $this->DefaultResponse(APP_VERSION === (string)$this->GetActionParam('Version', '')); return $this->DefaultResponse(APP_VERSION === (string)$this->GetActionParam('version', ''));
} }
public function MainClearFileName(string $sFileName, string $sContentType, string $sMimeIndex, int $iMaxLength = 250): string public function MainClearFileName(string $sFileName, string $sContentType, string $sMimeIndex, int $iMaxLength = 250): string
@ -988,15 +988,12 @@ class Actions
return $sError; return $sError;
} }
public function Upload(): array public function Upload(?array $aFile, int $iError): array
{ {
$oAccount = $this->getAccountFromToken(); $oAccount = $this->getAccountFromToken();
$aResponse = array(); $aResponse = array();
$aFile = $this->GetActionParam('File', null);
$iError = $this->GetActionParam('Error', Enumerations\UploadError::UNKNOWN);
if ($oAccount && UPLOAD_ERR_OK === $iError && \is_array($aFile)) { if ($oAccount && UPLOAD_ERR_OK === $iError && \is_array($aFile)) {
$sSavedName = 'upload-post-' . \md5($aFile['name'] . $aFile['tmp_name']); $sSavedName = 'upload-post-' . \md5($aFile['name'] . $aFile['tmp_name']);

View file

@ -80,10 +80,10 @@ trait Accounts
$aAccounts = $this->GetAccounts($oMainAccount); $aAccounts = $this->GetAccounts($oMainAccount);
$sEmail = \trim($this->GetActionParam('Email', '')); $sEmail = \trim($this->GetActionParam('email', ''));
$sPassword = $this->GetActionParam('Password', ''); $sPassword = $this->GetActionParam('password', '');
$sName = $this->GetActionParam('Name', ''); $sName = \trim($this->GetActionParam('name', ''));
$bNew = '1' === (string)$this->GetActionParam('New', '1'); $bNew = !empty($this->GetActionParam('new', 1));
$sEmail = \MailSo\Base\Utils::IdnToAscii($sEmail, true); $sEmail = \MailSo\Base\Utils::IdnToAscii($sEmail, true);
if ($bNew && ($oMainAccount->Email() === $sEmail || isset($aAccounts[$sEmail]))) { if ($bNew && ($oMainAccount->Email() === $sEmail || isset($aAccounts[$sEmail]))) {
@ -172,7 +172,7 @@ trait Accounts
return $this->FalseResponse(); return $this->FalseResponse();
} }
$sEmailToDelete = \trim($this->GetActionParam('EmailToDelete', '')); $sEmailToDelete = \trim($this->GetActionParam('emailToDelete', ''));
$sEmailToDelete = \MailSo\Base\Utils::IdnToAscii($sEmailToDelete, true); $sEmailToDelete = \MailSo\Base\Utils::IdnToAscii($sEmailToDelete, true);
$aAccounts = $this->GetAccounts($oMainAccount); $aAccounts = $this->GetAccounts($oMainAccount);
@ -255,7 +255,7 @@ trait Accounts
return $this->FalseResponse(); return $this->FalseResponse();
} }
$sId = \trim($this->GetActionParam('IdToDelete', '')); $sId = \trim($this->GetActionParam('idToDelete', ''));
if (empty($sId)) { if (empty($sId)) {
throw new ClientException(Notifications::UnknownError); throw new ClientException(Notifications::UnknownError);
} }

View file

@ -11,13 +11,13 @@ trait AdminDomains
{ {
$this->IsAdminLoggined(); $this->IsAdminLoggined();
return $this->DefaultResponse($this->DomainProvider()->Load($this->GetActionParam('Name', ''), false, false)); return $this->DefaultResponse($this->DomainProvider()->Load($this->GetActionParam('name', ''), false, false));
} }
public function DoAdminDomainList() : array public function DoAdminDomainList() : array
{ {
$this->IsAdminLoggined(); $this->IsAdminLoggined();
$bIncludeAliases = !empty($this->GetActionParam('IncludeAliases', '1')); $bIncludeAliases = !empty($this->GetActionParam('includeAliases', '1'));
return $this->DefaultResponse($this->DomainProvider()->GetList($bIncludeAliases)); return $this->DefaultResponse($this->DomainProvider()->GetList($bIncludeAliases));
} }
@ -25,7 +25,7 @@ trait AdminDomains
{ {
$this->IsAdminLoggined(); $this->IsAdminLoggined();
return $this->DefaultResponse($this->DomainProvider()->Delete((string) $this->GetActionParam('Name', ''))); return $this->DefaultResponse($this->DomainProvider()->Delete((string) $this->GetActionParam('name', '')));
} }
public function DoAdminDomainDisable() : array public function DoAdminDomainDisable() : array
@ -33,8 +33,8 @@ trait AdminDomains
$this->IsAdminLoggined(); $this->IsAdminLoggined();
return $this->DefaultResponse($this->DomainProvider()->Disable( return $this->DefaultResponse($this->DomainProvider()->Disable(
(string) $this->GetActionParam('Name', ''), (string) $this->GetActionParam('name', ''),
'1' === (string) $this->GetActionParam('Disabled', '0') !empty($this->GetActionParam('disabled', '0'))
)); ));
} }
@ -52,8 +52,8 @@ trait AdminDomains
$this->IsAdminLoggined(); $this->IsAdminLoggined();
return $this->DefaultResponse($this->DomainProvider()->SaveAlias( return $this->DefaultResponse($this->DomainProvider()->SaveAlias(
(string) $this->GetActionParam('Name', ''), (string) $this->GetActionParam('name', ''),
(string) $this->GetActionParam('Alias', '') (string) $this->GetActionParam('alias', '')
)); ));
} }

View file

@ -16,7 +16,7 @@ trait AdminExtensions
public function DoAdminPackageDelete() : array public function DoAdminPackageDelete() : array
{ {
$sId = $this->GetActionParam('Id', ''); $sId = $this->GetActionParam('id', '');
$bResult = \SnappyMail\Repository::deletePackage($sId); $bResult = \SnappyMail\Repository::deletePackage($sId);
static::pluginEnable($sId, false); static::pluginEnable($sId, false);
return $this->DefaultResponse($bResult); return $this->DefaultResponse($bResult);
@ -24,11 +24,11 @@ trait AdminExtensions
public function DoAdminPackageInstall() : array public function DoAdminPackageInstall() : array
{ {
$sType = $this->GetActionParam('Type', ''); $sType = $this->GetActionParam('type', '');
$bResult = \SnappyMail\Repository::installPackage( $bResult = \SnappyMail\Repository::installPackage(
$sType, $sType,
$this->GetActionParam('Id', ''), $this->GetActionParam('id', ''),
$this->GetActionParam('File', '') $this->GetActionParam('file', '')
); );
return $this->DefaultResponse($bResult ? return $this->DefaultResponse($bResult ?
('plugin' !== $sType ? array('Reload' => true) : true) : false); ('plugin' !== $sType ? array('Reload' => true) : true) : false);
@ -38,8 +38,8 @@ trait AdminExtensions
{ {
$this->IsAdminLoggined(); $this->IsAdminLoggined();
$sId = (string) $this->GetActionParam('Id', ''); $sId = (string) $this->GetActionParam('id', '');
$bDisable = '1' === (string) $this->GetActionParam('Disabled', '1'); $bDisable = '1' === (string) $this->GetActionParam('disabled', '1');
if (!$bDisable) { if (!$bDisable) {
$oPlugin = $this->Plugins()->CreatePluginByName($sId); $oPlugin = $this->Plugins()->CreatePluginByName($sId);
@ -61,17 +61,17 @@ trait AdminExtensions
$this->IsAdminLoggined(); $this->IsAdminLoggined();
$mResult = false; $mResult = false;
$sId = (string) $this->GetActionParam('Id', ''); $sId = (string) $this->GetActionParam('id', '');
if (!empty($sId)) { if (!empty($sId)) {
$oPlugin = $this->Plugins()->CreatePluginByName($sId); $oPlugin = $this->Plugins()->CreatePluginByName($sId);
if ($oPlugin) { if ($oPlugin) {
$mResult = array( $mResult = array(
'@Object' => 'Object/Plugin', '@Object' => 'Object/Plugin',
'Id' => $sId, 'id' => $sId,
'Name' => $oPlugin->Name(), 'name' => $oPlugin->Name(),
'Readme' => $oPlugin->Description(), 'readme' => $oPlugin->Description(),
'Config' => array() 'config' => array()
); );
$aMap = $oPlugin->ConfigMap(); $aMap = $oPlugin->ConfigMap();
@ -85,7 +85,7 @@ trait AdminExtensions
} else { } else {
$oItem->SetValue($oConfig->Get('plugin', $oItem->Name(), '')); $oItem->SetValue($oConfig->Get('plugin', $oItem->Name(), ''));
} }
$mResult['Config'][] = $oItem; $mResult['config'][] = $oItem;
} else if ($oItem instanceof \RainLoop\Plugins\PropertyCollection) { } else if ($oItem instanceof \RainLoop\Plugins\PropertyCollection) {
foreach ($oItem as $oSubItem) { foreach ($oItem as $oSubItem) {
if ($oSubItem && $oSubItem instanceof \RainLoop\Plugins\Property) { if ($oSubItem && $oSubItem instanceof \RainLoop\Plugins\Property) {
@ -96,7 +96,7 @@ trait AdminExtensions
} }
} }
} }
$mResult['Config'][] = $oItem; $mResult['config'][] = $oItem;
} }
} }
} }
@ -111,7 +111,7 @@ trait AdminExtensions
{ {
$this->IsAdminLoggined(); $this->IsAdminLoggined();
$sId = (string) $this->GetActionParam('Id', ''); $sId = (string) $this->GetActionParam('id', '');
if (!empty($sId)) { if (!empty($sId)) {
$oPlugin = $this->Plugins()->CreatePluginByName($sId); $oPlugin = $this->Plugins()->CreatePluginByName($sId);
@ -119,7 +119,7 @@ trait AdminExtensions
$oConfig = $oPlugin->Config(); $oConfig = $oPlugin->Config();
$aMap = $oPlugin->ConfigMap(true); $aMap = $oPlugin->ConfigMap(true);
if (\is_array($aMap)) { if (\is_array($aMap)) {
$aSettings = (array) $this->GetActionParam('Settings', []); $aSettings = (array) $this->GetActionParam('settings', []);
foreach ($aMap as $oItem) { foreach ($aMap as $oItem) {
$sKey = $oItem->Name(); $sKey = $oItem->Name();
$sValue = $aSettings[$sKey] ?? $oConfig->Get('plugin', $sKey); $sValue = $aSettings[$sKey] ?? $oConfig->Get('plugin', $sKey);

View file

@ -12,9 +12,9 @@ trait Attachments
*/ */
public function DoAttachmentsActions() : array public function DoAttachmentsActions() : array
{ {
$sAction = $this->GetActionParam('Do', ''); $sAction = $this->GetActionParam('target', '');
$sFolder = $this->GetActionParam('folder', ''); $sFolder = $this->GetActionParam('folder', '');
$aHashes = $this->GetActionParam('Hashes', null); $aHashes = $this->GetActionParam('hashes', null);
$oFilesProvider = $this->FilesProvider(); $oFilesProvider = $this->FilesProvider();
if (empty($sAction) || !$this->GetCapa(Capa::ATTACHMENTS_ACTIONS) || !$oFilesProvider || !$oFilesProvider->IsActive()) { if (empty($sAction) || !$this->GetCapa(Capa::ATTACHMENTS_ACTIONS) || !$oFilesProvider || !$oFilesProvider->IsActive()) {
return $this->FalseResponse(); return $this->FalseResponse();

View file

@ -77,7 +77,7 @@ trait Contacts
public function DoContactsDelete() : array public function DoContactsDelete() : array
{ {
$oAccount = $this->getAccountFromToken(); $oAccount = $this->getAccountFromToken();
$aUids = \explode(',', (string) $this->GetActionParam('Uids', '')); $aUids = \explode(',', (string) $this->GetActionParam('uids', ''));
$aFilteredUids = \array_filter(\array_map('intval', $aUids)); $aFilteredUids = \array_filter(\array_map('intval', $aUids));
@ -119,15 +119,12 @@ trait Contacts
)); ));
} }
public function UploadContacts() : array public function UploadContacts(?array $aFile, int $iError) : array
{ {
$oAccount = $this->getAccountFromToken(); $oAccount = $this->getAccountFromToken();
$mResponse = false; $mResponse = false;
$aFile = $this->GetActionParam('File', null);
$iError = $this->GetActionParam('Error', \RainLoop\Enumerations\UploadError::UNKNOWN);
if ($oAccount && UPLOAD_ERR_OK === $iError && \is_array($aFile)) { if ($oAccount && UPLOAD_ERR_OK === $iError && \is_array($aFile)) {
$sSavedName = 'upload-post-'.\md5($aFile['name'].$aFile['tmp_name']); $sSavedName = 'upload-post-'.\md5($aFile['name'].$aFile['tmp_name']);
if (!$this->FilesProvider()->MoveUploadedFile($oAccount, $sSavedName, $aFile['tmp_name'])) { if (!$this->FilesProvider()->MoveUploadedFile($oAccount, $sSavedName, $aFile['tmp_name'])) {

View file

@ -22,13 +22,13 @@ trait Folders
if ($oAccount if ($oAccount
&& !empty($sFolderFullName) && !empty($sFolderFullName)
&& !empty($_FILES['AppendFile']) && !empty($_FILES['appendFile'])
&& \is_uploaded_file($_FILES['AppendFile']['tmp_name']) && \is_uploaded_file($_FILES['appendFile']['tmp_name'])
&& \UPLOAD_ERR_OK == $_FILES['AppendFile']['error'] && \UPLOAD_ERR_OK == $_FILES['appendFile']['error']
&& $this->oConfig->Get('labs', 'allow_message_append', false) && $this->oConfig->Get('labs', 'allow_message_append', false)
) { ) {
$sSavedName = 'append-post-' . \md5($sFolderFullName . $_FILES['AppendFile']['name'] . $_FILES['AppendFile']['tmp_name']); $sSavedName = 'append-post-' . \md5($sFolderFullName . $_FILES['appendFile']['name'] . $_FILES['appendFile']['tmp_name']);
if ($this->FilesProvider()->MoveUploadedFile($oAccount, $sSavedName, $_FILES['AppendFile']['tmp_name'])) { if ($this->FilesProvider()->MoveUploadedFile($oAccount, $sSavedName, $_FILES['appendFile']['tmp_name'])) {
$iMessageStreamSize = $this->FilesProvider()->FileSize($oAccount, $sSavedName); $iMessageStreamSize = $this->FilesProvider()->FileSize($oAccount, $sSavedName);
$rMessageStream = $this->FilesProvider()->GetFile($oAccount, $sSavedName); $rMessageStream = $this->FilesProvider()->GetFile($oAccount, $sSavedName);
@ -107,10 +107,10 @@ trait Folders
{ {
$this->initMailClientConnection(); $this->initMailClientConnection();
$sFolderFullName = $this->GetActionParam('folder'); $sFolderFullName = $this->GetActionParam('folder');
$sMetadataKey = $this->GetActionParam('Key'); $sMetadataKey = $this->GetActionParam('key');
if ($sFolderFullName && $sMetadataKey) { if ($sFolderFullName && $sMetadataKey) {
$this->MailClient()->FolderSetMetadata($sFolderFullName, [ $this->MailClient()->FolderSetMetadata($sFolderFullName, [
$sMetadataKey => $this->GetActionParam('Value') ?: null $sMetadataKey => $this->GetActionParam('value') ?: null
]); ]);
} }
return $this->TrueResponse(); return $this->TrueResponse();
@ -292,7 +292,7 @@ trait Folders
{ {
$aResult = array(); $aResult = array();
$aFolders = $this->GetActionParam('Folders', null); $aFolders = $this->GetActionParam('folders', null);
if (\is_array($aFolders)) { if (\is_array($aFolders)) {
$this->initMailClientConnection(); $this->initMailClientConnection();

View file

@ -369,7 +369,7 @@ trait Messages
{ {
$this->initMailClientConnection(); $this->initMailClientConnection();
$sThreadUids = \trim($this->GetActionParam('ThreadUids', '')); $sThreadUids = \trim($this->GetActionParam('threadUids', ''));
try try
{ {
@ -377,7 +377,7 @@ trait Messages
$this->GetActionParam('folder', ''), $this->GetActionParam('folder', ''),
empty($sThreadUids) ? new SequenceSet('1:*', false) : new SequenceSet(\explode(',', $sThreadUids)), empty($sThreadUids) ? new SequenceSet('1:*', false) : new SequenceSet(\explode(',', $sThreadUids)),
MessageFlag::SEEN, MessageFlag::SEEN,
!empty($this->GetActionParam('SetAction', '0')) !empty($this->GetActionParam('setAction', '0'))
); );
} }
catch (\Throwable $oException) catch (\Throwable $oException)
@ -395,7 +395,7 @@ trait Messages
public function DoMessageSetKeyword() : array public function DoMessageSetKeyword() : array
{ {
return $this->messageSetFlag($this->GetActionParam('Keyword', ''), true); return $this->messageSetFlag($this->GetActionParam('keyword', ''), true);
} }
/** /**
@ -447,7 +447,7 @@ trait Messages
$this->initMailClientConnection(); $this->initMailClientConnection();
$sFolder = $this->GetActionParam('folder', ''); $sFolder = $this->GetActionParam('folder', '');
$aUids = \explode(',', (string) $this->GetActionParam('Uids', '')); $aUids = \explode(',', (string) $this->GetActionParam('uids', ''));
try try
{ {
@ -478,12 +478,12 @@ trait Messages
{ {
$this->initMailClientConnection(); $this->initMailClientConnection();
$sFromFolder = $this->GetActionParam('FromFolder', ''); $sFromFolder = $this->GetActionParam('fromFolder', '');
$sToFolder = $this->GetActionParam('ToFolder', ''); $sToFolder = $this->GetActionParam('toFolder', '');
$oUids = new SequenceSet(\explode(',', (string) $this->GetActionParam('Uids', ''))); $oUids = new SequenceSet(\explode(',', (string) $this->GetActionParam('uids', '')));
if (!empty($this->GetActionParam('MarkAsRead', '0'))) { if (!empty($this->GetActionParam('markAsRead', '0'))) {
try try
{ {
$this->MailClient()->MessageSetFlag($sFromFolder, $oUids, MessageFlag::SEEN); $this->MailClient()->MessageSetFlag($sFromFolder, $oUids, MessageFlag::SEEN);
@ -494,7 +494,7 @@ trait Messages
} }
} }
$sLearning = $this->GetActionParam('Learning', ''); $sLearning = $this->GetActionParam('learning', '');
if ($sLearning) { if ($sLearning) {
try try
{ {
@ -544,9 +544,9 @@ trait Messages
try try
{ {
$this->MailClient()->MessageCopy( $this->MailClient()->MessageCopy(
$this->GetActionParam('FromFolder', ''), $this->GetActionParam('fromFolder', ''),
$this->GetActionParam('ToFolder', ''), $this->GetActionParam('toFolder', ''),
new SequenceSet(\explode(',', (string) $this->GetActionParam('Uids', ''))) new SequenceSet(\explode(',', (string) $this->GetActionParam('uids', '')))
); );
} }
catch (\Throwable $oException) catch (\Throwable $oException)
@ -688,8 +688,8 @@ trait Messages
} }
} }
// Try by default as OpenPGP.js sets GnuPG to 0 // Try by default as OpenPGP.js sets useGnuPG to 0
if ($this->GetActionParam('GnuPG', 1)) { if ($this->GetActionParam('tryGnuPG', 1)) {
$GPG = $this->GnuPG(); $GPG = $this->GnuPG();
if ($GPG) { if ($GPG) {
$info = $this->GnuPG()->verify($result['text'], $result['signature']); $info = $this->GnuPG()->verify($result['text'], $result['signature']);
@ -873,9 +873,9 @@ trait Messages
{ {
$this->MailClient()->MessageSetFlag( $this->MailClient()->MessageSetFlag(
$this->GetActionParam('folder', ''), $this->GetActionParam('folder', ''),
new SequenceSet(\explode(',', (string) $this->GetActionParam('Uids', ''))), new SequenceSet(\explode(',', (string) $this->GetActionParam('uids', ''))),
$sMessageFlag, $sMessageFlag,
!empty($this->GetActionParam('SetAction', '0')), !empty($this->GetActionParam('setAction', '0')),
$bSkipUnsupportedFlag $bSkipUnsupportedFlag
); );
} }
@ -1041,7 +1041,7 @@ trait Messages
if ($sSigned = $this->GetActionParam('signed', '')) { if ($sSigned = $this->GetActionParam('signed', '')) {
$aSigned = \explode("\r\n\r\n", $sSigned, 2); $aSigned = \explode("\r\n\r\n", $sSigned, 2);
// $sBoundary = \preg_replace('/^.+boundary="([^"]+)".+$/Dsi', '$1', $aSigned[0]); // $sBoundary = \preg_replace('/^.+boundary="([^"]+)".+$/Dsi', '$1', $aSigned[0]);
$sBoundary = $this->GetActionParam('Boundary', ''); $sBoundary = $this->GetActionParam('boundary', '');
$oPart = new MimePart; $oPart = new MimePart;
$oPart->Headers->AddByName( $oPart->Headers->AddByName(
@ -1080,8 +1080,7 @@ trait Messages
unset($oAlternativePart); unset($oAlternativePart);
unset($sEncrypted); unset($sEncrypted);
} else { } else if ($sHtml = $this->GetActionParam('html', '')) {
if ($sHtml = $this->GetActionParam('html', '')) {
$oPart = new MimePart; $oPart = new MimePart;
$oPart->Headers->AddByName(MimeEnumHeader::CONTENT_TYPE, 'multipart/alternative'); $oPart->Headers->AddByName(MimeEnumHeader::CONTENT_TYPE, 'multipart/alternative');
$oMessage->SubParts->append($oPart); $oMessage->SubParts->append($oPart);
@ -1117,7 +1116,8 @@ trait Messages
} else { } else {
$sPlain = $this->GetActionParam('plain', ''); $sPlain = $this->GetActionParam('plain', '');
if ($sSignature = $this->GetActionParam('Signature', null)) { /*
if ($sSignature = $this->GetActionParam('pgpSignature', null)) {
$oPart = new MimePart; $oPart = new MimePart;
$oPart->Headers->AddByName( $oPart->Headers->AddByName(
MimeEnumHeader::CONTENT_TYPE, MimeEnumHeader::CONTENT_TYPE,
@ -1136,7 +1136,10 @@ trait Messages
$oAlternativePart->Headers->AddByName(MimeEnumHeader::CONTENT_TRANSFER_ENCODING, '7Bit'); $oAlternativePart->Headers->AddByName(MimeEnumHeader::CONTENT_TRANSFER_ENCODING, '7Bit');
$oAlternativePart->Body = \MailSo\Base\ResourceRegistry::CreateMemoryResourceFromString(\preg_replace('/\\r?\\n/su', "\r\n", \trim($sSignature))); $oAlternativePart->Body = \MailSo\Base\ResourceRegistry::CreateMemoryResourceFromString(\preg_replace('/\\r?\\n/su', "\r\n", \trim($sSignature)));
$oPart->SubParts->append($oAlternativePart); $oPart->SubParts->append($oAlternativePart);
unset($sSignature);
} else { } else {
*/
$this->Plugins()->RunHook('filter.message-plain', array($oAccount, $oMessage, &$sPlain)); $this->Plugins()->RunHook('filter.message-plain', array($oAccount, $oMessage, &$sPlain));
$oAlternativePart = new MimePart; $oAlternativePart = new MimePart;
$oAlternativePart->Headers->AddByName(MimeEnumHeader::CONTENT_TYPE, 'text/plain; charset="utf-8"'); $oAlternativePart->Headers->AddByName(MimeEnumHeader::CONTENT_TYPE, 'text/plain; charset="utf-8"');
@ -1146,12 +1149,9 @@ trait Messages
'convert.quoted-printable-encode' 'convert.quoted-printable-encode'
); );
$oMessage->SubParts->append($oAlternativePart); $oMessage->SubParts->append($oAlternativePart);
}
unset($oAlternativePart); unset($oAlternativePart);
unset($sSignature);
unset($sPlain); unset($sPlain);
} }
}
unset($oPart); unset($oPart);
$aAttachments = $this->GetActionParam('attachments', null); $aAttachments = $this->GetActionParam('attachments', null);

View file

@ -79,10 +79,10 @@ trait Pgp
$GPG->addDecryptKey( $GPG->addDecryptKey(
$this->GetActionParam('keyId', ''), $this->GetActionParam('keyId', ''),
$this->GetActionParam('Passphrase', '') $this->GetActionParam('passphrase', '')
); );
$sData = $this->GetActionParam('Data', ''); $sData = $this->GetActionParam('data', '');
$oPart = null; $oPart = null;
$result = [ $result = [
'data' => '', 'data' => '',
@ -127,7 +127,7 @@ trait Pgp
$GPG = $this->GnuPG(); $GPG = $this->GnuPG();
return $this->DefaultResponse($GPG ? $GPG->export( return $this->DefaultResponse($GPG ? $GPG->export(
$this->GetActionParam('keyId', ''), $this->GetActionParam('keyId', ''),
$this->GetActionParam('Passphrase', '') $this->GetActionParam('passphrase', '')
) : false); ) : false);
} }
@ -136,11 +136,11 @@ trait Pgp
$fingerprint = false; $fingerprint = false;
$GPG = $this->GnuPG(); $GPG = $this->GnuPG();
if ($GPG) { if ($GPG) {
$sName = $this->GetActionParam('Name', ''); $sName = $this->GetActionParam('name', '');
$sEmail = $this->GetActionParam('Email', ''); $sEmail = $this->GetActionParam('email', '');
$fingerprint = $GPG->generateKey( $fingerprint = $GPG->generateKey(
$sName ? "{$sName} <{$sEmail}>" : $sEmail, $sName ? "{$sName} <{$sEmail}>" : $sEmail,
$this->GetActionParam('Passphrase', '') $this->GetActionParam('passphrase', '')
); );
} }
return $this->DefaultResponse($fingerprint); return $this->DefaultResponse($fingerprint);
@ -156,9 +156,9 @@ trait Pgp
public function DoGnupgImportKey() : array public function DoGnupgImportKey() : array
{ {
$sKey = $this->GetActionParam('Key', ''); $sKey = $this->GetActionParam('key', '');
$sKeyId = $this->GetActionParam('keyId', ''); $sKeyId = $this->GetActionParam('keyId', '');
$sEmail = $this->GetActionParam('Email', ''); $sEmail = $this->GetActionParam('email', '');
if (!$sKey) { if (!$sKey) {
try { try {
@ -265,7 +265,7 @@ trait Pgp
*/ */
public function DoStorePGPKey() : array public function DoStorePGPKey() : array
{ {
$key = $this->GetActionParam('Key', ''); $key = $this->GetActionParam('key', '');
$keyId = $this->GetActionParam('keyId', ''); $keyId = $this->GetActionParam('keyId', '');
return $this->DefaultResponse(($key && $keyId && $this->StorePGPKey($key, $keyId))); return $this->DefaultResponse(($key && $keyId && $this->StorePGPKey($key, $keyId)));
} }

View file

@ -23,7 +23,7 @@ trait Response
} }
return \array_merge(array( return \array_merge(array(
// 'Version' => APP_VERSION, // 'version' => APP_VERSION,
'Action' => $sActionName, 'Action' => $sActionName,
'Result' => $this->responseObject($mResult) 'Result' => $this->responseObject($mResult)
), $aAdditionalParams); ), $aAdditionalParams);

View file

@ -123,7 +123,7 @@ trait Themes
// : \str_replace(';}', '}', \preg_replace('/\\s*([:;{},])\\s*/', '\1', \preg_replace('/\\s+/', ' ', \preg_replace('#/\\*.*?\\*/#s', '', $mResult)))); // : \str_replace(';}', '}', \preg_replace('/\\s*([:;{},])\\s*/', '\1', \preg_replace('/\\s+/', ' ', \preg_replace('#/\\*.*?\\*/#s', '', $mResult))));
} }
public function UploadBackground(): array public function UploadBackground(?array $aFile, int $iError): array
{ {
$oAccount = $this->getAccountFromToken(); $oAccount = $this->getAccountFromToken();
@ -134,9 +134,6 @@ trait Themes
$sName = ''; $sName = '';
$sHash = ''; $sHash = '';
$aFile = $this->GetActionParam('File', null);
$iError = $this->GetActionParam('Error', \RainLoop\Enumerations\UploadError::UNKNOWN);
if ($oAccount && UPLOAD_ERR_OK === $iError && \is_array($aFile)) { if ($oAccount && UPLOAD_ERR_OK === $iError && \is_array($aFile)) {
$sMimeType = \SnappyMail\File\MimeType::fromFile($aFile['tmp_name'], $aFile['name']) $sMimeType = \SnappyMail\File\MimeType::fromFile($aFile['tmp_name'], $aFile['name'])
?: \SnappyMail\File\MimeType::fromFilename($aFile['name']) ?: \SnappyMail\File\MimeType::fromFilename($aFile['name'])

View file

@ -175,7 +175,7 @@ class ActionsAdmin extends Actions
$sPassword = $this->GetActionParam('Password', ''); $sPassword = $this->GetActionParam('Password', '');
$this->Logger()->AddSecret($sPassword); $this->Logger()->AddSecret($sPassword);
$sNewPassword = $this->GetActionParam('NewPassword', ''); $sNewPassword = $this->GetActionParam('newPassword', '');
if (\strlen($sNewPassword)) { if (\strlen($sNewPassword)) {
$this->Logger()->AddSecret($sNewPassword); $this->Logger()->AddSecret($sNewPassword);
} }
@ -295,11 +295,11 @@ class ActionsAdmin extends Actions
} }
return $this->DefaultResponse(array( return $this->DefaultResponse(array(
'Updatable' => \SnappyMail\Repository::canUpdateCore(), 'updatable' => \SnappyMail\Repository::canUpdateCore(),
'Warning' => $bShowWarning, 'warning' => $bShowWarning,
'Version' => $sVersion, 'version' => $sVersion,
'VersionCompare' => \version_compare(APP_VERSION, $sVersion), 'versionCompare' => \version_compare(APP_VERSION, $sVersion),
'Warnings' => $aWarnings 'warnings' => $aWarnings
)); ));
} }

View file

@ -190,12 +190,12 @@ class Property implements \JsonSerializable
'@Object' => 'Object/PluginProperty', '@Object' => 'Object/PluginProperty',
'value' => $this->mValue, 'value' => $this->mValue,
'placeholder' => $this->sPlaceholder, 'placeholder' => $this->sPlaceholder,
'Name' => $this->sName, 'name' => $this->sName,
'Type' => $this->iType, 'type' => $this->iType,
'Label' => $this->sLabel, 'label' => $this->sLabel,
'Default' => $this->mDefaultValue, 'default' => $this->mDefaultValue,
'Options' => $this->aOptions, 'options' => $this->aOptions,
'Desc' => $this->sDesc 'desc' => $this->sDesc
); );
} }
} }

View file

@ -20,8 +20,8 @@ class PropertyCollection extends \ArrayObject implements \JsonSerializable
{ {
return array( return array(
'@Object' => 'Object/PluginProperty', '@Object' => 'Object/PluginProperty',
'Type' => \RainLoop\Enumerations\PluginPropertyType::GROUP, 'type' => \RainLoop\Enumerations\PluginPropertyType::GROUP,
'Label' => $this->sLabel, 'label' => $this->sLabel,
'config' => $this->getArrayCopy() 'config' => $this->getArrayCopy()
/* /*
'config' => [ 'config' => [

View file

@ -57,12 +57,12 @@ class Domain extends AbstractProvider
public function LoadOrCreateNewFromAction(\RainLoop\Actions $oActions, string $sNameForTest = null) : ?\RainLoop\Model\Domain public function LoadOrCreateNewFromAction(\RainLoop\Actions $oActions, string $sNameForTest = null) : ?\RainLoop\Model\Domain
{ {
$sName = \mb_strtolower((string) $oActions->GetActionParam('Name', '')); $sName = \mb_strtolower((string) $oActions->GetActionParam('name', ''));
if (\strlen($sName) && $sNameForTest && !\str_contains($sName, '*')) { if (\strlen($sName) && $sNameForTest && !\str_contains($sName, '*')) {
$sNameForTest = null; $sNameForTest = null;
} }
if (\strlen($sName) || $sNameForTest) { if (\strlen($sName) || $sNameForTest) {
if (!$sNameForTest && !empty($oActions->GetActionParam('Create', 0)) && $this->Load($sName)) { if (!$sNameForTest && !empty($oActions->GetActionParam('create', 0)) && $this->Load($sName)) {
throw new \RainLoop\Exceptions\ClientException(\RainLoop\Notifications::DomainAlreadyExists); throw new \RainLoop\Exceptions\ClientException(\RainLoop\Notifications::DomainAlreadyExists);
} }
return \RainLoop\Model\Domain::fromArray($sNameForTest ?: $sName, [ return \RainLoop\Model\Domain::fromArray($sNameForTest ?: $sName, [

View file

@ -259,14 +259,7 @@ class ServiceActions
} }
if (\method_exists($this->oActions, $sAction) && \is_callable(array($this->oActions, $sAction))) { if (\method_exists($this->oActions, $sAction) && \is_callable(array($this->oActions, $sAction))) {
$aActionParams = isset($_GET) && \is_array($_GET) ? $_GET : null; $aResponse = $this->oActions->{$sAction}($aFile, $iError);
$aActionParams['File'] = $aFile;
$aActionParams['Error'] = $iError;
$this->oActions->SetActionParams($aActionParams, $sAction);
$aResponse = $this->oActions->{$sAction}();
} }
if (!is_array($aResponse)) { if (!is_array($aResponse)) {

View file

@ -1,36 +1,36 @@
<label data-bind="text: Label, visible: 5 !== Type"></label> <label data-bind="text: label, visible: 5 !== type"></label>
<!-- ko if: 0 === Type --> <!-- ko if: 0 === type -->
<input type="text" autocomplete="off" autocorrect="off" autocapitalize="off" <input type="text" autocomplete="off" autocorrect="off" autocapitalize="off"
data-bind="value: value, attr: {placeholder: placeholder}"> data-bind="value: value, attr: {placeholder: placeholder}">
<!-- /ko --> <!-- /ko -->
<!-- ko if: 1 === Type --> <!-- ko if: 1 === type -->
<input type="number" step="1" <input type="number" step="1"
data-bind="value: value, attr: {placeholder: placeholder}"> data-bind="value: value, attr: {placeholder: placeholder}">
<!-- /ko --> <!-- /ko -->
<!-- ko if: 3 === Type --> <!-- ko if: 3 === type -->
<input type="password" autocomplete="off" autocorrect="off" autocapitalize="off" <input type="password" autocomplete="off" autocorrect="off" autocapitalize="off"
data-bind="value: value, attr: {placeholder: placeholder}"> data-bind="value: value, attr: {placeholder: placeholder}">
<!-- /ko --> <!-- /ko -->
<!-- ko if: 2 === Type --> <!-- ko if: 2 === type -->
<textarea rows="5" autocomplete="off" autocorrect="off" autocapitalize="off" <textarea rows="5" autocomplete="off" autocorrect="off" autocapitalize="off"
data-bind="value: value, attr: {placeholder: placeholder }"></textarea> data-bind="value: value, attr: {placeholder: placeholder }"></textarea>
<!-- /ko --> <!-- /ko -->
<!-- ko if: 4 === Type --> <!-- ko if: 4 === type -->
<select data-bind="options: Options, value: value"></select> <select data-bind="options: options, value: value"></select>
<!-- /ko --> <!-- /ko -->
<!-- ko if: 5 === Type --> <!-- ko if: 5 === type -->
<div data-bind="component: { <div data-bind="component: {
name: 'Checkbox', name: 'Checkbox',
params: { value: value, label: Label } params: { value: value, label: label }
}"></div> }"></div>
<!-- /ko --> <!-- /ko -->
<!-- ko if: 6 === Type --> <!-- ko if: 6 === type -->
<input type="url" <input type="url"
data-bind="value: value, attr: {placeholder: placeholder}"> data-bind="value: value, attr: {placeholder: placeholder}">
<!-- /ko --> <!-- /ko -->
<!-- ko if: 8 === Type --> <!-- ko if: 8 === type -->
<select data-bind="options: Options, optionsText: 'name', optionsValue: 'id', value: value"></select> <select data-bind="options: options, optionsText: 'name', optionsValue: 'id', value: value"></select>
<!-- /ko --> <!-- /ko -->
<!-- ko if: '' !== Desc --> <!-- ko if: '' !== desc -->
<span tabindex="0" class="help-block"><span data-bind="text: Desc"></span></span> <span tabindex="0" class="help-block"><span data-bind="text: desc"></span></span>
<!-- /ko --> <!-- /ko -->

View file

@ -14,15 +14,15 @@
<span data-bind="text: saveError"></span> <span data-bind="text: saveError"></span>
</div> </div>
<div data-bind="foreach: config, visible: hasConfiguration"> <div data-bind="foreach: config, visible: hasConfiguration">
<!-- ko if: 7 == Type --> <!-- ko if: 7 == type -->
<details open=""> <details open="">
<summary class="legend" data-bind="text: Label"></summary> <summary class="legend" data-bind="text: label"></summary>
<div data-bind="foreach: config"> <div data-bind="foreach: config">
<div class="control-group" data-bind="template: { name: 'AdminSettingsPluginProperty' }"></div> <div class="control-group" data-bind="template: { name: 'AdminSettingsPluginProperty' }"></div>
</div> </div>
</details> </details>
<!-- /ko --> <!-- /ko -->
<!-- ko if: 7 != Type --> <!-- ko if: 7 != type -->
<div class="control-group" data-bind="template: { name: 'AdminSettingsPluginProperty' }"></div> <div class="control-group" data-bind="template: { name: 'AdminSettingsPluginProperty' }"></div>
<!-- /ko --> <!-- /ko -->
</div> </div>

View file

@ -12,18 +12,18 @@
<div class="control-group"> <div class="control-group">
<label data-i18n="GLOBAL/EMAIL"></label> <label data-i18n="GLOBAL/EMAIL"></label>
<strong style="margin-top: 5px;" data-bind="visible: !isNew(), text: email"></strong> <strong style="margin-top: 5px;" data-bind="visible: !isNew(), text: email"></strong>
<input name="Email" type="text" class="input-xlarge" <input name="email" type="text" class="input-xlarge"
autofocus="" autocorrect="off" autocapitalize="off" autofocus="" autocorrect="off" autocapitalize="off"
data-bind="visible: isNew, textInput: email, attr: {required: isNew}"> data-bind="visible: isNew, textInput: email, attr: {required: isNew}">
</div> </div>
<div class="control-group"> <div class="control-group">
<label data-i18n="GLOBAL/PASSWORD"></label> <label data-i18n="GLOBAL/PASSWORD"></label>
<input name="Password" type="password" class="input-xlarge" autocomplete="new-password" autocorrect="off" autocapitalize="off" <input name="password" type="password" class="input-xlarge" autocomplete="new-password" autocorrect="off" autocapitalize="off"
data-bind="value: password, attr: {required:isNew}"> data-bind="value: password, attr: {required:isNew}">
</div> </div>
<div class="control-group"> <div class="control-group">
<label data-i18n="GLOBAL/NAME"></label> <label data-i18n="GLOBAL/NAME"></label>
<input name="Name" type="text" class="input-xlarge" data-bind="value: name"> <input name="name" type="text" class="input-xlarge" data-bind="value: name">
</div> </div>
</form> </form>
<footer> <footer>