From 51d697efe65673093f77e91e7ce9fd04af3c63a2 Mon Sep 17 00:00:00 2001 From: Vladimir Voronkov Date: Tue, 18 Nov 2025 11:16:55 +0200 Subject: [PATCH 01/15] Adjust mail service availability method to new grc call --- workers/loc.api/has.grc.service/index.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/workers/loc.api/has.grc.service/index.js b/workers/loc.api/has.grc.service/index.js index 65459346..1f3dad77 100644 --- a/workers/loc.api/has.grc.service/index.js +++ b/workers/loc.api/has.grc.service/index.js @@ -29,15 +29,15 @@ class HasGrcService { } } - async hasS3AndSendgrid () { + async hasS3AndMailServices () { const countS3Services = await this.lookUpFunction( 'rest:ext:s3' ) - const countSendgridServices = await this.lookUpFunction( - 'rest:ext:sendgrid' + const countMailServices = await this.lookUpFunction( + 'rest:core:mail' ) - return !!(countS3Services && countSendgridServices) + return !!(countS3Services && countMailServices) } async hasGPGService () { From 0f9dfc6c993c70f9d9395bc9bb8cec5dbf9137a2 Mon Sep 17 00:00:00 2001 From: Vladimir Voronkov Date: Tue, 18 Nov 2025 11:20:13 +0200 Subject: [PATCH 02/15] Use new mail service availability method --- workers/loc.api/generate-report-file/index.js | 2 +- workers/loc.api/queue/aggregator.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/workers/loc.api/generate-report-file/index.js b/workers/loc.api/generate-report-file/index.js index 3952cc55..1625ef8e 100644 --- a/workers/loc.api/generate-report-file/index.js +++ b/workers/loc.api/generate-report-file/index.js @@ -50,7 +50,7 @@ const _getReportFileStoreStatus = async ({ } } - if (!await hasGrcService.hasS3AndSendgrid()) { + if (!await hasGrcService.hasS3AndMailServices()) { throw new EmailSendingError() } if ( diff --git a/workers/loc.api/queue/aggregator.js b/workers/loc.api/queue/aggregator.js index 46a893f5..d06c9123 100644 --- a/workers/loc.api/queue/aggregator.js +++ b/workers/loc.api/queue/aggregator.js @@ -35,7 +35,7 @@ module.exports = ( const isEnableToSendEmail = ( typeof email === 'string' && - await hasGrcService.hasS3AndSendgrid() + await hasGrcService.hasS3AndMailServices() ) const newFilePaths = [] From db4e36ba2e92574814dec4fde388df521fca034c Mon Sep 17 00:00:00 2001 From: Vladimir Voronkov Date: Wed, 19 Nov 2025 13:29:52 +0200 Subject: [PATCH 03/15] Send mail using rest:core:mail service --- workers/loc.api/queue/send-mail/index.js | 82 +++++------------------- 1 file changed, 16 insertions(+), 66 deletions(-) diff --git a/workers/loc.api/queue/send-mail/index.js b/workers/loc.api/queue/send-mail/index.js index 1dfadd91..0d71b1b8 100644 --- a/workers/loc.api/queue/send-mail/index.js +++ b/workers/loc.api/queue/send-mail/index.js @@ -1,83 +1,33 @@ 'use strict' -const path = require('path') -const pug = require('pug') - -const getTranslator = require('../../helpers/get-translator') -const TRANSLATION_NAMESPACES = require( - '../../i18next/translation.namespaces' -) - -const basePathToViews = path.join(__dirname, 'views') - -const SENDGRID_WORKER_SUPPORTED_LNGS = { - en: 'en', - 'en-US': 'en', - ru: 'ru', - 'ru-RU': 'ru', - zh: 'zh-CN', - 'zh-CN': 'zh-CN', - 'zh-TW': 'zh-TW', - pt: 'pt-BR', - 'pt-PT': 'pt-BR', - 'pt-BR': 'pt-BR' -} - -const _getSendgridLng = (lng) => { - return SENDGRID_WORKER_SUPPORTED_LNGS[lng] ?? lng -} - -module.exports = (grcBfxReq, i18next) => { +module.exports = (grcBfxReq) => { return async ( - configs, + emailConf, to, - viewName, dataArr ) => { - const pathToView = path.join(basePathToViews, viewName) - const promises = dataArr.map(data => { const { - presigned_url: url, - language = 'en' + presigned_url: reportUrl, + language, + fileName, + isUnauth, + signatureS3 } = data ?? {} - const translate = getTranslator( - { i18next }, - { - lng: language, - ns: TRANSLATION_NAMESPACES.EMAIL - } - ) - const subject = translate( - configs.subject, - 'template.subject' - ) - const text = pug.renderFile( - pathToView, - { - ...data, - filters: { translate } - } - ) - const button = { - url, - text: translate( - 'Download Report', - 'template.btnText' - ) - } + const mailOptions = { - ...configs, + lang: language ?? 'en', to, - text, - subject, - button, - language: _getSendgridLng(language) + from: emailConf?.from, + reportUrl, + fileName, + signatureS3, + isUnauth } return grcBfxReq({ - service: 'rest:ext:sendgrid', - action: 'sendEmail', + service: 'rest:core:mail', + action: 'enqueueEmail', args: [mailOptions] }) }) From 85d1a9b600c3f21e4d6888f4ba7603d8e63adfb3 Mon Sep 17 00:00:00 2001 From: Vladimir Voronkov Date: Wed, 19 Nov 2025 13:31:36 +0200 Subject: [PATCH 04/15] Remove redundant injection to sendMail service --- workers/loc.api/di/app.deps.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/workers/loc.api/di/app.deps.js b/workers/loc.api/di/app.deps.js index 91c69ec6..8a076fea 100644 --- a/workers/loc.api/di/app.deps.js +++ b/workers/loc.api/di/app.deps.js @@ -173,8 +173,7 @@ module.exports = ({ bindDepsToFn( sendMail, [ - TYPES.GrcBfxReq, - TYPES.I18next + TYPES.GrcBfxReq ] ) ) From dbc19c8ffd86037f11aba38aeb38e973b35a3b87 Mon Sep 17 00:00:00 2001 From: Vladimir Voronkov Date: Wed, 19 Nov 2025 13:33:55 +0200 Subject: [PATCH 05/15] Remove email pug template --- package.json | 3 +- workers/loc.api/queue/aggregator.js | 1 - .../loc.api/queue/send-mail/views/email.pug | 46 ------------------- 3 files changed, 1 insertion(+), 49 deletions(-) delete mode 100644 workers/loc.api/queue/send-mail/views/email.pug diff --git a/package.json b/package.json index 3fe3fc54..5df3b90b 100644 --- a/package.json +++ b/package.json @@ -70,8 +70,7 @@ ".idea/", ".vscode/", "csv/", - "workers/loc.api/queue/temp/", - "workers/loc.api/queue/views/" + "workers/loc.api/queue/temp/" ] }, "betterScripts": { diff --git a/workers/loc.api/queue/aggregator.js b/workers/loc.api/queue/aggregator.js index d06c9123..17b1afac 100644 --- a/workers/loc.api/queue/aggregator.js +++ b/workers/loc.api/queue/aggregator.js @@ -57,7 +57,6 @@ module.exports = ( await sendMail( emailConf, email, - 'email.pug', s3Data.map((item, i) => ({ ...item, isUnauth, diff --git a/workers/loc.api/queue/send-mail/views/email.pug b/workers/loc.api/queue/send-mail/views/email.pug deleted file mode 100644 index 3d1387d0..00000000 --- a/workers/loc.api/queue/send-mail/views/email.pug +++ /dev/null @@ -1,46 +0,0 @@ -if isUnauth - p - :translate(prop='template.unauth') - Your file could not be completed, please try again -else - p(style='color: #606060;font-size: 15px;line-height: 150%;') - :translate(prop='template.readyForDownload') - The report you request is ready for download - p(style='color: #606060;font-size: 15px;line-height: 150%;') - :translate(prop='template.fileName') - File name - | : - b(style='margin-left: 5px;') - | #{fileName} - if signatureS3 - p(style='color: #606060;font-size: 15px;line-height: 150%;') - :translate(prop='template.youCan') - You can - a( - style=` - margin:0 5px;letter-spacing:.7;line-height:100%; - text-decoration:none;color:#4995c4;word-wrap:break-word; - ` - target='_blank' - href=signatureS3.presigned_url - ) - :translate(prop='template.download') - download - :translate(prop='template.pgpSignature') - PGP digital signature file - - p(style='color: #606060;font-size: 15px;line-height: 150%;') - :translate(prop='template.ifDidNotInitAction') - If you did not initiate this action and you suspect that your account may be compromised, please - - a( - href='https://www.bitfinex.com/freeze', - target='_blank', - style='text-decoration: none; color: #4995c4' - ) - |  - :translate(prop='template.freezeAccount') - freeze your account - |  - :translate(prop='template.contactSupport') - and contact support From 5c6c967f42c36375973beee7cb651240972fac49 Mon Sep 17 00:00:00 2001 From: Vladimir Voronkov Date: Wed, 19 Nov 2025 13:35:22 +0200 Subject: [PATCH 06/15] Remove email translation namespace --- workers/loc.api/i18next/index.js | 2 +- workers/loc.api/i18next/translation.namespaces.js | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/workers/loc.api/i18next/index.js b/workers/loc.api/i18next/index.js index a344d24a..646c4565 100644 --- a/workers/loc.api/i18next/index.js +++ b/workers/loc.api/i18next/index.js @@ -29,7 +29,7 @@ module.exports = (params) => { default: ['en'] }, ns: Object.values(TRANSLATION_NAMESPACES), - defaultNS: 'email', + defaultNS: TRANSLATION_NAMESPACES.PDF, preload: [...transPaths.reduce((accum, transPath) => { const allFileNames = fs.readdirSync(transPath) diff --git a/workers/loc.api/i18next/translation.namespaces.js b/workers/loc.api/i18next/translation.namespaces.js index 9932066f..00e63753 100644 --- a/workers/loc.api/i18next/translation.namespaces.js +++ b/workers/loc.api/i18next/translation.namespaces.js @@ -1,7 +1,6 @@ 'use strict' const TRANSLATION_NAMESPACES = { - EMAIL: 'email', PDF: 'pdf' } From 3bcc13028a846a89d45f6607acafcc485fa5eb0b Mon Sep 17 00:00:00 2001 From: Vladimir Voronkov Date: Wed, 19 Nov 2025 13:36:21 +0200 Subject: [PATCH 07/15] Remove email translations --- locales/en/email.json | 15 --------------- locales/es-EM/email.json | 15 --------------- locales/pt-BR/email.json | 15 --------------- locales/ru/email.json | 15 --------------- locales/tr/email.json | 15 --------------- locales/zh-CN/email.json | 15 --------------- locales/zh-TW/email.json | 15 --------------- 7 files changed, 105 deletions(-) delete mode 100644 locales/en/email.json delete mode 100644 locales/es-EM/email.json delete mode 100644 locales/pt-BR/email.json delete mode 100644 locales/ru/email.json delete mode 100644 locales/tr/email.json delete mode 100644 locales/zh-CN/email.json delete mode 100644 locales/zh-TW/email.json diff --git a/locales/en/email.json b/locales/en/email.json deleted file mode 100644 index b86690a3..00000000 --- a/locales/en/email.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "template": { - "subject": "Your report is ready", - "btnText": "Download Report", - "fileName": "File name", - "unauth": "Your file could not be completed, please try again", - "readyForDownload": "The report you request is ready for download", - "ifDidNotInitAction": "If you did not initiate this action and you suspect that your account may be compromised, please", - "freezeAccount": "freeze your account", - "contactSupport": "and contact support", - "youCan": "You can", - "download": "download", - "pgpSignature": "a PGP digital signature file" - } -} diff --git a/locales/es-EM/email.json b/locales/es-EM/email.json deleted file mode 100644 index 01e10af2..00000000 --- a/locales/es-EM/email.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "template": { - "subject": "Tu reporte esta listo", - "btnText": "Descargar el Informe", - "fileName": "Nombre del archivo", - "unauth": "Tu archivo no se pudo completar, intente de nuevo por favor.", - "readyForDownload": "Tu reporte esta listo para ser descargado", - "ifDidNotInitAction": "Si no realizaste esta acción y sospechas que tu cuenta puede estar comprometida, por favor", - "freezeAccount": "congela tu cuenta", - "contactSupport": "y contacta soporte", - "youCan": "Puedes", - "download": "descargar", - "pgpSignature": "un archivo con firma digital PGP" - } -} diff --git a/locales/pt-BR/email.json b/locales/pt-BR/email.json deleted file mode 100644 index 383c132f..00000000 --- a/locales/pt-BR/email.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "template": { - "subject": "Seu relatório está pronto", - "btnText": "Baixar Relatório", - "fileName": "Nome do arquivo", - "unauth": "Não foi possível concluir seu arquivo, tente novamente", - "readyForDownload": "O relatório solicitado está pronto para download", - "ifDidNotInitAction": "Se você não iniciou esta ação e suspeita que sua conta pode estar comprometida", - "freezeAccount": "por favor, congele sua conta", - "contactSupport": "e entre em contato com o suporte", - "youCan": "Você pode", - "download": "baixar", - "pgpSignature": "um arquivo de assinatura digital PGP" - } -} diff --git a/locales/ru/email.json b/locales/ru/email.json deleted file mode 100644 index e53c1326..00000000 --- a/locales/ru/email.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "template": { - "subject": "Ваш отчет готов", - "btnText": "Скачать Отчет", - "fileName": "Имя файла", - "unauth": "Ваш файл не может быть завершен, пожалуйста, попробуйте еще раз", - "readyForDownload": "Запрашиваемый вами отчет готов к загрузке", - "ifDidNotInitAction": "Если вы не инициировали это действие и подозреваете, что ваша учетная запись может быть взломана, пожалуйста,", - "freezeAccount": "заблокируйте ее", - "contactSupport": "и обратитесь в службу поддержки", - "youCan": "Вы можете", - "download": "скачать", - "pgpSignature": "файл цифровой подписи PGP" - } -} diff --git a/locales/tr/email.json b/locales/tr/email.json deleted file mode 100644 index d9237f34..00000000 --- a/locales/tr/email.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "template": { - "subject": "Raporunuz hazır", - "btnText": "Raporu İndir", - "fileName": "Dosya adı", - "unauth": "Dosyanız tamamlanamadı, lütfen tekrar deneyin", - "readyForDownload": "İstediğiniz rapor indirilmeye hazır", - "ifDidNotInitAction": "Bu işlemi siz başlatmadıysanız ve hesabınızın güvenliğinin ihlal edilmiş olabileceğinden şüpheleniyorsanız, lütfen", - "freezeAccount": "hesabınızı dondurun", - "contactSupport": "ve destek ekibiyle iletişime geçin", - "youCan": "Yapabilirsiniz", - "download": "indir", - "pgpSignature": "bir PGP dijital imza dosyası" - } -} diff --git a/locales/zh-CN/email.json b/locales/zh-CN/email.json deleted file mode 100644 index 2b18df1b..00000000 --- a/locales/zh-CN/email.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "template": { - "subject": "您的报告已备妥", - "btnText": "下载报告档案", - "fileName": "档案名称", - "unauth": "档案未下载成功,请重试一次", - "readyForDownload": "您请求的报告已可下载", - "ifDidNotInitAction": "如果您未进行此操作并且怀疑您的帐户已遭盗用,请", - "freezeAccount": "冻结您的帐户", - "contactSupport": "以及联络客服人员", - "youCan": "您可以", - "download": "下载", - "pgpSignature": "PGP数位签名档" - } -} diff --git a/locales/zh-TW/email.json b/locales/zh-TW/email.json deleted file mode 100644 index 25956fd4..00000000 --- a/locales/zh-TW/email.json +++ /dev/null @@ -1,15 +0,0 @@ -{ - "template": { - "subject": "您的報告已備妥", - "btnText": "下載报告檔案", - "fileName": "檔案名稱", - "unauth": "檔案未下載成功,請重試一次", - "readyForDownload": "您請求的報告已可下載", - "ifDidNotInitAction": "如果您未進行此操作並且懷疑您的帳戶已遭盜用,請", - "freezeAccount": "凍結您的帳戶", - "contactSupport": "以及聯絡客服人員", - "youCan": "您可以", - "download": "下載", - "pgpSignature": "PGP數位簽名檔案" - } -} From 8cc13d9777ea5443272efbe4f1b5e4db0c6499b9 Mon Sep 17 00:00:00 2001 From: Vladimir Voronkov Date: Wed, 19 Nov 2025 13:38:14 +0200 Subject: [PATCH 08/15] Remove subject field from email config --- config/service.report.json.example | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/config/service.report.json.example b/config/service.report.json.example index 4f497869..cab5ebf0 100644 --- a/config/service.report.json.example +++ b/config/service.report.json.example @@ -4,8 +4,7 @@ ], "restUrl": "https://api-pub.bitfinex.com", "emailConf": { - "from": "Bitfinex ", - "subject": "Your report is ready" + "from": "Bitfinex " }, "s3Conf": { "bucket": "", From 4ad07adcac0938eb8668d9c26cd69ac04e48f9b3 Mon Sep 17 00:00:00 2001 From: Vladimir Voronkov Date: Wed, 19 Nov 2025 13:49:53 +0200 Subject: [PATCH 09/15] Adjust mocked mail service --- test/simulate/mocks-spies/sendgrid.js | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/test/simulate/mocks-spies/sendgrid.js b/test/simulate/mocks-spies/sendgrid.js index b437180e..5ca1423e 100644 --- a/test/simulate/mocks-spies/sendgrid.js +++ b/test/simulate/mocks-spies/sendgrid.js @@ -1,37 +1,39 @@ 'use strict' -const workerArgs = ['rest:ext:sendgrid'] +const workerArgs = ['rest:core:mail'] function addFunctions (ExtApi) { - ExtApi.prototype.sendEmail = function (space, msg, cb) { + ExtApi.prototype.enqueueEmail = function (space, msg, cb) { const { + lang, to, from, - subject, - text + reportUrl, + fileName } = msg + if (!lang) return cb(new Error('ERR_API_NO_LANGUAGE')) if (!to) return cb(new Error('ERR_API_NO_TO')) if (!from) return cb(new Error('ERR_API_NO_FROM')) - if (!subject) return cb(new Error('ERR_API_NO_SUBJECT')) - if (!text) return cb(new Error('ERR_API_NO_TEXT')) + if (!reportUrl) return cb(new Error('ERR_API_NO_REPORT_URL')) + if (!fileName) return cb(new Error('ERR_API_NO_FILE_NAME')) try { const res = ['send'] const grcBfx = this.ctx.grc_bfx const call = { - worker: 'ext.sendgrid', - on: 'sendEmail', + worker: 'core.mail', + on: 'enqueueEmail', params: { msg }, res: res[0], timestamp: Date.now() } grcBfx.req('rest:ext:testcalls', 'addCall', [call], { timeout: 10000 }, (err, data) => { - if (err) cb(new Error('ext.sendgrid:sendEmail:testcalls')) + if (err) cb(new Error('core.mail:enqueueEmail:testcalls')) else return cb(null, res && res.length && res[0]) }) } catch (e) { - cb(new Error(`ERR_API_SENDGRID: ${e.toString()}`)) + cb(new Error(`ERR_API_MAIL: ${e.toString()}`)) } } } From b4a4ff02583360bb5b4500fb8a22ffc7a44371c0 Mon Sep 17 00:00:00 2001 From: Vladimir Voronkov Date: Wed, 19 Nov 2025 13:50:52 +0200 Subject: [PATCH 10/15] Rename mocked sendgrid service to mail --- test/helpers/helpers.worker.js | 2 +- test/simulate/mocks-spies/{sendgrid.js => mail.js} | 0 2 files changed, 1 insertion(+), 1 deletion(-) rename test/simulate/mocks-spies/{sendgrid.js => mail.js} (100%) diff --git a/test/helpers/helpers.worker.js b/test/helpers/helpers.worker.js index 398d853a..d3ad4fe1 100644 --- a/test/helpers/helpers.worker.js +++ b/test/helpers/helpers.worker.js @@ -20,7 +20,7 @@ const startHelpers = ( logs, workers = [ { name: 's3', port: 13371 }, - { name: 'sendgrid', port: 1310 }, + { name: 'mail', port: 1310 }, { name: 'gpg', port: 1320 }, { name: 'pdf', port: 1330 }, { name: 'testcalls', port: 1300 } diff --git a/test/simulate/mocks-spies/sendgrid.js b/test/simulate/mocks-spies/mail.js similarity index 100% rename from test/simulate/mocks-spies/sendgrid.js rename to test/simulate/mocks-spies/mail.js From 5b27f452f02089ce66e670fd0e233af1e7a2d4d1 Mon Sep 17 00:00:00 2001 From: Vladimir Voronkov Date: Wed, 19 Nov 2025 13:51:34 +0200 Subject: [PATCH 11/15] Adjust mocked s3 service --- test/simulate/mocks-spies/s3.js | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/test/simulate/mocks-spies/s3.js b/test/simulate/mocks-spies/s3.js index b96feeff..f7e1e75c 100644 --- a/test/simulate/mocks-spies/s3.js +++ b/test/simulate/mocks-spies/s3.js @@ -4,17 +4,15 @@ const workerArgs = ['rest:ext:s3'] function addFunctions (ExtApi) { ExtApi.prototype.uploadPresigned = function (space, data, opts, cb) { - const upload = { - public_url: 'https://fakeUrl.com', - key: 'fakeKey', - s3bucket: 'fakeBucket' + const mockedRes = { + presigned_url: 'https://fakePresignedUrl.com' } const grcBfx = this.ctx.grc_bfx const call = { worker: 'ext.s3', on: 'uploadPresigned', - params: { opts }, - res: { upload }, + params: { data, opts }, + res: mockedRes, timestamp: Date.now() } @@ -25,7 +23,7 @@ function addFunctions (ExtApi) { { timeout: 10000 }, (err, data) => { if (err) cb(new Error('ext.s3:uploadPresigned:testcalls')) - else return cb(null, upload) + else return cb(null, mockedRes) } ) } From e131ceca5b177af8b17ed106aa944e4dd1f8327a Mon Sep 17 00:00:00 2001 From: Vladimir Voronkov Date: Fri, 21 Nov 2025 11:26:24 +0200 Subject: [PATCH 12/15] Remove from field of email config --- config/service.report.json.example | 3 --- test/simulate/mocks-spies/mail.js | 2 -- workers/loc.api/queue/aggregator.js | 2 -- workers/loc.api/queue/processor.js | 1 - workers/loc.api/queue/send-mail/index.js | 2 -- 5 files changed, 10 deletions(-) diff --git a/config/service.report.json.example b/config/service.report.json.example index cab5ebf0..7ba6c3ba 100644 --- a/config/service.report.json.example +++ b/config/service.report.json.example @@ -3,9 +3,6 @@ "rest:report:api" ], "restUrl": "https://api-pub.bitfinex.com", - "emailConf": { - "from": "Bitfinex " - }, "s3Conf": { "bucket": "", "acl": "", diff --git a/test/simulate/mocks-spies/mail.js b/test/simulate/mocks-spies/mail.js index 5ca1423e..79b26ea9 100644 --- a/test/simulate/mocks-spies/mail.js +++ b/test/simulate/mocks-spies/mail.js @@ -7,14 +7,12 @@ function addFunctions (ExtApi) { const { lang, to, - from, reportUrl, fileName } = msg if (!lang) return cb(new Error('ERR_API_NO_LANGUAGE')) if (!to) return cb(new Error('ERR_API_NO_TO')) - if (!from) return cb(new Error('ERR_API_NO_FROM')) if (!reportUrl) return cb(new Error('ERR_API_NO_REPORT_URL')) if (!fileName) return cb(new Error('ERR_API_NO_FILE_NAME')) diff --git a/workers/loc.api/queue/aggregator.js b/workers/loc.api/queue/aggregator.js index 17b1afac..ce3829b2 100644 --- a/workers/loc.api/queue/aggregator.js +++ b/workers/loc.api/queue/aggregator.js @@ -29,7 +29,6 @@ module.exports = ( email, isUnauth, s3Conf, - emailConf, language } = job.data @@ -55,7 +54,6 @@ module.exports = ( ) await sendMail( - emailConf, email, s3Data.map((item, i) => ({ ...item, diff --git a/workers/loc.api/queue/processor.js b/workers/loc.api/queue/processor.js index d739bc49..1ac7bda2 100644 --- a/workers/loc.api/queue/processor.js +++ b/workers/loc.api/queue/processor.js @@ -88,7 +88,6 @@ module.exports = ( processorQueue.on('completed', (result) => { aggregatorQueue.addJob({ ...result, - emailConf: conf.emailConf, s3Conf: conf.s3Conf }) }) diff --git a/workers/loc.api/queue/send-mail/index.js b/workers/loc.api/queue/send-mail/index.js index 0d71b1b8..b69ae49f 100644 --- a/workers/loc.api/queue/send-mail/index.js +++ b/workers/loc.api/queue/send-mail/index.js @@ -2,7 +2,6 @@ module.exports = (grcBfxReq) => { return async ( - emailConf, to, dataArr ) => { @@ -18,7 +17,6 @@ module.exports = (grcBfxReq) => { const mailOptions = { lang: language ?? 'en', to, - from: emailConf?.from, reportUrl, fileName, signatureS3, From 15963a35e60e6bcd8232a691e5eb7f7f941e4617 Mon Sep 17 00:00:00 2001 From: Vladimir Voronkov Date: Tue, 25 Nov 2025 14:15:08 +0200 Subject: [PATCH 13/15] Add email request type --- test/simulate/mocks-spies/mail.js | 3 ++- workers/loc.api/queue/send-mail/index.js | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/test/simulate/mocks-spies/mail.js b/test/simulate/mocks-spies/mail.js index 79b26ea9..b7f1c77f 100644 --- a/test/simulate/mocks-spies/mail.js +++ b/test/simulate/mocks-spies/mail.js @@ -9,8 +9,9 @@ function addFunctions (ExtApi) { to, reportUrl, fileName - } = msg + } = msg?.payload + if (!msg?.type) return cb(new Error('ERR_API_NO_TYPE')) if (!lang) return cb(new Error('ERR_API_NO_LANGUAGE')) if (!to) return cb(new Error('ERR_API_NO_TO')) if (!reportUrl) return cb(new Error('ERR_API_NO_REPORT_URL')) diff --git a/workers/loc.api/queue/send-mail/index.js b/workers/loc.api/queue/send-mail/index.js index b69ae49f..aded590d 100644 --- a/workers/loc.api/queue/send-mail/index.js +++ b/workers/loc.api/queue/send-mail/index.js @@ -14,7 +14,7 @@ module.exports = (grcBfxReq) => { signatureS3 } = data ?? {} - const mailOptions = { + const payload = { lang: language ?? 'en', to, reportUrl, @@ -26,7 +26,7 @@ module.exports = (grcBfxReq) => { return grcBfxReq({ service: 'rest:core:mail', action: 'enqueueEmail', - args: [mailOptions] + args: [{ type: 'reportDownloadReady', payload }] }) }) From 87a9c86aa9d4fe2751e468445006042101be5007 Mon Sep 17 00:00:00 2001 From: Vladimir Voronkov Date: Mon, 8 Dec 2025 11:13:46 +0200 Subject: [PATCH 14/15] Exclude 2fa login and pwd from logs for electron app --- workers/loc.api/responder/index.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/workers/loc.api/responder/index.js b/workers/loc.api/responder/index.js index 84c07eab..6ec75658 100644 --- a/workers/loc.api/responder/index.js +++ b/workers/loc.api/responder/index.js @@ -173,7 +173,9 @@ const _getErrorMetadata = (args, err, name) => { 'subAccountApiKeys', 'subAccountPassword', 'addingSubUsers', - 'removingSubUsersByEmails' + 'removingSubUsersByEmails', + 'login', + 'password' ]) : args?.params ?? null const extendedData = { From 6827964fb18a2ca8afc57b5c7aa977f7f4a26cc8 Mon Sep 17 00:00:00 2001 From: Vladimir Voronkov Date: Mon, 8 Dec 2025 12:18:36 +0200 Subject: [PATCH 15/15] Bump version up to 4.13.2 --- package-lock.json | 4 ++-- package.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/package-lock.json b/package-lock.json index b3bf8f4e..29cf4a24 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "bfx-report", - "version": "4.13.1", + "version": "4.13.2", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "bfx-report", - "version": "4.13.1", + "version": "4.13.2", "license": "Apache-2.0", "dependencies": { "ajv": "8.17.1", diff --git a/package.json b/package.json index 5df3b90b..ab865ff9 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "bfx-report", - "version": "4.13.1", + "version": "4.13.2", "description": "Reporting tool", "main": "worker.js", "license": "Apache-2.0",