mirror of
https://github.com/cheveguerra/whaticket-community.git
synced 2026-04-17 19:37:02 +00:00
✨ Adding multidevice whatsapp support
This commit is contained in:
12
.gitattributes
vendored
Executable file
12
.gitattributes
vendored
Executable file
@@ -0,0 +1,12 @@
|
|||||||
|
* text=auto
|
||||||
|
*.sh text eol=lf
|
||||||
|
Dockerfile eol=lf
|
||||||
|
docker-compose.yml eol=lf
|
||||||
|
docker-compose.*.yml eol=lf
|
||||||
|
*.jpg binary
|
||||||
|
*.png binary
|
||||||
|
*.gif binary
|
||||||
|
*.woff binary
|
||||||
|
*.tff binary
|
||||||
|
*.eot binary
|
||||||
|
*.otf binary
|
||||||
@@ -2,4 +2,5 @@
|
|||||||
*Dockerfile*
|
*Dockerfile*
|
||||||
*docker-compose*
|
*docker-compose*
|
||||||
node_modules
|
node_modules
|
||||||
dist
|
dist
|
||||||
|
.wwebjs_auth
|
||||||
2
backend/.gitignore
vendored
2
backend/.gitignore
vendored
@@ -14,3 +14,5 @@ yarn-error.log
|
|||||||
# Ignore test-related files
|
# Ignore test-related files
|
||||||
/coverage.data
|
/coverage.data
|
||||||
/coverage/
|
/coverage/
|
||||||
|
|
||||||
|
.wwebjs_auth/
|
||||||
@@ -42,14 +42,18 @@ export const initWbot = async (whatsapp: Whatsapp): Promise<Session> => {
|
|||||||
if (whatsapp && whatsapp.session) {
|
if (whatsapp && whatsapp.session) {
|
||||||
sessionCfg = JSON.parse(whatsapp.session);
|
sessionCfg = JSON.parse(whatsapp.session);
|
||||||
}
|
}
|
||||||
|
|
||||||
const wbot: Session = new Client({
|
const args:String = process.env.CHROME_ARGS || "";
|
||||||
|
|
||||||
|
const wbot: Session = new Client({
|
||||||
session: sessionCfg,
|
session: sessionCfg,
|
||||||
authStrategy: new LocalAuth({clientId: 'bd_'+whatsapp.id}),
|
authStrategy: new LocalAuth({clientId: 'bd_'+whatsapp.id}),
|
||||||
puppeteer: {
|
puppeteer: {
|
||||||
args: ['--no-sandbox', '--disable-setuid-sandbox'],
|
executablePath: process.env.CHROME_BIN || undefined,
|
||||||
executablePath: process.env.CHROME_BIN || undefined
|
// @ts-ignore
|
||||||
},
|
browserWSEndpoint: process.env.CHROME_WS || undefined,
|
||||||
|
args: args.split(' ')
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
wbot.initialize();
|
wbot.initialize();
|
||||||
@@ -73,9 +77,6 @@ export const initWbot = async (whatsapp: Whatsapp): Promise<Session> => {
|
|||||||
|
|
||||||
wbot.on("authenticated", async session => {
|
wbot.on("authenticated", async session => {
|
||||||
logger.info(`Session: ${sessionName} AUTHENTICATED`);
|
logger.info(`Session: ${sessionName} AUTHENTICATED`);
|
||||||
// await whatsapp.update({
|
|
||||||
// session: JSON.stringify(session)
|
|
||||||
// });
|
|
||||||
});
|
});
|
||||||
|
|
||||||
wbot.on("auth_failure", async msg => {
|
wbot.on("auth_failure", async msg => {
|
||||||
@@ -151,4 +152,4 @@ export const removeWbot = (whatsappId: number): void => {
|
|||||||
} catch (err) {
|
} catch (err) {
|
||||||
logger.error(err);
|
logger.error(err);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@@ -24,6 +24,7 @@ services:
|
|||||||
- ${BACKEND_PORT:-8080}:3000
|
- ${BACKEND_PORT:-8080}:3000
|
||||||
volumes:
|
volumes:
|
||||||
- ./backend/public/:/usr/src/app/public/
|
- ./backend/public/:/usr/src/app/public/
|
||||||
|
- ./backend/.wwebjs_auth/:/usr/src/app/.wwebjs_auth/
|
||||||
networks:
|
networks:
|
||||||
- whaticket
|
- whaticket
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user