From 63414007a1437e0b642e6402d92bd0f00c898232 Mon Sep 17 00:00:00 2001 From: Andris Reinman Date: Tue, 19 Dec 2023 13:08:56 +0200 Subject: [PATCH] fix(api): Added quota information to account info response --- lib/account.js | 10 ++++++++++ lib/connection.js | 22 ++++++++++++++++++++++ package.json | 6 +++--- sbom.json | 2 +- server.js | 1 + static/licenses.html | 16 ++++++++-------- translations/messages.pot | 10 +++++----- workers/api.js | 25 +++++++++++++++++++++++++ workers/imap.js | 14 ++++++++++++++ 9 files changed, 89 insertions(+), 17 deletions(-) diff --git a/lib/account.js b/lib/account.js index 91da7ea7..776617cd 100644 --- a/lib/account.js +++ b/lib/account.js @@ -929,6 +929,16 @@ class Account { }); } + async getQuota() { + await this.loadAccountData(this.account, true); + + return await this.call({ + cmd: 'getQuota', + account: this.account, + timeout: this.timeout + }); + } + async createMailbox(path) { await this.loadAccountData(this.account, true); diff --git a/lib/connection.js b/lib/connection.js index 12600138..e3056b7b 100644 --- a/lib/connection.js +++ b/lib/connection.js @@ -1671,6 +1671,28 @@ class Connection { }); } + async getQuota() { + this.checkIMAPConnection(); + try { + let result = await this.imapClient.getQuota(); + return (result && result.storage) || false; + } catch (err) { + if (err.serverResponseCode) { + let error = new Error('Quota request failed'); + error.info = { + response: err.response && typeof err.response === 'string' && err.response.replace(/^[^\s]*\s*/, '') + }; + error.code = err.serverResponseCode; + error.statusCode = 400; + throw error; + } else if (err.responseStatus === 'NO') { + return false; + } else { + throw err; + } + } + } + async createMailbox(path) { this.checkIMAPConnection(); try { diff --git a/package.json b/package.json index fa0b6377..e3b5f681 100644 --- a/package.json +++ b/package.json @@ -57,7 +57,7 @@ "ace-builds": "1.32.2", "base32.js": "0.1.0", "bull-arena": "4.1.0", - "bullmq": "4.15.4", + "bullmq": "4.16.0", "compare-versions": "6.1.0", "dotenv": "16.3.1", "encoding-japanese": "2.0.0", @@ -94,7 +94,7 @@ "node-gettext": "3.0.0", "nodemailer": "6.9.7", "pino": "8.17.1", - "prom-client": "15.0.0", + "prom-client": "15.1.0", "psl": "1.9.0", "pubface": "1.0.6", "punycode": "2.3.1", @@ -112,7 +112,7 @@ "devDependencies": { "chai": "4.3.10", "eerawlog": "1.5.1", - "eslint": "8.55.0", + "eslint": "8.56.0", "eslint-config-nodemailer": "1.2.0", "eslint-config-prettier": "9.1.0", "grunt": "1.6.1", diff --git a/sbom.json b/sbom.json index d4984360..d5c841ce 100644 --- a/sbom.json +++ b/sbom.json @@ -1 +1 @@ -{"bomFormat":"CycloneDX","specVersion":"1.4","version":1,"metadata":{"timestamp":"2023-12-15T12:45:29Z","tools":[{"vendor":"advanced-security","name":"gh-sbom","version":"0.0.9"}],"licenses":[{"expression":"CC0-1.0"}]},"components":[{"type":"library","name":"eslint","version":"8.55.0","purl":"pkg:npm/eslint@8.55.0","licenses":[{"expression":"MIT"}]},{"type":"library","name":"humanize","version":"0.0.9","purl":"pkg:npm/humanize@0.0.9","licenses":[{"expression":"MIT"}]},{"type":"library","group":"@bugsnag","name":"js","version":"7.22.2","purl":"pkg:npm/%40bugsnag/js@7.22.2"},{"type":"library","name":"express","version":"4.18.2","purl":"pkg:npm/express@4.18.2","licenses":[{"expression":"MIT"}]},{"type":"library","name":"ioredfour","version":"1.2.0-ioredis-07","purl":"pkg:npm/ioredfour@1.2.0-ioredis-07","licenses":[{"expression":"MIT"}]},{"type":"library","name":"joi","version":"17.11.0","purl":"pkg:npm/joi@17.11.0","licenses":[{"expression":"BSD-3-Clause"}]},{"type":"library","name":"marked","version":"9.1.6","purl":"pkg:npm/marked@9.1.6","licenses":[{"expression":"MIT"}]},{"type":"library","name":"nanoid","version":"3.3.4","purl":"pkg:npm/nanoid@3.3.4","licenses":[{"expression":"MIT"}]},{"type":"library","name":"pubface","version":"1.0.6","purl":"pkg:npm/pubface@1.0.6","licenses":[{"expression":"MIT-0"}]},{"type":"library","group":"@phc","name":"pbkdf2","version":"1.1.14","purl":"pkg:npm/%40phc/pbkdf2@1.1.14","licenses":[{"expression":"MIT"}]},{"type":"library","name":"bull-arena","version":"4.1.0","purl":"pkg:npm/bull-arena@4.1.0","licenses":[{"expression":"MIT"}]},{"type":"library","name":"ioredis","version":"5.3.2","purl":"pkg:npm/ioredis@5.3.2","licenses":[{"expression":"MIT"}]},{"type":"library","name":"libqp","version":"2.0.1","purl":"pkg:npm/libqp@2.0.1","licenses":[{"expression":"MIT"}]},{"type":"library","name":"punycode","version":"2.3.1","purl":"pkg:npm/punycode@2.3.1","licenses":[{"expression":"MIT"}]},{"type":"library","name":"xgettext-template","version":"5.0.0","purl":"pkg:npm/xgettext-template@5.0.0","licenses":[{"expression":"MIT"}]},{"type":"library","group":"@hapi","name":"cookie","version":"12.0.1","purl":"pkg:npm/%40hapi/cookie@12.0.1","licenses":[{"expression":"BSD-3-Clause"}]},{"type":"library","name":"eerawlog","version":"1.5.1","purl":"pkg:npm/eerawlog@1.5.1","licenses":[{"expression":"ISC"}]},{"type":"library","name":"iconv-lite","version":"0.6.3","purl":"pkg:npm/iconv-lite@0.6.3","licenses":[{"expression":"MIT"}]},{"type":"library","name":"node-gettext","version":"3.0.0","purl":"pkg:npm/node-gettext@3.0.0","licenses":[{"expression":"MIT"}]},{"type":"library","name":"uuid","version":"9.0.1","purl":"pkg:npm/uuid@9.0.1","licenses":[{"expression":"MIT"}]},{"type":"library","name":"bullmq","version":"4.15.2","purl":"pkg:npm/bullmq@4.15.2"},{"type":"library","group":"@hapi","name":"crumb","version":"9.0.1","purl":"pkg:npm/%40hapi/crumb@9.0.1","licenses":[{"expression":"BSD-3-Clause"}]},{"type":"library","name":"handlebars","version":"4.7.8","purl":"pkg:npm/handlebars@4.7.8","licenses":[{"expression":"MIT"}]},{"type":"library","group":"@hapi","name":"boom","version":"10.0.1","purl":"pkg:npm/%40hapi/boom@10.0.1","licenses":[{"expression":"BSD-3-Clause"}]},{"type":"library","name":"js-beautify","version":"1.14.11","purl":"pkg:npm/js-beautify@1.14.11","licenses":[{"expression":"MIT"}]},{"type":"library","name":"psl","version":"1.9.0","purl":"pkg:npm/psl@1.9.0","licenses":[{"expression":"MIT"}]},{"type":"library","name":"speakeasy","version":"2.0.0","purl":"pkg:npm/speakeasy@2.0.0","licenses":[{"expression":"MIT"}]},{"type":"library","name":"ace-builds","version":"1.32.0","purl":"pkg:npm/ace-builds@1.32.0"},{"type":"library","name":"gettext-parser","version":"7.0.1","purl":"pkg:npm/gettext-parser@7.0.1","licenses":[{"expression":"MIT"}]},{"type":"library","name":"jsxgettext","version":"0.11.0","purl":"pkg:npm/jsxgettext@0.11.0","licenses":[{"expression":"MPL-2.0"}]},{"type":"library","name":"pkg","version":"5.8.1","purl":"pkg:npm/pkg@5.8.1","licenses":[{"expression":"MIT"}]},{"type":"library","name":"exponential-backoff","version":"3.1.1","purl":"pkg:npm/exponential-backoff@3.1.1","licenses":[{"expression":"Apache-2.0"}]},{"type":"library","name":"dotenv","version":"16.3.1","purl":"pkg:npm/dotenv@16.3.1","licenses":[{"expression":"BSD-2-Clause"}]},{"type":"library","name":"html-to-text","version":"9.0.5","purl":"pkg:npm/html-to-text@9.0.5","licenses":[{"expression":"MIT"}]},{"type":"library","name":"ipaddr.js","version":"2.1.0","purl":"pkg:npm/ipaddr.js@2.1.0","licenses":[{"expression":"MIT"}]},{"type":"library","name":"libmime","version":"5.2.1","purl":"pkg:npm/libmime@5.2.1","licenses":[{"expression":"MIT"}]},{"type":"library","name":"mailparser","version":"3.6.5","purl":"pkg:npm/mailparser@3.6.5","licenses":[{"expression":"MIT"}]},{"type":"library","name":"pino","version":"8.16.2","purl":"pkg:npm/pino@8.16.2","licenses":[{"expression":"MIT"}]},{"type":"library","group":"@postalsys","name":"hecks","version":"3.0.0-fork.3","purl":"pkg:npm/%40postalsys/hecks@3.0.0-fork.3","licenses":[{"expression":"MIT"}]},{"type":"library","name":"chai","version":"4.3.10","purl":"pkg:npm/chai@4.3.10","licenses":[{"expression":"MIT"}]},{"type":"library","name":"eslint-config-prettier","version":"9.1.0","purl":"pkg:npm/eslint-config-prettier@9.1.0","licenses":[{"expression":"MIT"}]},{"type":"library","group":"@postalsys","name":"email-ai-tools","version":"1.8.0","purl":"pkg:npm/%40postalsys/email-ai-tools@1.8.0"},{"type":"library","group":"@postalsys","name":"certs","version":"1.0.7","purl":"pkg:npm/%40postalsys/certs@1.0.7","licenses":[{"expression":"ISC"}]},{"type":"library","group":"@postalsys","name":"email-text-tools","version":"2.1.3","purl":"pkg:npm/%40postalsys/email-text-tools@2.1.3","licenses":[{"expression":"MIT"}]},{"type":"library","name":"compare-versions","version":"6.1.0","purl":"pkg:npm/compare-versions@6.1.0","licenses":[{"expression":"MIT"}]},{"type":"library","name":"grunt-eslint","version":"24.3.0","purl":"pkg:npm/grunt-eslint@24.3.0","licenses":[{"expression":"MIT"}]},{"type":"library","name":"hapi-pino","version":"12.1.0","purl":"pkg:npm/hapi-pino@12.1.0","licenses":[{"expression":"MIT"}]},{"type":"library","name":"imapflow","version":"1.0.147","purl":"pkg:npm/imapflow@1.0.147","licenses":[{"expression":"MIT"}]},{"type":"library","name":"timezones-list","version":"3.0.2","purl":"pkg:npm/timezones-list@3.0.2","licenses":[{"expression":"MIT"}]},{"type":"library","group":"@hapi","name":"vision","version":"7.0.3","purl":"pkg:npm/%40hapi/vision@7.0.3","licenses":[{"expression":"BSD-3-Clause"}]},{"type":"library","name":"undici","version":"5.28.2","purl":"pkg:npm/undici@5.28.2","licenses":[{"expression":"MIT"}]},{"type":"library","name":"libbase64","version":"1.2.1","purl":"pkg:npm/libbase64@1.2.1","licenses":[{"expression":"MIT"}]},{"type":"library","name":"murmurhash","version":"2.0.1","purl":"pkg:npm/murmurhash@2.0.1","licenses":[{"expression":"MIT"}]},{"type":"library","name":"qrcode","version":"1.5.3","purl":"pkg:npm/qrcode@1.5.3","licenses":[{"expression":"MIT"}]},{"type":"library","name":"resedit","version":"2.0.0","purl":"pkg:npm/resedit@2.0.0","licenses":[{"expression":"MIT"}]},{"type":"library","name":"xml2js","version":"0.6.2","purl":"pkg:npm/xml2js@0.6.2","licenses":[{"expression":"MIT"}]},{"type":"library","name":"he","version":"1.2.0","purl":"pkg:npm/he@1.2.0","licenses":[{"expression":"MIT"}]},{"type":"library","name":"hapi-auth-bearer-token","version":"8.0.0","purl":"pkg:npm/hapi-auth-bearer-token@8.0.0","licenses":[{"expression":"MIT"}]},{"type":"library","name":"hapi-swagger","version":"17.2.0","purl":"pkg:npm/hapi-swagger@17.2.0"},{"type":"library","name":"jquery","version":"3.7.1","purl":"pkg:npm/jquery@3.7.1","licenses":[{"expression":"MIT"}]},{"type":"library","name":"nodemailer","version":"6.9.7","purl":"pkg:npm/nodemailer@6.9.7","licenses":[{"expression":"MIT-0"}]},{"type":"library","name":"wild-config","version":"1.7.1","purl":"pkg:npm/wild-config@1.7.1","licenses":[{"expression":"MIT"}]},{"type":"library","name":"encoding-japanese","version":"2.0.0","purl":"pkg:npm/encoding-japanese@2.0.0","licenses":[{"expression":"MIT"}]},{"type":"library","name":"base32.js","version":"0.1.0","purl":"pkg:npm/base32.js@0.1.0","licenses":[{"expression":"MIT"}]},{"type":"library","name":"eslint-config-nodemailer","version":"1.2.0","purl":"pkg:npm/eslint-config-nodemailer@1.2.0","licenses":[{"expression":"MIT"}]},{"type":"library","name":"grunt","version":"1.6.1","purl":"pkg:npm/grunt@1.6.1","licenses":[{"expression":"MIT"}]},{"type":"library","name":"grunt-cli","version":"1.4.3","purl":"pkg:npm/grunt-cli@1.4.3","licenses":[{"expression":"MIT"}]},{"type":"library","name":"mailsplit","version":"5.4.0","purl":"pkg:npm/mailsplit@5.4.0","licenses":[{"expression":"EUPL-1.1+ OR MIT OR (EUPL-1.1+ AND MIT)"}]},{"type":"library","name":"minimist","version":"1.2.8","purl":"pkg:npm/minimist@1.2.8","licenses":[{"expression":"MIT"}]},{"type":"library","name":"msgpack5","version":"6.0.2","purl":"pkg:npm/msgpack5@6.0.2","licenses":[{"expression":"MIT"}]},{"type":"library","group":"@hapi","name":"hapi","version":"21.3.2","purl":"pkg:npm/%40hapi/hapi@21.3.2","licenses":[{"expression":"BSD-3-Clause"}]},{"type":"library","name":"pino-pretty","version":"10.2.3","purl":"pkg:npm/pino-pretty@10.2.3","licenses":[{"expression":"MIT"}]},{"type":"library","group":"@hapi","name":"inert","version":"7.1.0","purl":"pkg:npm/%40hapi/inert@7.1.0","licenses":[{"expression":"BSD-3-Clause"}]},{"type":"library","name":"ical.js","version":"1.5.0","purl":"pkg:npm/ical.js@1.5.0","licenses":[{"expression":"MPL-2.0"}]},{"type":"library","name":"prom-client","version":"15.0.0","purl":"pkg:npm/prom-client@15.0.0","licenses":[{"expression":"Apache-2.0"}]},{"type":"library","name":"startbootstrap-sb-admin-2","version":"3.3.7","purl":"pkg:npm/startbootstrap-sb-admin-2@3.3.7","licenses":[{"expression":"MIT"}]},{"type":"library","group":"@hapi","name":"bell","version":"13.0.1","purl":"pkg:npm/%40hapi/bell@13.0.1","licenses":[{"expression":"BSD-3-Clause"}]},{"type":"library","name":"smtp-server","version":"3.13.0","purl":"pkg:npm/smtp-server@3.13.0","licenses":[{"expression":"MIT-0"}]},{"type":"library","group":"@postalsys","name":"templates","version":"1.0.7","purl":"pkg:npm/%40postalsys/templates@1.0.7","licenses":[{"expression":"ISC"}]},{"type":"library","name":"license-checker","version":"25.0.1","purl":"pkg:npm/license-checker@25.0.1","licenses":[{"expression":"BSD-3-Clause"}]},{"type":"library","name":"socks","version":"2.7.1","purl":"pkg:npm/socks@2.7.1","licenses":[{"expression":"MIT"}]},{"type":"library","group":"@elastic","name":"elasticsearch","version":"8.10.0","purl":"pkg:npm/%40elastic/elasticsearch@8.10.0","licenses":[{"expression":"Apache-2.0"}]},{"type":"library","group":"shimataro","name":"ssh-key-action","version":"2","purl":"pkg:github/shimataro/ssh-key-action@2"},{"type":"library","group":"docker","name":"build-push-action","version":"5","purl":"pkg:github/docker/build-push-action@5"},{"type":"library","group":"docker","name":"login-action","version":"3","purl":"pkg:github/docker/login-action@3"},{"type":"library","group":"docker","name":"setup-buildx-action","version":"3","purl":"pkg:github/docker/setup-buildx-action@3"},{"type":"library","group":"actions","name":"checkout","version":"4","purl":"pkg:github/actions/checkout@4"},{"type":"library","group":"docker","name":"metadata-action","version":"5","purl":"pkg:github/docker/metadata-action@5"},{"type":"library","group":"docker","name":"setup-qemu-action","version":"3","purl":"pkg:github/docker/setup-qemu-action@3"},{"type":"library","group":"actions","name":"setup-node","version":"3","purl":"pkg:github/actions/setup-node@3"},{"type":"library","group":"actions","name":"setup-node","version":"1","purl":"pkg:github/actions/setup-node@1"},{"type":"library","group":"google-github-actions","name":"release-please-action","version":"3","purl":"pkg:github/google-github-actions/release-please-action@3"}]} +{"bomFormat":"CycloneDX","specVersion":"1.4","version":1,"metadata":{"timestamp":"2023-12-19T11:03:55Z","tools":[{"vendor":"advanced-security","name":"gh-sbom","version":"0.0.9"}],"licenses":[{"expression":"CC0-1.0"}]},"components":[{"type":"library","name":"express","version":"4.18.2","purl":"pkg:npm/express@4.18.2","licenses":[{"expression":"MIT"}]},{"type":"library","name":"uuid","version":"9.0.1","purl":"pkg:npm/uuid@9.0.1","licenses":[{"expression":"MIT"}]},{"type":"library","name":"resedit","version":"2.0.0","purl":"pkg:npm/resedit@2.0.0","licenses":[{"expression":"MIT"}]},{"type":"library","name":"joi","version":"17.11.0","purl":"pkg:npm/joi@17.11.0","licenses":[{"expression":"BSD-3-Clause"}]},{"type":"library","name":"minimist","version":"1.2.8","purl":"pkg:npm/minimist@1.2.8","licenses":[{"expression":"MIT"}]},{"type":"library","name":"pubface","version":"1.0.6","purl":"pkg:npm/pubface@1.0.6","licenses":[{"expression":"MIT-0"}]},{"type":"library","name":"nodemailer","version":"6.9.7","purl":"pkg:npm/nodemailer@6.9.7","licenses":[{"expression":"MIT-0"}]},{"type":"library","name":"startbootstrap-sb-admin-2","version":"3.3.7","purl":"pkg:npm/startbootstrap-sb-admin-2@3.3.7","licenses":[{"expression":"MIT"}]},{"type":"library","name":"encoding-japanese","version":"2.0.0","purl":"pkg:npm/encoding-japanese@2.0.0","licenses":[{"expression":"MIT"}]},{"type":"library","name":"hapi-pino","version":"12.1.0","purl":"pkg:npm/hapi-pino@12.1.0","licenses":[{"expression":"MIT"}]},{"type":"library","name":"libqp","version":"2.0.1","purl":"pkg:npm/libqp@2.0.1","licenses":[{"expression":"MIT"}]},{"type":"library","name":"mailsplit","version":"5.4.0","purl":"pkg:npm/mailsplit@5.4.0","licenses":[{"expression":"EUPL-1.1+ OR MIT OR (EUPL-1.1+ AND MIT)"}]},{"type":"library","name":"smtp-server","version":"3.13.0","purl":"pkg:npm/smtp-server@3.13.0","licenses":[{"expression":"MIT-0"}]},{"type":"library","name":"ioredis","version":"5.3.2","purl":"pkg:npm/ioredis@5.3.2","licenses":[{"expression":"MIT"}]},{"type":"library","name":"psl","version":"1.9.0","purl":"pkg:npm/psl@1.9.0","licenses":[{"expression":"MIT"}]},{"type":"library","name":"bull-arena","version":"4.1.0","purl":"pkg:npm/bull-arena@4.1.0","licenses":[{"expression":"MIT"}]},{"type":"library","name":"grunt-cli","version":"1.4.3","purl":"pkg:npm/grunt-cli@1.4.3","licenses":[{"expression":"MIT"}]},{"type":"library","name":"he","version":"1.2.0","purl":"pkg:npm/he@1.2.0","licenses":[{"expression":"MIT"}]},{"type":"library","name":"socks","version":"2.7.1","purl":"pkg:npm/socks@2.7.1","licenses":[{"expression":"MIT"}]},{"type":"library","group":"@elastic","name":"elasticsearch","version":"8.11.0","purl":"pkg:npm/%40elastic/elasticsearch@8.11.0"},{"type":"library","group":"@postalsys","name":"certs","version":"1.0.7","purl":"pkg:npm/%40postalsys/certs@1.0.7","licenses":[{"expression":"ISC"}]},{"type":"library","name":"pino-pretty","version":"10.3.0","purl":"pkg:npm/pino-pretty@10.3.0"},{"type":"library","name":"dotenv","version":"16.3.1","purl":"pkg:npm/dotenv@16.3.1","licenses":[{"expression":"BSD-2-Clause"}]},{"type":"library","name":"html-to-text","version":"9.0.5","purl":"pkg:npm/html-to-text@9.0.5","licenses":[{"expression":"MIT"}]},{"type":"library","name":"punycode","version":"2.3.1","purl":"pkg:npm/punycode@2.3.1","licenses":[{"expression":"MIT"}]},{"type":"library","group":"@hapi","name":"inert","version":"7.1.0","purl":"pkg:npm/%40hapi/inert@7.1.0","licenses":[{"expression":"BSD-3-Clause"}]},{"type":"library","group":"@hapi","name":"vision","version":"7.0.3","purl":"pkg:npm/%40hapi/vision@7.0.3","licenses":[{"expression":"BSD-3-Clause"}]},{"type":"library","group":"@postalsys","name":"email-text-tools","version":"2.1.3","purl":"pkg:npm/%40postalsys/email-text-tools@2.1.3","licenses":[{"expression":"MIT"}]},{"type":"library","group":"@postalsys","name":"hecks","version":"3.0.0-fork.3","purl":"pkg:npm/%40postalsys/hecks@3.0.0-fork.3","licenses":[{"expression":"MIT"}]},{"type":"library","name":"grunt-eslint","version":"24.3.0","purl":"pkg:npm/grunt-eslint@24.3.0","licenses":[{"expression":"MIT"}]},{"type":"library","name":"eslint-config-prettier","version":"9.1.0","purl":"pkg:npm/eslint-config-prettier@9.1.0","licenses":[{"expression":"MIT"}]},{"type":"library","name":"handlebars","version":"4.7.8","purl":"pkg:npm/handlebars@4.7.8","licenses":[{"expression":"MIT"}]},{"type":"library","name":"hapi-swagger","version":"17.2.0","purl":"pkg:npm/hapi-swagger@17.2.0"},{"type":"library","name":"jquery","version":"3.7.1","purl":"pkg:npm/jquery@3.7.1","licenses":[{"expression":"MIT"}]},{"type":"library","name":"jsxgettext","version":"0.11.0","purl":"pkg:npm/jsxgettext@0.11.0","licenses":[{"expression":"MPL-2.0"}]},{"type":"library","group":"@hapi","name":"cookie","version":"12.0.1","purl":"pkg:npm/%40hapi/cookie@12.0.1","licenses":[{"expression":"BSD-3-Clause"}]},{"type":"library","group":"@postalsys","name":"email-ai-tools","version":"1.8.0","purl":"pkg:npm/%40postalsys/email-ai-tools@1.8.0"},{"type":"library","name":"eslint","version":"8.55.0","purl":"pkg:npm/eslint@8.55.0","licenses":[{"expression":"MIT"}]},{"type":"library","name":"libbase64","version":"1.2.1","purl":"pkg:npm/libbase64@1.2.1","licenses":[{"expression":"MIT"}]},{"type":"library","name":"libmime","version":"5.2.1","purl":"pkg:npm/libmime@5.2.1","licenses":[{"expression":"MIT"}]},{"type":"library","name":"mailparser","version":"3.6.5","purl":"pkg:npm/mailparser@3.6.5","licenses":[{"expression":"MIT"}]},{"type":"library","name":"grunt","version":"1.6.1","purl":"pkg:npm/grunt@1.6.1","licenses":[{"expression":"MIT"}]},{"type":"library","name":"ical.js","version":"1.5.0","purl":"pkg:npm/ical.js@1.5.0","licenses":[{"expression":"MPL-2.0"}]},{"type":"library","name":"ioredfour","version":"1.2.0-ioredis-07","purl":"pkg:npm/ioredfour@1.2.0-ioredis-07","licenses":[{"expression":"MIT"}]},{"type":"library","name":"pino","version":"8.17.1","purl":"pkg:npm/pino@8.17.1"},{"type":"library","name":"speakeasy","version":"2.0.0","purl":"pkg:npm/speakeasy@2.0.0","licenses":[{"expression":"MIT"}]},{"type":"library","group":"@hapi","name":"hapi","version":"21.3.2","purl":"pkg:npm/%40hapi/hapi@21.3.2","licenses":[{"expression":"BSD-3-Clause"}]},{"type":"library","name":"chai","version":"4.3.10","purl":"pkg:npm/chai@4.3.10","licenses":[{"expression":"MIT"}]},{"type":"library","name":"eslint-config-nodemailer","version":"1.2.0","purl":"pkg:npm/eslint-config-nodemailer@1.2.0","licenses":[{"expression":"MIT"}]},{"type":"library","name":"timezones-list","version":"3.0.2","purl":"pkg:npm/timezones-list@3.0.2","licenses":[{"expression":"MIT"}]},{"type":"library","name":"wild-config","version":"1.7.1","purl":"pkg:npm/wild-config@1.7.1","licenses":[{"expression":"MIT"}]},{"type":"library","group":"@phc","name":"pbkdf2","version":"1.1.14","purl":"pkg:npm/%40phc/pbkdf2@1.1.14","licenses":[{"expression":"MIT"}]},{"type":"library","name":"ipaddr.js","version":"2.1.0","purl":"pkg:npm/ipaddr.js@2.1.0","licenses":[{"expression":"MIT"}]},{"type":"library","name":"nanoid","version":"3.3.4","purl":"pkg:npm/nanoid@3.3.4","licenses":[{"expression":"MIT"}]},{"type":"library","name":"hapi-auth-bearer-token","version":"8.0.0","purl":"pkg:npm/hapi-auth-bearer-token@8.0.0","licenses":[{"expression":"MIT"}]},{"type":"library","name":"iconv-lite","version":"0.6.3","purl":"pkg:npm/iconv-lite@0.6.3","licenses":[{"expression":"MIT"}]},{"type":"library","name":"imapflow","version":"1.0.147","purl":"pkg:npm/imapflow@1.0.147","licenses":[{"expression":"MIT"}]},{"type":"library","name":"marked","version":"9.1.6","purl":"pkg:npm/marked@9.1.6","licenses":[{"expression":"MIT"}]},{"type":"library","name":"node-gettext","version":"3.0.0","purl":"pkg:npm/node-gettext@3.0.0","licenses":[{"expression":"MIT"}]},{"type":"library","name":"ace-builds","version":"1.32.2","purl":"pkg:npm/ace-builds@1.32.2"},{"type":"library","name":"compare-versions","version":"6.1.0","purl":"pkg:npm/compare-versions@6.1.0","licenses":[{"expression":"MIT"}]},{"type":"library","name":"gettext-parser","version":"7.0.1","purl":"pkg:npm/gettext-parser@7.0.1","licenses":[{"expression":"MIT"}]},{"type":"library","name":"qrcode","version":"1.5.3","purl":"pkg:npm/qrcode@1.5.3","licenses":[{"expression":"MIT"}]},{"type":"library","name":"exponential-backoff","version":"3.1.1","purl":"pkg:npm/exponential-backoff@3.1.1","licenses":[{"expression":"Apache-2.0"}]},{"type":"library","name":"pkg","version":"5.8.1","purl":"pkg:npm/pkg@5.8.1","licenses":[{"expression":"MIT"}]},{"type":"library","name":"xgettext-template","version":"5.0.0","purl":"pkg:npm/xgettext-template@5.0.0","licenses":[{"expression":"MIT"}]},{"type":"library","name":"xml2js","version":"0.6.2","purl":"pkg:npm/xml2js@0.6.2","licenses":[{"expression":"MIT"}]},{"type":"library","group":"@bugsnag","name":"js","version":"7.22.2","purl":"pkg:npm/%40bugsnag/js@7.22.2"},{"type":"library","group":"@hapi","name":"bell","version":"13.0.1","purl":"pkg:npm/%40hapi/bell@13.0.1","licenses":[{"expression":"BSD-3-Clause"}]},{"type":"library","group":"@postalsys","name":"templates","version":"1.0.7","purl":"pkg:npm/%40postalsys/templates@1.0.7","licenses":[{"expression":"ISC"}]},{"type":"library","name":"murmurhash","version":"2.0.1","purl":"pkg:npm/murmurhash@2.0.1","licenses":[{"expression":"MIT"}]},{"type":"library","name":"prom-client","version":"15.0.0","purl":"pkg:npm/prom-client@15.0.0","licenses":[{"expression":"Apache-2.0"}]},{"type":"library","group":"@hapi","name":"crumb","version":"9.0.1","purl":"pkg:npm/%40hapi/crumb@9.0.1","licenses":[{"expression":"BSD-3-Clause"}]},{"type":"library","name":"eerawlog","version":"1.5.1","purl":"pkg:npm/eerawlog@1.5.1","licenses":[{"expression":"ISC"}]},{"type":"library","name":"msgpack5","version":"6.0.2","purl":"pkg:npm/msgpack5@6.0.2","licenses":[{"expression":"MIT"}]},{"type":"library","name":"base32.js","version":"0.1.0","purl":"pkg:npm/base32.js@0.1.0","licenses":[{"expression":"MIT"}]},{"type":"library","name":"license-checker","version":"25.0.1","purl":"pkg:npm/license-checker@25.0.1","licenses":[{"expression":"BSD-3-Clause"}]},{"type":"library","name":"js-beautify","version":"1.14.11","purl":"pkg:npm/js-beautify@1.14.11","licenses":[{"expression":"MIT"}]},{"type":"library","name":"undici","version":"5.28.2","purl":"pkg:npm/undici@5.28.2","licenses":[{"expression":"MIT"}]},{"type":"library","group":"@hapi","name":"boom","version":"10.0.1","purl":"pkg:npm/%40hapi/boom@10.0.1","licenses":[{"expression":"BSD-3-Clause"}]},{"type":"library","name":"bullmq","version":"4.15.4","purl":"pkg:npm/bullmq@4.15.4"},{"type":"library","name":"humanize","version":"0.0.9","purl":"pkg:npm/humanize@0.0.9","licenses":[{"expression":"MIT"}]},{"type":"library","group":"google-github-actions","name":"release-please-action","version":"3","purl":"pkg:github/google-github-actions/release-please-action@3"},{"type":"library","group":"actions","name":"checkout","version":"4","purl":"pkg:github/actions/checkout@4"},{"type":"library","group":"shimataro","name":"ssh-key-action","version":"2","purl":"pkg:github/shimataro/ssh-key-action@2"},{"type":"library","group":"docker","name":"build-push-action","version":"5","purl":"pkg:github/docker/build-push-action@5"},{"type":"library","group":"docker","name":"login-action","version":"3","purl":"pkg:github/docker/login-action@3"},{"type":"library","group":"docker","name":"setup-buildx-action","version":"3","purl":"pkg:github/docker/setup-buildx-action@3"},{"type":"library","group":"docker","name":"setup-qemu-action","version":"3","purl":"pkg:github/docker/setup-qemu-action@3"},{"type":"library","group":"docker","name":"metadata-action","version":"5","purl":"pkg:github/docker/metadata-action@5"},{"type":"library","group":"actions","name":"setup-node","version":"3","purl":"pkg:github/actions/setup-node@3"},{"type":"library","group":"actions","name":"setup-node","version":"1","purl":"pkg:github/actions/setup-node@1"}]} diff --git a/server.js b/server.js index b7f94a39..64615720 100644 --- a/server.js +++ b/server.js @@ -1873,6 +1873,7 @@ async function onCommand(worker, message) { case 'moveMessages': case 'deleteMessage': case 'deleteMessages': + case 'getQuota': case 'createMailbox': case 'renameMailbox': case 'deleteMailbox': diff --git a/static/licenses.html b/static/licenses.html index 1ecd398e..23c29331 100644 --- a/static/licenses.html +++ b/static/licenses.html @@ -1,6 +1,6 @@ EmailEngine Licenses
-

EmailEngine v2.39.3

EmailEngine includes code from the following software packages:

+

EmailEngine v2.39.4

EmailEngine includes code from the following software packages:

@@ -236,7 +236,7 @@

EmailEngine v2.39.3

EmailEngine includes code from the following soft

- + @@ -1616,7 +1616,7 @@

EmailEngine v2.39.3

EmailEngine includes code from the following soft

- + @@ -2735,7 +2735,7 @@

EmailEngine v2.39.3

EmailEngine includes code from the following soft

- + @@ -3005,7 +3005,7 @@

EmailEngine v2.39.3

EmailEngine includes code from the following soft

- + @@ -6225,7 +6225,7 @@

EmailEngine v2.39.3

EmailEngine includes code from the following soft

- + @@ -6455,7 +6455,7 @@

EmailEngine v2.39.3

EmailEngine includes code from the following soft

- + @@ -6525,7 +6525,7 @@

EmailEngine v2.39.3

EmailEngine includes code from the following soft

- + diff --git a/translations/messages.pot b/translations/messages.pot index a3d7d740..f45004c6 100644 --- a/translations/messages.pot +++ b/translations/messages.pot @@ -1,7 +1,7 @@ msgid "" msgstr "" "Content-Type: text/plain; charset=ascii\n" -"POT-Creation-Date: 2023-12-15 12:45+0000\n" +"POT-Creation-Date: 2023-12-19 11:03+0000\n" #: views/config/license.hbs:48 msgid "%d day" @@ -9,6 +9,10 @@ msgid_plural "%d days" msgstr[0] "" msgstr[1] "" +#: views/redirect.hbs:1 +msgid "Click here to continue…" +msgstr "" + #: views/unsubscribe.hbs:1 #: views/unsubscribe.hbs:79 msgid "Unsubscribe" @@ -53,10 +57,6 @@ msgstr "" msgid "Enter your email address" msgstr "" -#: views/redirect.hbs:1 -msgid "Click here to continue…" -msgstr "" - #: views/accounts/register/imap.hbs:11 msgid "Your name" msgstr "" diff --git a/workers/api.js b/workers/api.js index 11c5743a..b8c5f349 100644 --- a/workers/api.js +++ b/workers/api.js @@ -2872,6 +2872,10 @@ When making API calls remember that requests against the same account are queued result.counters = accountData.counters; } + if (request.query.quota) { + result.quota = await accountObject.getQuota(); + } + return result; } catch (err) { request.logger.error({ msg: 'API request failed', err }); @@ -2906,6 +2910,15 @@ When making API calls remember that requests against the same account are queued params: Joi.object({ account: accountIdSchema.required() + }), + + query: Joi.object({ + quota: Joi.boolean() + .truthy('Y', 'true', '1') + .falsy('N', 'false', 0) + .default(false) + .description('If true, then include quota information in the response') + .label('AccountQuota') }) }, @@ -2957,11 +2970,23 @@ When making API calls remember that requests against the same account are queued .valid(...['imap'].concat(Object.keys(OAUTH_PROVIDERS)).concat('oauth2')) .example('outlook') .description('Account type') + .label('AccountType') .required(), app: Joi.string().max(256).example('AAABhaBPHscAAAAH').description('OAuth2 application ID'), counters: accountCountersSchema, + quota: Joi.object({ + usage: Joi.number().example(8547884032).description('How many bytes has the account stored in emails'), + limit: Joi.number().example(16106127360).description('How many bytes can the account store emails'), + status: Joi.string().example('53%').description('Textual information about the usage') + }) + .label('AccountQuota') + .allow(false) + .description( + 'Account quota information if query argument quota=true. This value will be false if the server does not provide quota information.' + ), + syncTime: Joi.date().iso().example('2021-02-17T13:43:18.860Z').description('Last sync time'), lastError: lastErrorSchema.allow(null) diff --git a/workers/imap.js b/workers/imap.js index ead67f5c..43e96174 100644 --- a/workers/imap.js +++ b/workers/imap.js @@ -439,6 +439,19 @@ class ConnectionHandler { return await accountData.connection.uploadMessage(message.data); } + async getQuota(message) { + if (!this.accounts.has(message.account)) { + return NO_ACTIVE_HANDLER_RESP; + } + + let accountData = this.accounts.get(message.account); + if (!accountData.connection) { + return NO_ACTIVE_HANDLER_RESP; + } + + return await accountData.connection.getQuota(); + } + async createMailbox(message) { if (!this.accounts.has(message.account)) { return NO_ACTIVE_HANDLER_RESP; @@ -607,6 +620,7 @@ class ConnectionHandler { case 'deleteMessage': case 'deleteMessages': case 'getRawMessage': + case 'getQuota': case 'createMailbox': case 'renameMailbox': case 'deleteMailbox':
PackageVersionLicensePublisherPublisher's EmailPackage URL
@eslint/js8.55.08.56.0 MIT
bullmq4.15.44.16.0 MIT Taskforce.sh Inc.
eslint8.55.08.56.0 MIT Nicholas C. Zakas nicholas+npm@nczconsulting.com
fastq1.15.01.16.0 ISC Matteo Collina hello@matteocollina.com
prom-client15.0.015.1.0 Apache-2.0 Simon Nyberg
readable-stream4.4.24.5.1 MIT
regenerator-runtime0.14.00.14.1 MIT Ben Newman bn@cs.stanford.edu