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