mirror of
https://github.com/cheveguerra/whaticket-community.git
synced 2026-04-20 20:59:16 +00:00
Merge branch 'canove:master' into feature/save-rate-audio
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -1,3 +1,4 @@
|
|||||||
.docker/data/
|
.docker/data/
|
||||||
ssl/
|
ssl/
|
||||||
.env
|
.env
|
||||||
|
.wwebjs_auth
|
||||||
|
|||||||
@@ -39,7 +39,7 @@
|
|||||||
"sequelize-typescript": "^1.1.0",
|
"sequelize-typescript": "^1.1.0",
|
||||||
"socket.io": "^3.0.5",
|
"socket.io": "^3.0.5",
|
||||||
"uuid": "^8.3.2",
|
"uuid": "^8.3.2",
|
||||||
"whatsapp-web.js": "^1.15.8",
|
"whatsapp-web.js": "^1.17.1",
|
||||||
"yup": "^0.32.8"
|
"yup": "^0.32.8"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import qrCode from "qrcode-terminal";
|
import qrCode from "qrcode-terminal";
|
||||||
import { Client } from "whatsapp-web.js";
|
import { Client, LocalAuth } from "whatsapp-web.js";
|
||||||
import { getIO } from "./socket";
|
import { getIO } from "./socket";
|
||||||
import Whatsapp from "../models/Whatsapp";
|
import Whatsapp from "../models/Whatsapp";
|
||||||
import AppError from "../errors/AppError";
|
import AppError from "../errors/AppError";
|
||||||
@@ -43,16 +43,13 @@ export const initWbot = async (whatsapp: Whatsapp): Promise<Session> => {
|
|||||||
sessionCfg = JSON.parse(whatsapp.session);
|
sessionCfg = JSON.parse(whatsapp.session);
|
||||||
}
|
}
|
||||||
|
|
||||||
const args:String = process.env.CHROME_ARGS || "";
|
|
||||||
|
|
||||||
const wbot: Session = new Client({
|
const wbot: Session = new Client({
|
||||||
session: sessionCfg,
|
session: sessionCfg,
|
||||||
|
authStrategy: new LocalAuth({clientId: 'bd_'+whatsapp.id}),
|
||||||
puppeteer: {
|
puppeteer: {
|
||||||
executablePath: process.env.CHROME_BIN || undefined,
|
args: ['--no-sandbox', '--disable-setuid-sandbox'],
|
||||||
// @ts-ignore
|
executablePath: process.env.CHROME_BIN || undefined
|
||||||
browserWSEndpoint: process.env.CHROME_WS || undefined,
|
},
|
||||||
args: args.split(' ')
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
|
|
||||||
wbot.initialize();
|
wbot.initialize();
|
||||||
@@ -76,9 +73,9 @@ 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({
|
// await whatsapp.update({
|
||||||
session: JSON.stringify(session)
|
// session: JSON.stringify(session)
|
||||||
});
|
// });
|
||||||
});
|
});
|
||||||
|
|
||||||
wbot.on("auth_failure", async msg => {
|
wbot.on("auth_failure", async msg => {
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
import { getIO } from "../../libs/socket";
|
import { getIO } from "../../libs/socket";
|
||||||
import Message from "../../models/Message";
|
import Message from "../../models/Message";
|
||||||
import Ticket from "../../models/Ticket";
|
import Ticket from "../../models/Ticket";
|
||||||
|
import Whatsapp from "../../models/Whatsapp";
|
||||||
|
|
||||||
interface MessageData {
|
interface MessageData {
|
||||||
id: string;
|
id: string;
|
||||||
@@ -27,7 +28,14 @@ const CreateMessageService = async ({
|
|||||||
{
|
{
|
||||||
model: Ticket,
|
model: Ticket,
|
||||||
as: "ticket",
|
as: "ticket",
|
||||||
include: ["contact", "queue"]
|
include: [
|
||||||
|
"contact", "queue",
|
||||||
|
{
|
||||||
|
model: Whatsapp,
|
||||||
|
as: "whatsapp",
|
||||||
|
attributes: ["name"]
|
||||||
|
}
|
||||||
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
model: Message,
|
model: Message,
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ import AppError from "../../errors/AppError";
|
|||||||
import Contact from "../../models/Contact";
|
import Contact from "../../models/Contact";
|
||||||
import User from "../../models/User";
|
import User from "../../models/User";
|
||||||
import Queue from "../../models/Queue";
|
import Queue from "../../models/Queue";
|
||||||
|
import Whatsapp from "../../models/Whatsapp";
|
||||||
|
|
||||||
const ShowTicketService = async (id: string | number): Promise<Ticket> => {
|
const ShowTicketService = async (id: string | number): Promise<Ticket> => {
|
||||||
const ticket = await Ticket.findByPk(id, {
|
const ticket = await Ticket.findByPk(id, {
|
||||||
@@ -22,6 +23,11 @@ const ShowTicketService = async (id: string | number): Promise<Ticket> => {
|
|||||||
model: Queue,
|
model: Queue,
|
||||||
as: "queue",
|
as: "queue",
|
||||||
attributes: ["id", "name", "color"]
|
attributes: ["id", "name", "color"]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
model: Whatsapp,
|
||||||
|
as: "whatsapp",
|
||||||
|
attributes: ["name"]
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -105,14 +105,14 @@ const useStyles = makeStyles(theme => ({
|
|||||||
marginRight: 5,
|
marginRight: 5,
|
||||||
right: 5,
|
right: 5,
|
||||||
bottom: 5,
|
bottom: 5,
|
||||||
background:"#2576D2",
|
background: "#2576D2",
|
||||||
color: "#ffffff",
|
color: "#ffffff",
|
||||||
border:"1px solid #CCC",
|
border: "1px solid #CCC",
|
||||||
padding: 1,
|
padding: 1,
|
||||||
paddingLeft: 5,
|
paddingLeft: 5,
|
||||||
paddingRight: 5,
|
paddingRight: 5,
|
||||||
borderRadius: 10,
|
borderRadius: 10,
|
||||||
fontSize: "1em"
|
fontSize: "0.9em"
|
||||||
},
|
},
|
||||||
}));
|
}));
|
||||||
|
|
||||||
@@ -212,7 +212,7 @@ const TicketListItem = ({ ticket }) => {
|
|||||||
</Typography>
|
</Typography>
|
||||||
)}
|
)}
|
||||||
{ticket.whatsappId && (
|
{ticket.whatsappId && (
|
||||||
<div className={classes.userTag} title={i18n.t("ticketsList.connectionTitle")}>{ticket.whatsapp.name}</div>
|
<div className={classes.userTag} title={i18n.t("ticketsList.connectionTitle")}>{ticket.whatsapp?.name}</div>
|
||||||
)}
|
)}
|
||||||
</span>
|
</span>
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,7 +18,7 @@ import {
|
|||||||
InputAdornment,
|
InputAdornment,
|
||||||
IconButton,
|
IconButton,
|
||||||
Link
|
Link
|
||||||
} from '@material-ui/core';
|
} from '@material-ui/core';
|
||||||
|
|
||||||
import { LockOutlined, Visibility, VisibilityOff } from '@material-ui/icons';
|
import { LockOutlined, Visibility, VisibilityOff } from '@material-ui/icons';
|
||||||
|
|
||||||
@@ -178,7 +178,7 @@ const SignUp = () => {
|
|||||||
>
|
>
|
||||||
{i18n.t("signup.buttons.submit")}
|
{i18n.t("signup.buttons.submit")}
|
||||||
</Button>
|
</Button>
|
||||||
<Grid container justify="flex-end">
|
<Grid container justifyContent="flex-end">
|
||||||
<Grid item>
|
<Grid item>
|
||||||
<Link
|
<Link
|
||||||
href="#"
|
href="#"
|
||||||
|
|||||||
Reference in New Issue
Block a user