mirror of
https://github.com/nodemailer/wildduck.git
synced 2024-09-20 15:26:03 +08:00
allow settings receivedMax
This commit is contained in:
parent
6a16a08916
commit
5a0b00a7af
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
|
@ -1 +1 @@
|
|||
define({
"name": "wildduck",
"version": "1.0.0",
"description": "WildDuck API docs",
"title": "WildDuck API",
"url": "https://api.wildduck.email",
"sampleUrl": false,
"defaultVersion": "0.0.0",
"apidoc": "0.3.0",
"generator": {
"name": "apidoc",
"time": "2018-06-12T08:58:21.233Z",
"url": "http://apidocjs.com",
"version": "0.17.6"
}
});
|
||||
define({
"name": "wildduck",
"version": "1.0.0",
"description": "WildDuck API docs",
"title": "WildDuck API",
"url": "https://api.wildduck.email",
"sampleUrl": false,
"defaultVersion": "0.0.0",
"apidoc": "0.3.0",
"generator": {
"name": "apidoc",
"time": "2018-06-12T10:44:54.834Z",
"url": "http://apidocjs.com",
"version": "0.17.6"
}
});
|
||||
|
|
|
@ -1 +1 @@
|
|||
{
"name": "wildduck",
"version": "1.0.0",
"description": "WildDuck API docs",
"title": "WildDuck API",
"url": "https://api.wildduck.email",
"sampleUrl": false,
"defaultVersion": "0.0.0",
"apidoc": "0.3.0",
"generator": {
"name": "apidoc",
"time": "2018-06-12T08:58:21.233Z",
"url": "http://apidocjs.com",
"version": "0.17.6"
}
}
|
||||
{
"name": "wildduck",
"version": "1.0.0",
"description": "WildDuck API docs",
"title": "WildDuck API",
"url": "https://api.wildduck.email",
"sampleUrl": false,
"defaultVersion": "0.0.0",
"apidoc": "0.3.0",
"generator": {
"name": "apidoc",
"time": "2018-06-12T10:44:54.834Z",
"url": "http://apidocjs.com",
"version": "0.17.6"
}
}
|
||||
|
|
|
@ -309,6 +309,7 @@ module.exports = (db, server, userHandler) => {
|
|||
* @apiParam {Number} [imapMaxUpload] How many bytes can be uploaded via IMAP during 24 hour
|
||||
* @apiParam {Number} [imapMaxDownload] How many bytes can be downloaded via IMAP during 24 hour
|
||||
* @apiParam {Number} [pop3MaxDownload] How many bytes can be downloaded via POP3 during 24 hour
|
||||
* @apiParam {Number} [receivedMax] How many messages can be received from MX during 1 hour
|
||||
* @apiParam {String} [sess] Session identifier for the logs
|
||||
* @apiParam {String} [ip] IP address for the logs
|
||||
*
|
||||
|
@ -426,6 +427,9 @@ module.exports = (db, server, userHandler) => {
|
|||
pop3MaxDownload: Joi.number()
|
||||
.min(0)
|
||||
.default(0),
|
||||
receivedMax: Joi.number()
|
||||
.min(0)
|
||||
.default(0),
|
||||
|
||||
tags: Joi.array().items(
|
||||
Joi.string()
|
||||
|
@ -928,7 +932,7 @@ module.exports = (db, server, userHandler) => {
|
|||
},
|
||||
|
||||
received: {
|
||||
allowed: 150, // TODO: most probably should be read from config or user data
|
||||
allowed: Number(userData.receivedMax) || 150,
|
||||
used: received,
|
||||
ttl: receivedTtl >= 0 ? receivedTtl : false
|
||||
},
|
||||
|
@ -992,6 +996,7 @@ module.exports = (db, server, userHandler) => {
|
|||
* @apiParam {Number} [imapMaxUpload] How many bytes can be uploaded via IMAP during 24 hour
|
||||
* @apiParam {Number} [imapMaxDownload] How many bytes can be downloaded via IMAP during 24 hour
|
||||
* @apiParam {Number} [pop3MaxDownload] How many bytes can be downloaded via POP3 during 24 hour
|
||||
* @apiParam {Number} [receivedMax] How many messages can be received from MX during 1 hour
|
||||
* @apiParam {Boolean} [disable2fa] If true, then disables 2FA for this user
|
||||
* @apiParam {Boolean} [disabled] If true then disables user account (can not login, can not receive messages)
|
||||
* @apiParam {String} [sess] Session identifier for the logs
|
||||
|
@ -1080,6 +1085,7 @@ module.exports = (db, server, userHandler) => {
|
|||
imapMaxUpload: Joi.number().min(0),
|
||||
imapMaxDownload: Joi.number().min(0),
|
||||
pop3MaxDownload: Joi.number().min(0),
|
||||
receivedMax: Joi.number().min(0),
|
||||
|
||||
disable2fa: Joi.boolean()
|
||||
.empty('')
|
||||
|
|
24
lib/db.js
24
lib/db.js
|
@ -22,15 +22,23 @@ let getDBConnection = (main, config, callback) => {
|
|||
return callback(null, main.db(config));
|
||||
}
|
||||
}
|
||||
MongoClient.connect(config, { useNewUrlParser: true }, (err, db) => {
|
||||
if (err) {
|
||||
return callback(err);
|
||||
MongoClient.connect(
|
||||
config,
|
||||
{
|
||||
useNewUrlParser: true,
|
||||
reconnectTries: 100000,
|
||||
reconnectInterval: 1000
|
||||
},
|
||||
(err, db) => {
|
||||
if (err) {
|
||||
return callback(err);
|
||||
}
|
||||
if (main && db.s && db.s.options && db.s.options.dbName) {
|
||||
db = db.db(db.s.options.dbName);
|
||||
}
|
||||
return callback(null, db);
|
||||
}
|
||||
if (main && db.s && db.s.options && db.s.options.dbName) {
|
||||
db = db.db(db.s.options.dbName);
|
||||
}
|
||||
return callback(null, db);
|
||||
});
|
||||
);
|
||||
};
|
||||
|
||||
module.exports.connect = callback => {
|
||||
|
|
|
@ -1036,6 +1036,7 @@ class UserHandler {
|
|||
imapMaxUpload: data.imapMaxUpload || 0,
|
||||
imapMaxDownload: data.imapMaxDownload || 0,
|
||||
pop3MaxDownload: data.pop3MaxDownload || 0,
|
||||
receivedMax: data.receivedMax || 0,
|
||||
|
||||
targets: [].concat(data.targets || []),
|
||||
|
||||
|
|
Loading…
Reference in a new issue