Skip to content

Commit

Permalink
fix: Removed clearsession on route 'close-session'
Browse files Browse the repository at this point in the history
  • Loading branch information
icleitoncosta committed Jun 5, 2023
1 parent 4512abf commit 1df6154
Showing 1 changed file with 0 additions and 10 deletions.
10 changes: 0 additions & 10 deletions src/controller/sessionController.ts
Expand Up @@ -235,18 +235,15 @@ export async function closeSession(req: Request, res: Response) {
schema: {
type: "object",
properties: {
clearSession: { type: "boolean" },
}
},
example: {
clearSession: false,
}
}
}
}
*/
const session = req.session;
const { clearSession = false } = req.body;
try {
if ((clientsArray as any)[session].status === null) {
return await res
Expand All @@ -255,13 +252,6 @@ export async function closeSession(req: Request, res: Response) {
} else {
(clientsArray as any)[session] = { status: null };

if (clearSession) {
const sessionFolder = `${config.customUserDataDir}/${session}`;
if (fs.existsSync(sessionFolder)) {
console.log('Deletando pasta: ' + sessionFolder);
fs.rmdirSync(sessionFolder, { recursive: true });
}
}
await req.client.close();
req.io.emit('whatsapp-status', false);
callWebHook(req.client, req, 'closesession', {
Expand Down

3 comments on commit 1df6154

@Saifallak
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't this breaking change for existing users like me?
@icleitoncosta
Is there reason for that?

@icleitoncosta
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't this breaking change for existing users like me?
@icleitoncosta
Is there reason for that?

The route was inserted in the wrong place, causing crashes in some operating systems, so I kept it only in the correct location: logout-session.

@Saifallak
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

okay, just wanted to metion that it's a BC, so it must be said in releases page.

Please sign in to comment.