emailengine-app 2.83.0 → 2.83.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.release-please-manifest.json +1 -1
- package/CHANGELOG.md +21 -0
- package/data/google-crawlers.json +1 -1
- package/gettext-extract.js +95 -15
- package/lib/api-reference/format.js +1 -1
- package/lib/api-routes/export-routes.js +5 -5
- package/lib/api-routes/oauth2-app-routes.js +4 -1
- package/lib/api-routes/route-helpers.js +11 -5
- package/lib/consts.js +3 -1
- package/lib/email-client/base-client.js +44 -20
- package/lib/email-client/credential-errors.js +3 -31
- package/lib/email-client/smtp-pool-manager.js +25 -6
- package/lib/export.js +44 -36
- package/lib/imapproxy/imap-core/lib/commands/starttls.js +4 -2
- package/lib/imapproxy/imap-core/lib/imap-server.js +44 -11
- package/lib/imapproxy/proxy-handoff.js +10 -1
- package/lib/logger.js +3 -2
- package/lib/message-port-stream.js +23 -0
- package/lib/network-errors.js +50 -0
- package/lib/oauth/gcp-metadata.js +50 -13
- package/lib/oauth/gmail.js +17 -7
- package/lib/oauth/mail-ru.js +5 -1
- package/lib/oauth/outlook.js +5 -1
- package/lib/oauth/pubsub/google.js +3 -2
- package/lib/oauth/token-fetch.js +2 -3
- package/lib/oauth/verify-app.js +8 -2
- package/lib/oauth2-apps.js +26 -6
- package/lib/sub-script.js +10 -3
- package/lib/swagger-options.js +2 -3
- package/lib/tools.js +16 -2
- package/lib/ui-routes/oauth-config-routes.js +14 -15
- package/lib/ui-routes/oauth-form-context.js +19 -0
- package/package.json +10 -10
- package/sbom.json +1 -1
- package/static/css/flyonui.css +1 -1
- package/static/licenses.html +12 -12
- package/translations/README.md +3 -2
- package/translations/messages.pot +257 -257
- package/views/accounts/account.hbs +0 -5
- package/views/config/oauth/edit.hbs +0 -10
- package/views/config/oauth/new.hbs +0 -10
- package/views/partials/oauth_form.hbs +426 -928
- package/views/partials/oauth_graph_endpoints.hbs +12 -0
- package/views/partials/oauth_pubsub_app_select.hbs +11 -20
- package/views/partials/oauth_scope_presets.hbs +21 -0
- package/views/partials/ui/choice-tab.hbs +23 -0
- package/views/partials/ui/choice-tabs.hbs +32 -0
- package/views/partials/ui/radio.hbs +2 -2
- package/views/partials/ui/secret-field.hbs +2 -1
- package/views/partials/ui/tabs.hbs +1 -2
- package/workers/imap.js +10 -3
- package/workers/smtp.js +16 -1
package/lib/tools.js
CHANGED
|
@@ -464,12 +464,26 @@ class LRUCache extends Map {
|
|
|
464
464
|
this.maxSize = maxSize;
|
|
465
465
|
}
|
|
466
466
|
|
|
467
|
+
// A hit moves the entry to the end of the insertion order, so eviction takes the least
|
|
468
|
+
// recently used entry rather than the oldest one
|
|
469
|
+
get(key) {
|
|
470
|
+
if (!super.has(key)) {
|
|
471
|
+
return undefined;
|
|
472
|
+
}
|
|
473
|
+
const value = super.get(key);
|
|
474
|
+
super.delete(key);
|
|
475
|
+
super.set(key, value);
|
|
476
|
+
return value;
|
|
477
|
+
}
|
|
478
|
+
|
|
467
479
|
set(key, value) {
|
|
468
|
-
if (
|
|
480
|
+
if (super.has(key)) {
|
|
481
|
+
super.delete(key);
|
|
482
|
+
} else if (this.size >= this.maxSize) {
|
|
469
483
|
const firstKey = this.keys().next().value;
|
|
470
484
|
this.delete(firstKey);
|
|
471
485
|
}
|
|
472
|
-
super.set(key, value);
|
|
486
|
+
return super.set(key, value);
|
|
473
487
|
}
|
|
474
488
|
}
|
|
475
489
|
|
|
@@ -21,6 +21,7 @@ const { authMethodContext, gmailServiceAuthRoutes } = require('./gmail-service-a
|
|
|
21
21
|
const { isSendOnlyGmailApp } = require('../oauth/scope-checker');
|
|
22
22
|
const { oauthCreateSchema, oauthUpdateSchema, accountIdSchema, formBoolean } = require('../schemas');
|
|
23
23
|
const { throwAsBoom, adminUrl, submittedValues, windowedPageLinks } = require('./route-helpers');
|
|
24
|
+
const { baseScopesContext } = require('./oauth-form-context');
|
|
24
25
|
|
|
25
26
|
const { DEFAULT_PAGE_SIZE } = consts;
|
|
26
27
|
|
|
@@ -88,9 +89,7 @@ function init(args) {
|
|
|
88
89
|
|
|
89
90
|
pubSubApps: await getPubSubAppsForSelect(payload.pubSubApp),
|
|
90
91
|
|
|
91
|
-
|
|
92
|
-
baseScopesImap: payload.baseScopes === 'imap' || !payload.baseScopes,
|
|
93
|
-
baseScopesPubsub: payload.baseScopes === 'pubsub',
|
|
92
|
+
...baseScopesContext(payload.baseScopes),
|
|
94
93
|
|
|
95
94
|
azureClouds: structuredClone(AZURE_CLOUDS).map(entry => {
|
|
96
95
|
entry.selected = payload.cloud === entry.id;
|
|
@@ -453,9 +452,7 @@ function init(args) {
|
|
|
453
452
|
|
|
454
453
|
app,
|
|
455
454
|
|
|
456
|
-
|
|
457
|
-
baseScopesImap: app.baseScopes === 'imap' || !app.baseScopes,
|
|
458
|
-
baseScopesPubsub: app.baseScopes === 'pubsub',
|
|
455
|
+
...baseScopesContext(app.baseScopes),
|
|
459
456
|
|
|
460
457
|
appShowAuthMethod: app.provider === 'gmailService',
|
|
461
458
|
...authMethodContext(app.authMethod),
|
|
@@ -653,9 +650,13 @@ function init(args) {
|
|
|
653
650
|
method: 'GET',
|
|
654
651
|
path: '/admin/config/oauth/new',
|
|
655
652
|
async handler(request, h) {
|
|
656
|
-
let { provider } = request.query;
|
|
653
|
+
let { provider, baseScopes } = request.query;
|
|
657
654
|
let providerData = oauth2ProviderData(provider);
|
|
658
655
|
|
|
656
|
+
// A Pub/Sub app is a gmailService app with the pubsub base scope, and the Gmail API forms link
|
|
657
|
+
// here to create one, preselected. Any other provider keeps the IMAP default
|
|
658
|
+
let preselectPubsub = provider === 'gmailService' && baseScopes === 'pubsub';
|
|
659
|
+
|
|
659
660
|
let serviceUrl = await settings.get('serviceUrl');
|
|
660
661
|
let defaultRedirectUrl = `${serviceUrl}/oauth`;
|
|
661
662
|
if (provider === 'outlook') {
|
|
@@ -674,9 +675,7 @@ function init(args) {
|
|
|
674
675
|
providerData,
|
|
675
676
|
defaultRedirectUrl,
|
|
676
677
|
|
|
677
|
-
|
|
678
|
-
baseScopesApi: false,
|
|
679
|
-
baseScopesPubsub: false,
|
|
678
|
+
...baseScopesContext(preselectPubsub ? 'pubsub' : 'imap'),
|
|
680
679
|
|
|
681
680
|
...authMethodContext('serviceKey'),
|
|
682
681
|
|
|
@@ -692,7 +691,8 @@ function init(args) {
|
|
|
692
691
|
values: {
|
|
693
692
|
provider,
|
|
694
693
|
redirectUrl: defaultRedirectUrl,
|
|
695
|
-
authMethod: 'serviceKey'
|
|
694
|
+
authMethod: 'serviceKey',
|
|
695
|
+
enabled: true
|
|
696
696
|
},
|
|
697
697
|
|
|
698
698
|
authorityCommon: true
|
|
@@ -720,7 +720,8 @@ function init(args) {
|
|
|
720
720
|
.empty('')
|
|
721
721
|
.valid(...Object.keys(OAUTH_PROVIDERS))
|
|
722
722
|
.label('Provider')
|
|
723
|
-
.required()
|
|
723
|
+
.required(),
|
|
724
|
+
baseScopes: Joi.string().empty('').valid('pubsub').label('Base scopes')
|
|
724
725
|
})
|
|
725
726
|
}
|
|
726
727
|
}
|
|
@@ -854,9 +855,7 @@ function init(args) {
|
|
|
854
855
|
|
|
855
856
|
values,
|
|
856
857
|
|
|
857
|
-
|
|
858
|
-
baseScopesImap: values.baseScopes === 'imap' || !values.baseScopes,
|
|
859
|
-
baseScopesPubsub: values.baseScopes === 'pubsub',
|
|
858
|
+
...baseScopesContext(values.baseScopes),
|
|
860
859
|
|
|
861
860
|
azureClouds: structuredClone(AZURE_CLOUDS).map(entry => {
|
|
862
861
|
entry.selected = values.cloud === entry.id;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Render-context booleans for the OAuth2 app form's base scope radios and the sections they reveal,
|
|
5
|
+
* shared by the create, edit and app pages and their validation re-renders. A missing scope is an
|
|
6
|
+
* app stored before base scopes existed, which used IMAP and SMTP.
|
|
7
|
+
*
|
|
8
|
+
* @param {string} [baseScopes] - 'imap', 'api' or 'pubsub'
|
|
9
|
+
* @returns {{baseScopesApi: boolean, baseScopesImap: boolean, baseScopesPubsub: boolean}}
|
|
10
|
+
*/
|
|
11
|
+
function baseScopesContext(baseScopes) {
|
|
12
|
+
return {
|
|
13
|
+
baseScopesApi: baseScopes === 'api',
|
|
14
|
+
baseScopesImap: baseScopes === 'imap' || !baseScopes,
|
|
15
|
+
baseScopesPubsub: baseScopes === 'pubsub'
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
module.exports = { baseScopesContext };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "emailengine-app",
|
|
3
|
-
"version": "2.83.
|
|
3
|
+
"version": "2.83.2",
|
|
4
4
|
"private": false,
|
|
5
5
|
"productTitle": "EmailEngine",
|
|
6
6
|
"description": "Email Sync Engine",
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
"build-dist": "pkg --compress Brotli package.json && npm install && node winconf.js",
|
|
27
27
|
"build-dist-fast": "pkg --debug package.json && npm install && node winconf.js",
|
|
28
28
|
"licenses": "node list-generate.js",
|
|
29
|
-
"gettext": "find ./views -name \"*.hbs\" -print0 | xargs -0 xgettext-template -L Handlebars --force-po -o - > translations/messages.pot.tmp &&
|
|
29
|
+
"gettext": "find ./views -name \"*.hbs\" -print0 | xargs -0 xgettext-template -L Handlebars --force-po -o - > translations/messages.pot.tmp && node gettext-extract.js",
|
|
30
30
|
"update": "rm -rf node_modules package-lock.json && ncu -u && npm install && ./copy-static-files.sh && npm run licenses && npm run gettext",
|
|
31
31
|
"test-gmail-api": "node lib/email-client/gmail-client.js --dbs.redis=redis://127.0.0.1/11",
|
|
32
32
|
"format": "prettier --write 'lib/**/*.js' 'workers/**/*.js' 'test/**/*.js' '*.js'",
|
|
@@ -70,13 +70,13 @@
|
|
|
70
70
|
"@postalsys/gettext": "4.1.1",
|
|
71
71
|
"@postalsys/joi-messages": "1.3.1",
|
|
72
72
|
"@postalsys/templates": "2.0.4",
|
|
73
|
-
"@sentry/node-core": "10.76.
|
|
73
|
+
"@sentry/node-core": "10.76.2",
|
|
74
74
|
"@simplewebauthn/server": "14.0.3",
|
|
75
75
|
"@zone-eu/mailsplit": "5.4.20",
|
|
76
76
|
"@zone-eu/wild-config": "1.7.7",
|
|
77
|
-
"bullmq": "6.3.
|
|
77
|
+
"bullmq": "6.3.12",
|
|
78
78
|
"compare-versions": "6.1.1",
|
|
79
|
-
"dotenv": "18.0.
|
|
79
|
+
"dotenv": "18.0.7",
|
|
80
80
|
"encoding-japanese": "2.4.0",
|
|
81
81
|
"exponential-backoff": "3.1.3",
|
|
82
82
|
"fast-xml-parser": "5.11.2",
|
|
@@ -87,7 +87,7 @@
|
|
|
87
87
|
"html-to-text": "10.0.1",
|
|
88
88
|
"ical.js": "2.2.1",
|
|
89
89
|
"iconv-lite": "0.7.3",
|
|
90
|
-
"imapflow": "2.
|
|
90
|
+
"imapflow": "2.4.0",
|
|
91
91
|
"ioredfour": "1.4.4",
|
|
92
92
|
"ioredis": "6.0.0",
|
|
93
93
|
"ipaddr.js": "2.5.0",
|
|
@@ -95,19 +95,19 @@
|
|
|
95
95
|
"libbase64": "1.3.2",
|
|
96
96
|
"libmime": "5.4.7",
|
|
97
97
|
"libqp": "2.1.2",
|
|
98
|
-
"mailparser": "3.9.
|
|
98
|
+
"mailparser": "3.9.38",
|
|
99
99
|
"marked": "15.0.12",
|
|
100
100
|
"minimist": "1.2.8",
|
|
101
101
|
"murmurhash": "2.0.1",
|
|
102
102
|
"nanoid": "3.3.20",
|
|
103
|
-
"nodemailer": "10.0
|
|
103
|
+
"nodemailer": "10.1.0",
|
|
104
104
|
"pino": "10.3.1",
|
|
105
105
|
"prom-client": "15.1.3",
|
|
106
106
|
"psl": "1.15.0",
|
|
107
107
|
"pubface": "1.1.18",
|
|
108
108
|
"punycode.js": "2.3.1",
|
|
109
109
|
"qrcode-generator": "2.0.4",
|
|
110
|
-
"smtp-server": "3.19.
|
|
110
|
+
"smtp-server": "3.19.21",
|
|
111
111
|
"socks": "2.8.10",
|
|
112
112
|
"timezones-list": "3.1.0",
|
|
113
113
|
"undici": "7.30.0"
|
|
@@ -128,7 +128,7 @@
|
|
|
128
128
|
"eslint": "10.12.0",
|
|
129
129
|
"flyonui": "2.4.1",
|
|
130
130
|
"pino-pretty": "13.2.0",
|
|
131
|
-
"prettier": "3.9.
|
|
131
|
+
"prettier": "3.9.10",
|
|
132
132
|
"resedit": "3.1.0",
|
|
133
133
|
"spdx-satisfies": "6.0.0",
|
|
134
134
|
"supertest": "7.3.1",
|