@7365admin1/core 3.106.0 → 3.107.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/CHANGELOG.md +6 -0
- package/dist/index.d.ts +21 -6
- package/dist/index.js +22 -4
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +20 -4
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/test/e2e/invite-roles-owner-reach.e2e.test.mjs +73 -0
- package/test/notification-email.util.test.mjs +67 -0
package/dist/index.mjs
CHANGED
|
@@ -9358,11 +9358,25 @@ var EMAIL_CODE_RESEND_MS = 60 * 1e3;
|
|
|
9358
9358
|
function normalizeEmail(value) {
|
|
9359
9359
|
return String(value ?? "").trim().toLowerCase();
|
|
9360
9360
|
}
|
|
9361
|
-
function
|
|
9361
|
+
function isProductionWebBase(base = webBase()) {
|
|
9362
|
+
let host = "";
|
|
9363
|
+
try {
|
|
9364
|
+
host = new URL(base).hostname.toLowerCase();
|
|
9365
|
+
} catch {
|
|
9366
|
+
return false;
|
|
9367
|
+
}
|
|
9368
|
+
return host === "iservice365.org" || host.endsWith(".iservice365.org");
|
|
9369
|
+
}
|
|
9370
|
+
function effectiveEmailAllowlist(list = process.env.EMAIL_NOTIFICATIONS_ALLOWLIST, base = webBase()) {
|
|
9371
|
+
if (list !== void 0 && list.trim() !== "")
|
|
9372
|
+
return list;
|
|
9373
|
+
return isProductionWebBase(base) ? "*" : DEFAULT_EMAIL_ALLOWLIST;
|
|
9374
|
+
}
|
|
9375
|
+
function isEmailAllowed(address, list = process.env.EMAIL_NOTIFICATIONS_ALLOWLIST, base = webBase()) {
|
|
9362
9376
|
const email = normalizeEmail(address);
|
|
9363
9377
|
if (!email || !email.includes("@"))
|
|
9364
9378
|
return false;
|
|
9365
|
-
const raw = list
|
|
9379
|
+
const raw = effectiveEmailAllowlist(list, base);
|
|
9366
9380
|
const domain = email.slice(email.lastIndexOf("@") + 1);
|
|
9367
9381
|
return raw.split(/[\s,]+/).map((e) => e.trim().toLowerCase()).filter(Boolean).some((entry) => {
|
|
9368
9382
|
if (entry === "*")
|
|
@@ -9374,8 +9388,8 @@ function isEmailAllowed(address, list = process.env.EMAIL_NOTIFICATIONS_ALLOWLIS
|
|
|
9374
9388
|
return email === entry;
|
|
9375
9389
|
});
|
|
9376
9390
|
}
|
|
9377
|
-
function emailOpenToEveryone(list = process.env.EMAIL_NOTIFICATIONS_ALLOWLIST) {
|
|
9378
|
-
return
|
|
9391
|
+
function emailOpenToEveryone(list = process.env.EMAIL_NOTIFICATIONS_ALLOWLIST, base = webBase()) {
|
|
9392
|
+
return effectiveEmailAllowlist(list, base).split(/[\s,]+/).some((e) => e.trim() === "*");
|
|
9379
9393
|
}
|
|
9380
9394
|
function newSecret() {
|
|
9381
9395
|
return crypto2.randomBytes(32).toString("hex");
|
|
@@ -101129,6 +101143,7 @@ export {
|
|
|
101129
101143
|
deviceProbeTtlSeconds,
|
|
101130
101144
|
disconnectedState,
|
|
101131
101145
|
doorModeOf,
|
|
101146
|
+
effectiveEmailAllowlist,
|
|
101132
101147
|
emailOpenToEveryone,
|
|
101133
101148
|
emitNotificationCreated,
|
|
101134
101149
|
emptyPersonalEmergencyChain,
|
|
@@ -101185,6 +101200,7 @@ export {
|
|
|
101185
101200
|
isLiveVehicleStatus,
|
|
101186
101201
|
isPatrolCctvCamera,
|
|
101187
101202
|
isPlatformOwner,
|
|
101203
|
+
isProductionWebBase,
|
|
101188
101204
|
isPromoCodeExpired,
|
|
101189
101205
|
isRelayPlayerUrl,
|
|
101190
101206
|
isSafeRelativePath,
|