Skip to content

Commit

Permalink
release 2.6.0
Browse files Browse the repository at this point in the history
  • Loading branch information
hafiziruslan committed Aug 6, 2024
1 parent e5d383c commit b15351f
Show file tree
Hide file tree
Showing 3 changed files with 69 additions and 14 deletions.
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
## 2.6.0 (2024-08-05)

## Bug Fixes
- **deps:** update dependency @wppconnect-team/wppconnect to ^1.32.4 ([550ff5d](https://github.com/wppconnect-team/wppconnect-server/commit/550ff5d13f13d55585119b3f1dbba517ccddb8cc))
- **deps:** update dependency @wppconnect-team/wppconnect to ^1.33.0 ([#1978](https://github.com/wppconnect-team/wppconnect-server/issues/1978)) ([fdc30a8](https://github.com/wppconnect-team/wppconnect-server/commit/fdc30a8af41ebc8d73493c9857b6ff48b8fa8ea3))

## Features

-- Added login by code support ([#1959](https://github.com/wppconnect-team/wppconnect-server/issues/1959)) ([0e60d34](https://github.com/wppconnect-team/wppconnect-server/commit/0e60d343b0cfadb288f22a704dd63a2ea2733f8e))

## 2.5.2 (2024-06-24)

### Bug Fixes
Expand Down
14 changes: 7 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@wppconnect/server",
"version": "2.5.2",
"version": "2.6.0",
"description": "Project designed to dynamically authenticate WhatsApp Web automation with multi-clients. Backend made in Nodejs (express, socketio), FrontEnd (ReactJS)",
"main": "dist/index.js",
"author": "kingaspx",
Expand Down Expand Up @@ -28,8 +28,8 @@
"test": "jest"
},
"dependencies": {
"@aws-sdk/client-s3": "^3.623.0",
"@wppconnect-team/wppconnect": "^1.32.4",
"@aws-sdk/client-s3": "^3.624.0",
"@wppconnect-team/wppconnect": "^1.33.0",
"archiver": "^7.0.1",
"axios": "^1.7.3",
"bcrypt": "^5.1.1",
Expand All @@ -44,7 +44,7 @@
"merge-deep": "^3.0.3",
"moment": "^2.30.1",
"multer": "^1.4.5-lts.1",
"qrcode": "^1.5.3",
"qrcode": "^1.5.4",
"socket.io": "^4.7.5",
"swagger-autogen": "^2.23.7",
"swagger-ui-express": "^5.0.1",
Expand Down Expand Up @@ -77,9 +77,9 @@
"@types/qrcode": "^1.5.5",
"@types/swagger-ui-express": "^4.1.6",
"@types/unzipper": "^0.10.9",
"@typescript-eslint/eslint-plugin": "^8.0.0",
"@typescript-eslint/parser": "^8.0.0",
"@typescript-eslint/typescript-estree": "^8.0.0",
"@typescript-eslint/eslint-plugin": "^8.0.1",
"@typescript-eslint/parser": "^8.0.1",
"@typescript-eslint/typescript-estree": "^8.0.1",
"commitizen": "^4.3.0",
"conventional-changelog-cli": "^5.0.0",
"crypto-js": "^4.2.0",
Expand Down
59 changes: 52 additions & 7 deletions src/util/createSessionUtil.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,8 @@ export default class CreateSessionUtil {
const myTokenStore = tokenStore.createTokenStory(client);
const tokenData = await myTokenStore.getToken(session);

if (!tokenData) {
myTokenStore.setToken(session, {});
}
// we need this to update phone in config every time session starts, so we can ask for code for it again.
myTokenStore.setToken(session, tokenData ?? {});

this.startChatWootClient(client);

Expand All @@ -68,12 +67,22 @@ export default class CreateSessionUtil {
req.serverOptions.createOptions,
{
session: session,
phoneNumber: client.config.phone ?? null,
deviceName:
client.config?.deviceName || req.serverOptions.deviceName,
client.config.phone == undefined // bug when using phone code this shouldn't be passed (https://github.com/wppconnect-team/wppconnect-server/issues/1687#issuecomment-2099357874)
? client.config?.deviceName ||
req.serverOptions.deviceName ||
'WppConnect'
: undefined,
poweredBy:
client.config?.poweredBy ||
req.serverOptions.poweredBy ||
'WPPConnect-Server',
client.config.phone == undefined // bug when using phone code this shouldn't be passed (https://github.com/wppconnect-team/wppconnect-server/issues/1687#issuecomment-2099357874)
? client.config?.poweredBy ||
req.serverOptions.poweredBy ||
'WPPConnect-Server'
: undefined,
catchLinkCode: (code: string) => {
this.exportPhoneCode(req, client.config.phone, code, client, res);
},
catchQR: (
base64Qr: any,
asciiQR: any,
Expand Down Expand Up @@ -142,6 +151,42 @@ export default class CreateSessionUtil {
await this.createSessionUtil(req, clientsArray, session, res);
}

exportPhoneCode(
req: any,
phone: any,
phoneCode: any,
client: WhatsAppServer,
res?: any,
) {
eventEmitter.emit(`phoneCode-${client.session}`, phoneCode, client);

Object.assign(client, {
status: 'PHONECODE',
phoneCode: phoneCode,
phone: phone,
});

req.io.emit('phoneCode', {
data: phoneCode,
phone: phone,
session: client.session,
});

callWebHook(client, req, 'phoneCode', {
phoneCode: phoneCode,
phone: phone,
session: client.session,
});

if (res && !res._headerSent)
res.status(200).json({
status: 'phoneCode',
phone: phone,
phoneCode: phoneCode,
session: client.session,
});
}

exportQR(
req: any,
qrCode: any,
Expand Down

0 comments on commit b15351f

Please sign in to comment.