mirror of
https://github.com/cheveguerra/whaticket-community.git
synced 2026-04-18 19:59:20 +00:00
🗑added public folder content to gitignore
This commit is contained in:
4
backend/.gitignore
vendored
4
backend/.gitignore
vendored
@@ -1,4 +1,4 @@
|
||||
node_modules
|
||||
public/*
|
||||
!public/.gitkeep
|
||||
/src/public/*
|
||||
!src/public/.gitkeep
|
||||
.env
|
||||
@@ -14,9 +14,7 @@ module.exports = (req, res, next) => {
|
||||
}
|
||||
|
||||
if (!decodedToken) {
|
||||
const error = new Error("Falha na autenticação");
|
||||
error.statusCode = 401;
|
||||
next(error);
|
||||
return res.status(401).json({ message: "Unauthorized" });
|
||||
}
|
||||
|
||||
next();
|
||||
|
||||
Binary file not shown.
@@ -1,23 +0,0 @@
|
||||
--- vm produção
|
||||
|
||||
MariaDB: root/nodecomplete
|
||||
MariaDB: botter / 103economicros
|
||||
dbName: econo_whatsbot
|
||||
|
||||
Libs necessárias para o Puppter no linux:
|
||||
sudo apt-get install -y libgbm-dev wget unzip fontconfig locales gconf-service libasound2 libatk1.0-0 libc6 libcairo2 libcups2 libdbus-1-3 libexpat1 libfontconfig1 libgcc1 libgconf-2-4 libgdk-pixbuf2.0-0 libglib2.0-0 libgtk-3-0 libnspr4 libpango-1.0-0 libpangocairo-1.0-0 libstdc++6 libx11-6 libx11-xcb1 libxcb1 libxcomposite1 libxcursor1 libxdamage1 libxext6 libxfixes3 libxi6 libxrandr2 libxrender1 libxss1 libxtst6 ca-certificates fonts-liberation libappindicator1 libnss3 lsb-release xdg-utils
|
||||
|
||||
|
||||
-- configuração wsl2
|
||||
|
||||
https://docs.microsoft.com/pt-br/windows/wsl/wsl2-kernel
|
||||
|
||||
wsl --set-default-version 2
|
||||
|
||||
docker run --name whats_database -e MYSQL_ROOT_PASSWORD=103economicros --restart always -p 3306:3306 -d mariadb:latest
|
||||
docker exec -it whats_database bash
|
||||
|
||||
CREATE DATABASE econo_whatsbot;
|
||||
ALTER DATABASE econo_whatsbot CHARACTER SET utf8mb4 COLLATE utf8mb4_bin;
|
||||
CREATE USER 'botter'@'%' IDENTIFIED BY 'botter';
|
||||
GRANT ALL PRIVILEGES ON econo_whatsbot.* TO 'botter'@'%';
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -6,7 +6,6 @@ const ContactController = require("../controllers/ContactController");
|
||||
const routes = express.Router();
|
||||
|
||||
routes.get("/contacts", isAuth, ContactController.index);
|
||||
// routes.post(ContactController.postCreateContact);
|
||||
|
||||
routes.post("/contacts", isAuth, ContactController.store);
|
||||
|
||||
|
||||
@@ -6,6 +6,7 @@ const MessageController = require("../controllers/MessageController");
|
||||
const routes = express.Router();
|
||||
|
||||
routes.get("/messages/:contactId", isAuth, MessageController.index);
|
||||
|
||||
routes.post("/messages/:contactId", isAuth, MessageController.store);
|
||||
|
||||
module.exports = routes;
|
||||
|
||||
@@ -14,8 +14,7 @@ const wbotMessageListener = () => {
|
||||
wbot.on("message", async msg => {
|
||||
console.log(msg);
|
||||
let newMessage;
|
||||
// console.log(msg);
|
||||
if (msg.from === "status@broadcast") {
|
||||
if (msg.from === "status@broadcast" || msg.type === "location") {
|
||||
return;
|
||||
}
|
||||
try {
|
||||
@@ -28,9 +27,7 @@ const wbotMessageListener = () => {
|
||||
|
||||
if (contact) {
|
||||
await contact.update({ profilePicUrl: profilePicUrl });
|
||||
}
|
||||
|
||||
if (!contact) {
|
||||
} else {
|
||||
try {
|
||||
contact = await Contact.create({
|
||||
name: msgContact.pushname || msgContact.number.toString(),
|
||||
@@ -81,24 +78,26 @@ const wbotMessageListener = () => {
|
||||
await contact.update({ lastMessage: msg.body });
|
||||
}
|
||||
|
||||
io.to(contact.id)
|
||||
.to("notification")
|
||||
.emit("appMessage", {
|
||||
action: "create",
|
||||
message: {
|
||||
...newMessage.dataValues,
|
||||
mediaUrl: `${
|
||||
newMessage.mediaUrl
|
||||
? `http://${process.env.HOST}:${process.env.PORT}/public/${newMessage.mediaUrl}`
|
||||
: ""
|
||||
}`,
|
||||
},
|
||||
contact: {
|
||||
...contact.dataValues,
|
||||
unreadMessages: 1,
|
||||
lastMessage: newMessage.messageBody,
|
||||
},
|
||||
});
|
||||
const serializedMessage = {
|
||||
...newMessage.dataValues,
|
||||
mediaUrl: `${
|
||||
newMessage.mediaUrl
|
||||
? `http://${process.env.HOST}:${process.env.PORT}/public/${newMessage.mediaUrl}`
|
||||
: ""
|
||||
}`,
|
||||
};
|
||||
|
||||
const serializaedContact = {
|
||||
...contact.dataValues,
|
||||
unreadMessages: 1,
|
||||
lastMessage: newMessage.messageBody,
|
||||
};
|
||||
|
||||
io.to(contact.id).to("notification").emit("appMessage", {
|
||||
action: "create",
|
||||
message: serializedMessage,
|
||||
contact: serializaedContact,
|
||||
});
|
||||
|
||||
let chat = await msg.getChat();
|
||||
chat.sendSeen();
|
||||
|
||||
Reference in New Issue
Block a user