Skip to content

Commit

Permalink
Added additional QR code container check
Browse files Browse the repository at this point in the history
  • Loading branch information
ghayman committed Oct 31, 2024
1 parent 91596f6 commit a21267d
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 3 deletions.
11 changes: 11 additions & 0 deletions app.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ try {
session: 'sessionName_0001',
headless: false,
devtools: true,
useChrome: false,
})
.then((client) => start(client))
.catch(async (err) => {
Expand Down Expand Up @@ -53,6 +54,16 @@ async function start(client) {
}
});

client.onStateChange((state) => {
console.log("State change: " + client.session);
console.log("State change: " + state);
})

client.onStreamChange((stream) => {
console.log("Stream change: " + client.session);
console.log("Stream change: " + stream);
})

client.onMessageEdit((message) => {
console.log('EDIT!');
console.log(message);
Expand Down
11 changes: 8 additions & 3 deletions src/controllers/auth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,21 @@ export const getInterfaceStatus = async (waPage: puppeteer.Page) => {
if (erroHTTP && erroHTTP[0].innerText.includes('HTTP ERROR 429')) {
return { type: erroHTTP[0].innerText };
}
const elLoginWrapper = document.querySelector(
const elLoginWrapper1 = document.querySelector(
'body > div > div > .landing-wrapper'
);
const elLoginWrapper2 = document.querySelector(
'body > div > div > div > .landing-wrapper'
);
const elLoginWrapper3 = document.querySelector(
'body > div > div > div > div > div > .x1lliihq'
);

const elQRCodeCanvas = document.querySelector('canvas');
if (
(elLoginWrapper && elQRCodeCanvas) ||
(elLoginWrapper2 && elQRCodeCanvas)
(elLoginWrapper1 && elQRCodeCanvas) ||
(elLoginWrapper2 && elQRCodeCanvas) ||
(elLoginWrapper3 && elQRCodeCanvas)
) {
return 'UNPAIRED';
}
Expand Down

0 comments on commit a21267d

Please sign in to comment.