Skip to content

Commit

Permalink
check session id to include the user id
Browse files Browse the repository at this point in the history
  • Loading branch information
hfxbse committed May 1, 2024
1 parent 0850f13 commit ce33e92
Showing 1 changed file with 13 additions and 5 deletions.
18 changes: 13 additions & 5 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,12 +49,20 @@ async function twoFactor({verification, info}: {
}

async function readExistingSessionId(): Promise<SessionData> {
const sessionId = await prompt.password({message: "Session id: "})
while (true) {
const sessionId = await prompt.password({message: "Session id: "})
const userId = parseInt(sessionId.split("%")[0], 10)

if(isNaN(userId)) {
console.log("Session id seems to be invalid. Try again.")
continue
}

return {
id: sessionId,
user: {
id: parseInt(sessionId.split("%")[0], 10)
return {
id: sessionId,
user: {
id: parseInt(sessionId.split("%")[0], 10)
}
}
}
}
Expand Down

0 comments on commit ce33e92

Please sign in to comment.