Merge branch 'main' of https://github.com/GeneralBots/BotServer
This commit is contained in:
commit
4823f02bbc
20 changed files with 148 additions and 99 deletions
|
|
@ -1,3 +1,8 @@
|
||||||
|
<a href="https://github.com/generalbots/botserver/graphs/contributors">
|
||||||
|
<img src="https://contrib.rocks/image?repo=generalbots/botserver" />
|
||||||
|
</a>
|
||||||
|
|
||||||
|
|
||||||
| Area | Status |
|
| Area | Status |
|
||||||
|------------------------------|----------------------------------------------------------------------------------------------------|
|
|------------------------------|----------------------------------------------------------------------------------------------------|
|
||||||
| Releases | [](https://www.npmjs.com/package/botserver/) [](https://www.npmjs.com/package/botlib/) [](https://github.com/semantic-release/semantic-release)|
|
| Releases | [](https://www.npmjs.com/package/botserver/) [](https://www.npmjs.com/package/botlib/) [](https://github.com/semantic-release/semantic-release)|
|
||||||
|
|
@ -111,6 +116,6 @@ trademark license. Therefore any rights, title and interest in
|
||||||
our trademarks remain entirely with us.
|
our trademarks remain entirely with us.
|
||||||
|
|
||||||
<a href="https://stackoverflow.com/questions/ask?tags=generalbots">:speech_balloon: Ask a question</a> <a href="https://github.com/GeneralBots/BotBook">:book: Read the Docs</a>
|
<a href="https://stackoverflow.com/questions/ask?tags=generalbots">:speech_balloon: Ask a question</a> <a href="https://github.com/GeneralBots/BotBook">:book: Read the Docs</a>
|
||||||
|
Team pictures made with [contrib.rocks](https://contrib.rocks).
|
||||||
General Bots Code Name is [Guaribas](https://en.wikipedia.org/wiki/Guaribas), the name of a city in Brazil, state of Piaui.
|
General Bots Code Name is [Guaribas](https://en.wikipedia.org/wiki/Guaribas), the name of a city in Brazil, state of Piaui.
|
||||||
[Roberto Mangabeira Unger](http://www.robertounger.com/en/): "No one should have to do work that can be done by a machine".
|
[Roberto Mangabeira Unger](http://www.robertounger.com/en/): "No one should have to do work that can be done by a machine".
|
||||||
|
|
|
||||||
|
|
@ -60,7 +60,7 @@ import QrScanner from 'qr-scanner';
|
||||||
import pkg from 'whatsapp-web.js';
|
import pkg from 'whatsapp-web.js';
|
||||||
import { ActivityTypes } from 'botbuilder';
|
import { ActivityTypes } from 'botbuilder';
|
||||||
const { List, Buttons } = pkg;
|
const { List, Buttons } = pkg;
|
||||||
import mime from 'mime';
|
import mime from 'mime-types';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Default check interval for user replay
|
* Default check interval for user replay
|
||||||
|
|
|
||||||
|
|
@ -254,8 +254,7 @@ export class SecService extends GBService {
|
||||||
if (user['dataValues'] && !value) {
|
if (user['dataValues'] && !value) {
|
||||||
value = user['dataValues'][name];
|
value = user['dataValues'][name];
|
||||||
if (value === null) {
|
if (value === null) {
|
||||||
switch(name)
|
switch (name) {
|
||||||
{
|
|
||||||
case 'language':
|
case 'language':
|
||||||
value = 'en';
|
value = 'en';
|
||||||
break;
|
break;
|
||||||
|
|
@ -275,8 +274,7 @@ export class SecService extends GBService {
|
||||||
let user = await GuaribasUser.findOne(options);
|
let user = await GuaribasUser.findOne(options);
|
||||||
// tslint:disable-next-line:prefer-object-spread
|
// tslint:disable-next-line:prefer-object-spread
|
||||||
let obj = JSON.parse(user.params);
|
let obj = JSON.parse(user.params);
|
||||||
if (!obj)
|
if (!obj) {
|
||||||
{
|
|
||||||
obj = {};
|
obj = {};
|
||||||
}
|
}
|
||||||
obj[name] = value;
|
obj[name] = value;
|
||||||
|
|
|
||||||
|
|
@ -195,8 +195,7 @@ export class WhatsappDirectLine extends GBService {
|
||||||
if (setUrl) {
|
if (setUrl) {
|
||||||
createClient.bind(this)();
|
createClient.bind(this)();
|
||||||
}
|
}
|
||||||
else
|
else {
|
||||||
{
|
|
||||||
this.customClient = minBoot.whatsAppDirectLine.customClient;
|
this.customClient = minBoot.whatsAppDirectLine.customClient;
|
||||||
}
|
}
|
||||||
setUrl = false;
|
setUrl = false;
|
||||||
|
|
|
||||||
53
src/app.ts
53
src/app.ts
|
|
@ -282,6 +282,38 @@ export class GBServer {
|
||||||
};
|
};
|
||||||
const httpsServer = https.createServer(options1, server).listen(port, mainCallback);
|
const httpsServer = https.createServer(options1, server).listen(port, mainCallback);
|
||||||
GBServer.globals.httpsServer = httpsServer;
|
GBServer.globals.httpsServer = httpsServer;
|
||||||
|
|
||||||
|
for (let i = 2; ; i++) {
|
||||||
|
const certPfxEnv = `CERTIFICATE${i}_PFX`;
|
||||||
|
const certPassphraseEnv = `CERTIFICATE${i}_PASSPHRASE`;
|
||||||
|
const certDomainEnv = `CERTIFICATE${i}_DOMAIN`;
|
||||||
|
|
||||||
|
if (process.env[certPfxEnv] && process.env[certPassphraseEnv] && process.env[certDomainEnv]) {
|
||||||
|
const options = {
|
||||||
|
passphrase: process.env[certPassphraseEnv],
|
||||||
|
pfx: Fs.readFileSync(process.env[certPfxEnv])
|
||||||
|
};
|
||||||
|
httpsServer.addContext(process.env[certDomainEnv], options);
|
||||||
|
} else {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
server.listen(port, mainCallback);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/*
|
||||||
|
--------------------------------------------------------------------------------------------
|
||||||
|
if (process.env.CERTIFICATE_PFX) {
|
||||||
|
const options1 = {
|
||||||
|
passphrase: process.env.CERTIFICATE_PASSPHRASE,
|
||||||
|
pfx: Fs.readFileSync(process.env.CERTIFICATE_PFX)
|
||||||
|
};
|
||||||
|
const httpsServer = https.createServer(options1, server).listen(port, mainCallback);
|
||||||
|
GBServer.globals.httpsServer = httpsServer;
|
||||||
|
|
||||||
if (process.env.CERTIFICATE2_PFX) {
|
if (process.env.CERTIFICATE2_PFX) {
|
||||||
const options2 = {
|
const options2 = {
|
||||||
passphrase: process.env.CERTIFICATE2_PASSPHRASE,
|
passphrase: process.env.CERTIFICATE2_PASSPHRASE,
|
||||||
|
|
@ -289,8 +321,23 @@ export class GBServer {
|
||||||
};
|
};
|
||||||
httpsServer.addContext(process.env.CERTIFICATE2_DOMAIN, options2);
|
httpsServer.addContext(process.env.CERTIFICATE2_DOMAIN, options2);
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
server.listen(port, mainCallback);
|
if (process.env.CERTIFICATE3_PFX) {
|
||||||
}
|
const options3 = {
|
||||||
|
passphrase: process.env.CERTIFICATE3_PASSPHRASE,
|
||||||
|
pfx: Fs.readFileSync(process.env.CERTIFICATE3_PFX)
|
||||||
|
};
|
||||||
|
httpsServer.addContext(process.env.CERTIFICATE3_DOMAIN, options3);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (process.env.CERTIFICATE4_PFX) {
|
||||||
|
const options4 = {
|
||||||
|
passphrase: process.env.CERTIFICATE4_PASSPHRASE,
|
||||||
|
pfx: Fs.readFileSync(process.env.CERTIFICATE4_PFX)
|
||||||
|
};
|
||||||
|
httpsServer.addContext(process.env.CERTIFICATE4_DOMAIN, options4);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
------------------------------------------------------------------------------------------
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue