new(all): Google Translator fix and security fix.
This commit is contained in:
parent
ba796c86a7
commit
9b94b08167
5 changed files with 419 additions and 552 deletions
906
package-lock.json
generated
906
package-lock.json
generated
File diff suppressed because it is too large
Load diff
10
package.json
10
package.json
|
@ -68,12 +68,12 @@
|
||||||
"azure-search-client": "3.1.5",
|
"azure-search-client": "3.1.5",
|
||||||
"bluebird": "3.7.2",
|
"bluebird": "3.7.2",
|
||||||
"body-parser": "1.19.0",
|
"body-parser": "1.19.0",
|
||||||
"botbuilder": "4.13.5",
|
"botbuilder": "4.11.0",
|
||||||
"botbuilder-adapter-facebook": "1.0.11",
|
"botbuilder-adapter-facebook": "1.0.11",
|
||||||
"botbuilder-ai": "4.13.5",
|
"botbuilder-ai": "4.11.0",
|
||||||
"botbuilder-dialogs": "4.13.5",
|
"botbuilder-dialogs": "4.11.0",
|
||||||
"botframework-connector": "4.13.5",
|
"botframework-connector": "4.11.0",
|
||||||
"botlib": "1.9.2",
|
"botlib": "1.9.3",
|
||||||
"cli-spinner": "0.2.10",
|
"cli-spinner": "0.2.10",
|
||||||
"core-js": "3.14.0",
|
"core-js": "3.14.0",
|
||||||
"dotenv-extended": "2.9.0",
|
"dotenv-extended": "2.9.0",
|
||||||
|
|
|
@ -762,7 +762,7 @@ export class GBConversationalService {
|
||||||
const endPoint = min.core.getParam<string>(min.instance, 'translatorEndpoint', null);
|
const endPoint = min.core.getParam<string>(min.instance, 'translatorEndpoint', null);
|
||||||
const key = min.core.getParam<string>(min.instance, 'translatorKey', null);
|
const key = min.core.getParam<string>(min.instance, 'translatorKey', null);
|
||||||
|
|
||||||
if (endPoint === null || !translatorEnabled() || process.env.TRANSLATOR_DISABLED === 'true') {
|
if ((endPoint === null && !min.instance.googleProjectId) || !translatorEnabled() || process.env.TRANSLATOR_DISABLED === 'true') {
|
||||||
return text;
|
return text;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -638,7 +638,7 @@ export class GBMinService {
|
||||||
if (GBServer.globals.minBoot === undefined) {
|
if (GBServer.globals.minBoot === undefined) {
|
||||||
GBServer.globals.minBoot = min;
|
GBServer.globals.minBoot = min;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (min.instance.facebookWorkplaceVerifyToken) {
|
if (min.instance.facebookWorkplaceVerifyToken) {
|
||||||
min['fbAdapter'] = new FacebookAdapter({
|
min['fbAdapter'] = new FacebookAdapter({
|
||||||
verify_token: min.instance.facebookWorkplaceVerifyToken,
|
verify_token: min.instance.facebookWorkplaceVerifyToken,
|
||||||
|
@ -706,15 +706,16 @@ export class GBMinService {
|
||||||
min.dialogs = new DialogSet(dialogState);
|
min.dialogs = new DialogSet(dialogState);
|
||||||
min.dialogs.add(new TextPrompt('textPrompt'));
|
min.dialogs.add(new TextPrompt('textPrompt'));
|
||||||
min.dialogs.add(new ConfirmPrompt('confirmPrompt'));
|
min.dialogs.add(new ConfirmPrompt('confirmPrompt'));
|
||||||
min.dialogs.add(
|
if (process.env.ENABLE_AUTH) {
|
||||||
new OAuthPrompt('oAuthPrompt', {
|
min.dialogs.add(
|
||||||
connectionName: 'OAuth2',
|
new OAuthPrompt('oAuthPrompt', {
|
||||||
text: 'Please sign in to General Bots.',
|
connectionName: 'OAuth2',
|
||||||
title: 'Sign in',
|
text: 'Please sign in to General Bots.',
|
||||||
timeout: 300000
|
title: 'Sign in',
|
||||||
})
|
timeout: 300000
|
||||||
);
|
})
|
||||||
|
);
|
||||||
|
}
|
||||||
return { min, adapter, conversationState };
|
return { min, adapter, conversationState };
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -870,7 +871,7 @@ export class GBMinService {
|
||||||
GBLog.info(`Auto start (teams) dialog is now being called: ${startDialog} for ${min.instance.botId}...`);
|
GBLog.info(`Auto start (teams) dialog is now being called: ${startDialog} for ${min.instance.botId}...`);
|
||||||
await GBVMService.callVM(startDialog.toLowerCase(), min, step, this.deployer);
|
await GBVMService.callVM(startDialog.toLowerCase(), min, step, this.deployer);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1227,16 +1228,19 @@ export class GBMinService {
|
||||||
|
|
||||||
if (text !== startDialog) {
|
if (text !== startDialog) {
|
||||||
let nextDialog = null;
|
let nextDialog = null;
|
||||||
|
let data = {
|
||||||
|
query: text,
|
||||||
|
step: step,
|
||||||
|
notTranslatedQuery: originalText,
|
||||||
|
message: message ? message['dataValues'] : null,
|
||||||
|
user: user ? user.dataValues : null
|
||||||
|
};
|
||||||
await CollectionUtil.asyncForEach(min.appPackages, async (e: IGBPackage) => {
|
await CollectionUtil.asyncForEach(min.appPackages, async (e: IGBPackage) => {
|
||||||
nextDialog = await e.onExchangeData(min, 'handleAnswer', {
|
nextDialog = await e.onExchangeData(min, 'handleAnswer', data);
|
||||||
query: text,
|
|
||||||
step: step,
|
|
||||||
notTranslatedQuery: originalText,
|
|
||||||
message: message ? message['dataValues'] : null,
|
|
||||||
user: user ? user.dataValues : null
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
|
||||||
await step.beginDialog(nextDialog ? nextDialog : '/answer', {
|
await step.beginDialog(nextDialog ? nextDialog : '/answer', {
|
||||||
|
data: data,
|
||||||
query: text,
|
query: text,
|
||||||
user: user ? user.dataValues : null,
|
user: user ? user.dataValues : null,
|
||||||
message: message
|
message: message
|
||||||
|
|
|
@ -41,7 +41,7 @@ import urlJoin = require('url-join');
|
||||||
import { GBDialogStep, GBLog, GBMinInstance, IGBCoreService, IGBPackage } from 'botlib';
|
import { GBDialogStep, GBLog, GBMinInstance, IGBCoreService, IGBPackage } from 'botlib';
|
||||||
import { Sequelize } from 'sequelize-typescript';
|
import { Sequelize } from 'sequelize-typescript';
|
||||||
import { OAuthDialog } from './dialogs/OAuthDialog';
|
import { OAuthDialog } from './dialogs/OAuthDialog';
|
||||||
import {ProfileDialog} from './dialogs/ProfileDialog';
|
import { ProfileDialog } from './dialogs/ProfileDialog';
|
||||||
import { GuaribasGroup, GuaribasUser, GuaribasUserGroup } from './models';
|
import { GuaribasGroup, GuaribasUser, GuaribasUserGroup } from './models';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -50,14 +50,19 @@ import { GuaribasGroup, GuaribasUser, GuaribasUserGroup } from './models';
|
||||||
export class GBSecurityPackage implements IGBPackage {
|
export class GBSecurityPackage implements IGBPackage {
|
||||||
public sysPackages: IGBPackage[];
|
public sysPackages: IGBPackage[];
|
||||||
public async getDialogs(min: GBMinInstance) {
|
public async getDialogs(min: GBMinInstance) {
|
||||||
return [
|
|
||||||
|
let out = [
|
||||||
ProfileDialog.getNameDialog(min),
|
ProfileDialog.getNameDialog(min),
|
||||||
ProfileDialog.getEmailDialog(min),
|
ProfileDialog.getEmailDialog(min),
|
||||||
ProfileDialog.getMobileDialog(min),
|
ProfileDialog.getMobileDialog(min),
|
||||||
ProfileDialog.getMobileConfirmDialog(min),
|
ProfileDialog.getMobileConfirmDialog(min)
|
||||||
OAuthDialog.getOAuthDialog(min)
|
|
||||||
];
|
];
|
||||||
|
|
||||||
|
if (process.env.ENABLE_AUTH) {
|
||||||
|
out.push(OAuthDialog.getOAuthDialog(min));
|
||||||
|
}
|
||||||
|
return out;
|
||||||
|
|
||||||
}
|
}
|
||||||
public async unloadPackage(core: IGBCoreService): Promise<void> {
|
public async unloadPackage(core: IGBCoreService): Promise<void> {
|
||||||
GBLog.verbose(`unloadPackage called.`);
|
GBLog.verbose(`unloadPackage called.`);
|
||||||
|
|
Loading…
Add table
Reference in a new issue