mirror of
https://github.com/dawidd6/action-send-mail.git
synced 2026-10-12 02:42:27 +07:00
node_modules: update (#344)
Co-authored-by: dawidd6 <9713907+dawidd6@users.noreply.github.com>
This commit is contained in:
1 parent
b099186883
commit
6e88c72525
63 files changed
+2863
-1227
No files matched your search
+12
-9
@@ -50,10 +50,12 @@ const index_js_7 = __importDefault(require("./ses-transport/index.js"));
|
||||
const errors = __importStar(require("./errors.js"));
|
||||
const index_js_8 = __importDefault(require("./fetch/index.js"));
|
||||
const packageData = __importStar(require("./package-info.js"));
|
||||
const ETHEREAL_API = (process.env.ETHEREAL_API || 'https://api.nodemailer.com').replace(/\/+$/, '');
|
||||
const ETHEREAL_WEB = (process.env.ETHEREAL_WEB || 'https://ethereal.email').replace(/\/+$/, '');
|
||||
const ETHEREAL_API_KEY = (process.env.ETHEREAL_API_KEY || '').replace(/\s*/g, '') || null;
|
||||
const ETHEREAL_CACHE = ['true', 'yes', 'y', '1'].includes((process.env.ETHEREAL_CACHE || 'yes').toString().trim().toLowerCase());
|
||||
// Read on use rather than at load, so that importing the module does not touch the
|
||||
// environment (Deno refuses that without --allow-env, even for apps that never use Ethereal)
|
||||
const etherealApi = () => (process.env.ETHEREAL_API || 'https://api.nodemailer.com').replace(/\/+$/, '');
|
||||
const etherealWeb = () => (process.env.ETHEREAL_WEB || 'https://ethereal.email').replace(/\/+$/, '');
|
||||
const etherealApiKey = () => (process.env.ETHEREAL_API_KEY || '').replace(/\s*/g, '') || null;
|
||||
const etherealCache = () => ['true', 'yes', 'y', '1'].includes((process.env.ETHEREAL_CACHE || 'yes').toString().trim().toLowerCase());
|
||||
let testAccount = false;
|
||||
function createTransport(transporter, defaults) {
|
||||
let options;
|
||||
@@ -114,11 +116,11 @@ function createTestAccount(apiUrl, callback) {
|
||||
});
|
||||
}
|
||||
const done = callback;
|
||||
if (ETHEREAL_CACHE && testAccount) {
|
||||
if (etherealCache() && testAccount) {
|
||||
setImmediate(() => done(null, testAccount));
|
||||
return promise;
|
||||
}
|
||||
apiUrl = apiUrl || ETHEREAL_API;
|
||||
apiUrl = apiUrl || etherealApi();
|
||||
const chunks = [];
|
||||
let chunklen = 0;
|
||||
const requestHeaders = {};
|
||||
@@ -126,8 +128,9 @@ function createTestAccount(apiUrl, callback) {
|
||||
requestor: packageData.name,
|
||||
version: packageData.version
|
||||
};
|
||||
if (ETHEREAL_API_KEY) {
|
||||
requestHeaders.Authorization = 'Bearer ' + ETHEREAL_API_KEY;
|
||||
const apiKey = etherealApiKey();
|
||||
if (apiKey) {
|
||||
requestHeaders.Authorization = 'Bearer ' + apiKey;
|
||||
}
|
||||
const fetchOptions = {
|
||||
contentType: 'application/json',
|
||||
@@ -195,7 +198,7 @@ function getTestMessageUrl(info) {
|
||||
}
|
||||
}
|
||||
if (infoProps.has('STATUS') && infoProps.has('MSGID')) {
|
||||
return ((testAccount && testAccount.web) || ETHEREAL_WEB) + '/message/' + infoProps.get('MSGID');
|
||||
return ((testAccount && testAccount.web) || etherealWeb()) + '/message/' + infoProps.get('MSGID');
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user