diff --git a/README.md b/README.md
index 23b9ab3..35dd20b 100644
--- a/README.md
+++ b/README.md
@@ -368,13 +368,15 @@ sudo service nginx restart
Now, enable SSL (https) on your sites to use all app features like notifications and sending audio messages. A easy way to this is using Certbot:
-Install certbor with snapd:
+Install certbot:
```bash
-sudo snap install --classic certbot
+sudo add-apt-repository ppa:certbot/certbot
+sudo apt update
+sudo apt install python-certbot-nginx
```
-Enable SSL on nginx (Accept all information asked):
+Enable SSL on nginx (Fill / Accept all information asked):
```bash
sudo certbot --nginx
@@ -423,20 +425,13 @@ chmod +x updateWhaticket
This project helps you and you want to help keep it going? Buy me a coffee:
-
+
-Para doações em BRL, você pode doar utilizando o Paypal:
+Para doações em BRL, utilize o Paypal:
-
+[](https://www.paypal.com/donate?business=VWW3BHW4AWHUY&item_name=Desenvolvimento+de+Software¤cy_code=BRL)
-Any help and suggestions are welcome!
+Any help and suggestions will be apreciated.
## Disclaimer
diff --git a/backend/package.json b/backend/package.json
index 8d2f9d8..ffa20a3 100644
--- a/backend/package.json
+++ b/backend/package.json
@@ -15,7 +15,7 @@
"author": "",
"license": "MIT",
"dependencies": {
- "@sentry/node": "5.27.0",
+ "@sentry/node": "^5.29.2",
"@types/pino": "^6.3.4",
"bcryptjs": "^2.4.3",
"cookie-parser": "^1.4.5",
@@ -36,9 +36,9 @@
"sequelize": "^5.22.3",
"sequelize-cli": "^5.5.1",
"sequelize-typescript": "^1.1.0",
- "socket.io": "^2.3.0",
- "whatsapp-web.js": "1.11.1",
- "yup": "^0.29.3"
+ "socket.io": "^3.0.5",
+ "whatsapp-web.js": "^1.12.0",
+ "yup": "^0.32.8"
},
"devDependencies": {
"@types/bcryptjs": "^2.4.2",
diff --git a/backend/src/controllers/MessageController.ts b/backend/src/controllers/MessageController.ts
index a381676..21f90aa 100644
--- a/backend/src/controllers/MessageController.ts
+++ b/backend/src/controllers/MessageController.ts
@@ -30,7 +30,7 @@ export const index = async (req: Request, res: Response): Promise => {
ticketId
});
- await SetTicketMessagesAsRead(ticket);
+ SetTicketMessagesAsRead(ticket);
return res.json({ count, messages, ticket, hasMore });
};
@@ -42,7 +42,7 @@ export const store = async (req: Request, res: Response): Promise => {
const ticket = await ShowTicketService(ticketId);
- await SetTicketMessagesAsRead(ticket);
+ SetTicketMessagesAsRead(ticket);
if (medias) {
await Promise.all(
diff --git a/backend/src/libs/socket.ts b/backend/src/libs/socket.ts
index d7eff50..7169e23 100644
--- a/backend/src/libs/socket.ts
+++ b/backend/src/libs/socket.ts
@@ -1,4 +1,4 @@
-import socketIo, { Server as SocketIO } from "socket.io";
+import { Server as SocketIO } from "socket.io";
import { Server } from "http";
import AppError from "../errors/AppError";
import { logger } from "../utils/logger";
@@ -6,11 +6,15 @@ import { logger } from "../utils/logger";
let io: SocketIO;
export const initIO = (httpServer: Server): SocketIO => {
- io = socketIo(httpServer);
+ io = new SocketIO(httpServer, {
+ cors: {
+ origin: process.env.FRONTEND_URL
+ }
+ });
io.on("connection", socket => {
logger.info("Client Connected");
- socket.on("joinChatBox", ticketId => {
+ socket.on("joinChatBox", (ticketId: string) => {
logger.info("A client joined a ticket channel");
socket.join(ticketId);
});
@@ -20,7 +24,7 @@ export const initIO = (httpServer: Server): SocketIO => {
socket.join("notification");
});
- socket.on("joinTickets", status => {
+ socket.on("joinTickets", (status: string) => {
logger.info(`A client joined to ${status} tickets channel.`);
socket.join(status);
});
@@ -31,6 +35,7 @@ export const initIO = (httpServer: Server): SocketIO => {
});
return io;
};
+
export const getIO = (): SocketIO => {
if (!io) {
throw new AppError("Socket IO not initialized");
diff --git a/backend/src/services/WbotServices/wbotMessageListener.ts b/backend/src/services/WbotServices/wbotMessageListener.ts
index 28237ed..3651b65 100644
--- a/backend/src/services/WbotServices/wbotMessageListener.ts
+++ b/backend/src/services/WbotServices/wbotMessageListener.ts
@@ -239,11 +239,13 @@ const handleMessage = async (
groupContact = await verifyContact(msgGroupContact);
}
+ const unreadMessages = msg.fromMe ? 0 : chat.unreadCount;
+
const contact = await verifyContact(msgContact);
const ticket = await FindOrCreateTicketService(
contact,
wbot.id!,
- chat.unreadCount,
+ unreadMessages,
groupContact
);
diff --git a/frontend/package.json b/frontend/package.json
index 9c27aa8..c316de3 100644
--- a/frontend/package.json
+++ b/frontend/package.json
@@ -25,10 +25,10 @@
"react-router-dom": "^5.2.0",
"react-scripts": "3.4.3",
"react-toastify": "^6.0.9",
- "recharts": "^1.8.5",
- "socket.io-client": "^2.3.1",
- "use-sound": "^1.0.2",
- "yup": "^0.29.3"
+ "recharts": "^2.0.2",
+ "socket.io-client": "^3.0.5",
+ "use-sound": "^2.0.1",
+ "yup": "^0.32.8"
},
"scripts": {
"start": "react-scripts start",