fix(DialogKeywords): comment out unused email headers in mail options
Some checks failed
GBCI / build (push) Has been cancelled
Some checks failed
GBCI / build (push) Has been cancelled
This commit is contained in:
parent
f34a4f25d0
commit
525703052d
4 changed files with 105 additions and 66 deletions
|
|
@ -35,7 +35,7 @@ jobs:
|
||||||
echo "[General Bots Deployer] Building BotServer..."
|
echo "[General Bots Deployer] Building BotServer..."
|
||||||
# rm -rf /opt/gbo/bin/BotServer/node_modules
|
# rm -rf /opt/gbo/bin/BotServer/node_modules
|
||||||
cd /opt/gbo/bin/BotServer
|
cd /opt/gbo/bin/BotServer
|
||||||
sudo npm ci --production
|
#sudo npm ci --production
|
||||||
npm run build-server
|
npm run build-server
|
||||||
# npm run build-gbui
|
# npm run build-gbui
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -603,6 +603,10 @@ export class DialogKeywords {
|
||||||
subject: subject,
|
subject: subject,
|
||||||
text: body,
|
text: body,
|
||||||
html: body,
|
html: body,
|
||||||
|
// headers: {
|
||||||
|
// 'List-Unsubscribe': `<mailto:${config.unsubscribeEmail}?subject=Unsubscribe>`,
|
||||||
|
// 'List-Unsubscribe-Post': 'List-Unsubscribe=One-Click'
|
||||||
|
// }
|
||||||
};
|
};
|
||||||
|
|
||||||
await transporter.sendMail(mailOptions);
|
await transporter.sendMail(mailOptions);
|
||||||
|
|
|
||||||
|
|
@ -14,38 +14,10 @@ import { existsSync } from 'fs';
|
||||||
import { GBConfigService } from "../../core.gbapp/services/GBConfigService.js";
|
import { GBConfigService } from "../../core.gbapp/services/GBConfigService.js";
|
||||||
import path from "path";
|
import path from "path";
|
||||||
import { Client } from "minio";
|
import { Client } from "minio";
|
||||||
|
import { GBLogEx } from "packages/core.gbapp/services/GBLogEx.js";
|
||||||
|
|
||||||
|
|
||||||
export class GBOService {
|
export class GBOService {
|
||||||
|
|
||||||
|
|
||||||
constructor() {
|
|
||||||
}
|
|
||||||
public async sendEmail(token: string, to: string, from: string,
|
|
||||||
subject: string, text: string, html: string) {
|
|
||||||
return new Promise<any>((resolve, reject) => {
|
|
||||||
sgMail.setApiKey(token);
|
|
||||||
const msg = {
|
|
||||||
to: to,
|
|
||||||
from: from,
|
|
||||||
subject: subject,
|
|
||||||
text: text,
|
|
||||||
html: html
|
|
||||||
};
|
|
||||||
sgMail.send(msg, false, (err, res) => {
|
|
||||||
if (err) {
|
|
||||||
reject(err)
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
resolve(res);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public async listTemplates(min: GBMinInstance) {
|
public async listTemplates(min: GBMinInstance) {
|
||||||
if (GBConfigService.get('GB_MODE') === 'legacy') {
|
if (GBConfigService.get('GB_MODE') === 'legacy') {
|
||||||
let templateLibraryId = process.env.SAAS_TEMPLATE_LIBRARY;
|
let templateLibraryId = process.env.SAAS_TEMPLATE_LIBRARY;
|
||||||
|
|
@ -225,7 +197,26 @@ export class GBOService {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public async shareWithEmail(bucketName, folder, expiresInHours = 24 * 365) {
|
||||||
|
const minioClient = new Client({
|
||||||
|
endPoint: process.env.DRIVE_SERVER || 'localhost',
|
||||||
|
port: parseInt(process.env.DRIVE_PORT || '9000', 10),
|
||||||
|
useSSL: process.env.DRIVE_USE_SSL === 'true',
|
||||||
|
accessKey: process.env.DRIVE_ACCESSKEY,
|
||||||
|
secretKey: process.env.DRIVE_SECRET,
|
||||||
|
});
|
||||||
|
|
||||||
|
// Generate a time-limited access link (default: 24 hours)
|
||||||
|
const presignedUrl = await minioClient.presignedGetObject(
|
||||||
|
bucketName,
|
||||||
|
folder,
|
||||||
|
expiresInHours * 60 * 60 // Convert hours to seconds
|
||||||
|
);
|
||||||
|
return presignedUrl;
|
||||||
|
}
|
||||||
|
|
||||||
public async shareFolder(token: string, driveId: string, itemId: string, email: string) {
|
public async shareFolder(token: string, driveId: string, itemId: string, email: string) {
|
||||||
|
|
||||||
return new Promise<string>((resolve, reject) => {
|
return new Promise<string>((resolve, reject) => {
|
||||||
let client = MicrosoftGraph.Client.init({
|
let client = MicrosoftGraph.Client.init({
|
||||||
authProvider: done => {
|
authProvider: done => {
|
||||||
|
|
|
||||||
|
|
@ -7,6 +7,7 @@ import { GBOService } from './GBOService.js';
|
||||||
import { GBConfigService } from '../../core.gbapp/services/GBConfigService.js';
|
import { GBConfigService } from '../../core.gbapp/services/GBConfigService.js';
|
||||||
import Stripe from 'stripe';
|
import Stripe from 'stripe';
|
||||||
import { GBUtil } from '../../../src/util.js';
|
import { GBUtil } from '../../../src/util.js';
|
||||||
|
import { DialogKeywords } from '../../basic.gblib/services/DialogKeywords.js';
|
||||||
|
|
||||||
export class MainService {
|
export class MainService {
|
||||||
private gboService: GBOService;
|
private gboService: GBOService;
|
||||||
|
|
@ -173,6 +174,49 @@ export class MainService {
|
||||||
await min.core['setConfig'](min, instance.botId, 'WebDav Username', instance.botId);
|
await min.core['setConfig'](min, instance.botId, 'WebDav Username', instance.botId);
|
||||||
await min.core['setConfig'](min, instance.botId, 'WebDav Secret', instance.adminPass);
|
await min.core['setConfig'](min, instance.botId, 'WebDav Secret', instance.adminPass);
|
||||||
|
|
||||||
|
const botName = subscription.botName;
|
||||||
|
const language = subscription['customerLanguage'] || 'en-us';
|
||||||
|
|
||||||
|
const webUrl = this.gboService.shareWithEmail(`process.env.DRIVE_ORG_PREFIX${botName}.gbai`, '/');
|
||||||
|
|
||||||
|
urlJoin(process.env.DRIVE_WEB, 'browser',);
|
||||||
|
const botUrl = urlJoin(process.env.BOT_URL, botName);
|
||||||
|
const botId = instance.botId;
|
||||||
|
|
||||||
|
let message = `Seu bot ${botName} está disponível no endereço:
|
||||||
|
<br/><a href="${urlJoin(process.env.BOT_URL, botName)}">${urlJoin(process.env.BOT_URL, botName)}</a>.
|
||||||
|
<br/>
|
||||||
|
<br/>Os pacotes do General Bots (ex: .gbkb, .gbtheme) para seu Bot devem ser editados no repositório de pacotes:
|
||||||
|
<br/>
|
||||||
|
<br/><a href="${webUrl}">${webUrl}</a>.
|
||||||
|
<br/>
|
||||||
|
<br/> Digite /publish do seu WhatsApp para publicar os pacotes. Seu número está autorizado na pasta ${botName}.gbot/Config.xlsx
|
||||||
|
<br/>
|
||||||
|
<br/>O arquivo .zip em anexo pode ser importado no Teams conforme instruções em:
|
||||||
|
<br/><a href="https://docs.microsoft.com/en-us/microsoftteams/platform/concepts/deploy-and-publish/apps-upload">https://docs.microsoft.com/en-us/microsoftteams/platform/concepts/deploy-and-publish/apps-upload</a>.
|
||||||
|
<br/>
|
||||||
|
<br/>Log in to the Teams client with your Microsoft 365 account.
|
||||||
|
<br/>Select Apps and choose Upload a custom app.
|
||||||
|
<br/>Select this .zip file attached to this e-mail. An install dialog displays.
|
||||||
|
<br/>Add your Bot to Teams.
|
||||||
|
<br/>
|
||||||
|
<br/>Atenciosamente,
|
||||||
|
<br/>General Bots Online.
|
||||||
|
<br/><a href="https://gb.pragmatismo.com.br">https://gb.pragmatismo.com.br</a>
|
||||||
|
<br/>
|
||||||
|
<br/>E-mail remetido por Pragmatismo.
|
||||||
|
<br/>`;
|
||||||
|
|
||||||
|
message = await min.conversationalService.translate(
|
||||||
|
min,
|
||||||
|
message,
|
||||||
|
language
|
||||||
|
);
|
||||||
|
GBLog.info('Sending e-mails....');
|
||||||
|
|
||||||
|
const dk = new DialogKeywords();
|
||||||
|
await dk.sendEmail({ pid: 0, to: subscription.customerEmail, subject: `Seu bot ${botName} está pronto!`, body: message });
|
||||||
|
|
||||||
return {
|
return {
|
||||||
success: true,
|
success: true,
|
||||||
botUrl: urlJoin(process.env.BOT_URL, subscription.botName)
|
botUrl: urlJoin(process.env.BOT_URL, subscription.botName)
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue