emailengine-app 2.88.0 → 2.89.0
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/.ncurc.js +24 -44
- package/.release-please-manifest.json +1 -1
- package/CHANGELOG.md +14 -0
- package/data/google-crawlers.json +1 -1
- package/data/public_suffix_list.dat +109 -8
- package/lib/license-subscription.js +17 -11
- package/lib/node-version.js +99 -12
- package/lib/settings.js +4 -1
- package/lib/tools.js +5 -4
- package/lib/ui-routes/dashboard-routes.js +4 -0
- package/lib/web-safe-html.js +50 -6
- package/list-generate.js +56 -19
- package/package.json +22 -25
- package/sbom.json +246 -837
- package/server.js +31 -31
- package/static/licenses.html +1095 -491
- package/translations/messages.pot +18 -18
- package/views/dashboard.hbs +9 -0
- package/views/upgrade.hbs +25 -0
- package/lib/net-tos-guard.js +0 -42
package/server.js
CHANGED
|
@@ -50,28 +50,24 @@ try {
|
|
|
50
50
|
process.exit(1);
|
|
51
51
|
}
|
|
52
52
|
|
|
53
|
-
//
|
|
54
|
-
//
|
|
55
|
-
//
|
|
56
|
-
|
|
57
|
-
|
|
53
|
+
// Checked before anything else is required. Below MIN_NODE undici, which every thread loads at
|
|
54
|
+
// startup, throws when it is loaded, so an older runtime gets this message and the commands to fix it
|
|
55
|
+
// instead of a TypeError from inside a dependency. A one-click DigitalOcean droplet upgrades
|
|
56
|
+
// EmailEngine on its own but not the Node.js it runs on, and that log line is all its operator sees.
|
|
57
|
+
// A release that starts but is outside the supported range is only warned about here and on the
|
|
58
|
+
// dashboard (see lib/node-version.js for the two thresholds).
|
|
59
|
+
const { MIN_NODE, SUPPORTED_RANGE_LABEL, nodeSupport, nodeUpgradeHint } = require('./lib/node-version');
|
|
60
|
+
const nodeSupportLevel = nodeSupport(process.versions.node);
|
|
61
|
+
if (nodeSupportLevel === 'unsupported') {
|
|
62
|
+
console.error(`EmailEngine requires Node.js ${MIN_NODE} or newer, this is Node.js ${process.version}.\n\n${nodeUpgradeHint()}`);
|
|
58
63
|
process.exit(1);
|
|
59
64
|
}
|
|
65
|
+
if (nodeSupportLevel === 'outside-range') {
|
|
66
|
+
console.error(`Node.js ${process.version} is outside the range EmailEngine supports (${SUPPORTED_RANGE_LABEL}). It runs, but please upgrade Node.js.`);
|
|
67
|
+
}
|
|
60
68
|
|
|
61
|
-
// Within Node 20 the dependency tree itself asks for 20.19.0 (html-to-text 10, the entities release
|
|
62
|
-
// node-html-parser pulls in) or 20.18.1 (undici 7), which is what the engines field declares. npm
|
|
63
|
-
// treats that field as advice, and an older 20.x starts and then fails somewhere in a dependency at
|
|
64
|
-
// runtime, so it is named here. Only a warning: one-click DigitalOcean images upgrade EmailEngine on
|
|
65
|
-
// their own but not the Node they run on, and an instance that works today must not stop at its next
|
|
66
|
-
// self-upgrade over a minor version it may never exercise.
|
|
67
69
|
const { accountDataKey } = require('./lib/redis-keys');
|
|
68
70
|
const { importPreparedPassword } = require('./lib/prepared-password');
|
|
69
|
-
const { MIN_SUPPORTED_NODE, isBelowSupportedNode } = require('./lib/node-version');
|
|
70
|
-
if (isBelowSupportedNode(process.versions.node)) {
|
|
71
|
-
console.error(
|
|
72
|
-
`Node.js version ${process.version} is older than ${MIN_SUPPORTED_NODE}, the oldest release EmailEngine's dependencies support. Some features may fail at runtime. Please upgrade Node.js.`
|
|
73
|
-
);
|
|
74
|
-
}
|
|
75
71
|
|
|
76
72
|
const os = require('os');
|
|
77
73
|
|
|
@@ -170,7 +166,8 @@ const {
|
|
|
170
166
|
checkInterval,
|
|
171
167
|
subscriptionView,
|
|
172
168
|
parseSuspension,
|
|
173
|
-
isSubscriptionLicense
|
|
169
|
+
isSubscriptionLicense,
|
|
170
|
+
toTime
|
|
174
171
|
} = require('./lib/license-subscription');
|
|
175
172
|
const tokens = require('./lib/tokens');
|
|
176
173
|
|
|
@@ -2188,6 +2185,18 @@ const setSuspension = suspension => {
|
|
|
2188
2185
|
}
|
|
2189
2186
|
};
|
|
2190
2187
|
|
|
2188
|
+
/**
|
|
2189
|
+
* Forgets the registered license in this thread, after settings.removeLicense()
|
|
2190
|
+
* @returns {void}
|
|
2191
|
+
*/
|
|
2192
|
+
const clearLicenseInfo = () => {
|
|
2193
|
+
licenseInfo.active = false;
|
|
2194
|
+
licenseInfo.details = false;
|
|
2195
|
+
delete licenseInfo.suspension;
|
|
2196
|
+
subscriptionDeadline = null;
|
|
2197
|
+
licenseInfo.type = packageData.license;
|
|
2198
|
+
};
|
|
2199
|
+
|
|
2191
2200
|
/**
|
|
2192
2201
|
* Applies one decision of lib/license-subscription.js to the stored state and to licenseInfo
|
|
2193
2202
|
* @param {Object} decision - decide() output
|
|
@@ -2201,11 +2210,7 @@ const applySubscriptionDecision = async (decision, data) => {
|
|
|
2201
2210
|
// what a license server that names no deadline and does not ask to keep the key gets
|
|
2202
2211
|
logger.warn({ msg: 'License validation failed', license: redactLicense(licenseInfo.details), data });
|
|
2203
2212
|
await settings.removeLicense();
|
|
2204
|
-
|
|
2205
|
-
licenseInfo.active = false;
|
|
2206
|
-
licenseInfo.details = false;
|
|
2207
|
-
delete licenseInfo.suspension;
|
|
2208
|
-
licenseInfo.type = packageData.license;
|
|
2213
|
+
clearLicenseInfo();
|
|
2209
2214
|
return;
|
|
2210
2215
|
}
|
|
2211
2216
|
|
|
@@ -2314,7 +2319,6 @@ let licenseCheckHandler = async opts => {
|
|
|
2314
2319
|
let localSuspension = subscriptionLicense && !licenseInfo.suspension ? expiredSuspension(subexp, subsusp, now) : null;
|
|
2315
2320
|
if (localSuspension) {
|
|
2316
2321
|
await redis.hset(`${REDIS_PREFIX}settings`, 'subsusp', JSON.stringify(localSuspension));
|
|
2317
|
-
subsusp = JSON.stringify(localSuspension);
|
|
2318
2322
|
logger.warn({
|
|
2319
2323
|
msg: 'Subscription deadline passed, suspending until the license server says otherwise',
|
|
2320
2324
|
license: redactLicense(licenseInfo.details)
|
|
@@ -2942,7 +2946,7 @@ async function commandUpdateLicense(worker, message) {
|
|
|
2942
2946
|
// the workers start, and the answer decides
|
|
2943
2947
|
let subscriptionLicense = isSubscriptionLicense(licenseData);
|
|
2944
2948
|
let [subexp, subsusp] = await redis.hmget(`${REDIS_PREFIX}settings`, 'subexp', 'subsusp');
|
|
2945
|
-
subscriptionDeadline = subscriptionLicense
|
|
2949
|
+
subscriptionDeadline = subscriptionLicense ? toTime(subexp) : null;
|
|
2946
2950
|
setSuspension(subscriptionLicense ? parseSuspension(subsusp) : null);
|
|
2947
2951
|
|
|
2948
2952
|
if (!subscriptionLicense || (await licenseCheckHandler({ force: true })).outcome === 'busy') {
|
|
@@ -2963,11 +2967,7 @@ async function commandRemoveLicense() {
|
|
|
2963
2967
|
try {
|
|
2964
2968
|
await settings.removeLicense();
|
|
2965
2969
|
|
|
2966
|
-
|
|
2967
|
-
licenseInfo.details = false;
|
|
2968
|
-
delete licenseInfo.suspension;
|
|
2969
|
-
subscriptionDeadline = null;
|
|
2970
|
-
licenseInfo.type = packageData.license;
|
|
2970
|
+
clearLicenseInfo();
|
|
2971
2971
|
notifyApiLicenseState();
|
|
2972
2972
|
|
|
2973
2973
|
return licenseInfo;
|
|
@@ -3667,7 +3667,7 @@ const loadStoredLicense = async () => {
|
|
|
3667
3667
|
*/
|
|
3668
3668
|
const applyStartupSubscriptionState = async () => {
|
|
3669
3669
|
let [subexp, subsusp, subcheck] = await redis.hmget(`${REDIS_PREFIX}settings`, 'subexp', 'subsusp', 'subcheck');
|
|
3670
|
-
subscriptionDeadline =
|
|
3670
|
+
subscriptionDeadline = toTime(subexp);
|
|
3671
3671
|
let plan = startupPlan({ details: licenseInfo.active && licenseInfo.details, subexp, subsusp, subcheck, now: Date.now() });
|
|
3672
3672
|
|
|
3673
3673
|
if (plan.suspension) {
|