Skip to content

Commit

Permalink
Fix overloaded jar in CSRF and wss based methods (#419)
Browse files Browse the repository at this point in the history
* Simplify jar overloading by permitting strings

* Make getCurrentUser() options case-insensitive

* Fix overloaded jar in CSRF and wss based methods

* Trigger Build

Co-authored-by: suufi <[email protected]>
Co-authored-by: Neztore <[email protected]>
  • Loading branch information
3 people authored Sep 23, 2021
1 parent ef5377e commit ddb663d
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 2 deletions.
3 changes: 3 additions & 0 deletions lib/user/onNotification.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@ exports.func = function (args) {
const max = settings.event.maxRetries
const notifications = new events.EventEmitter()
function connect (retries) {
if (typeof args.jar === 'string') {
args.jar = { session: args.jar }
}
const session = getSession({ jar: args.jar })
const client = new SignalR('wss://realtime.roblox.com/notifications', ['usernotificationhub'], 3, true) // wss for https
client.headers.Cookie = '.ROBLOSECURITY=' + session + ';'
Expand Down
7 changes: 5 additions & 2 deletions lib/util/getHash.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,10 @@ exports.optional = ['jar']
**/

// Define
exports.func = function (args) {
const session = getSession({ jar: args.jar })
exports.func = function ({ jar }) {
if (typeof jar === 'string') {
jar = { session: jar }
}
const session = getSession({ jar })
return crypto.createHash('md5').update(session).digest('hex')
}
3 changes: 3 additions & 0 deletions lib/util/getSession.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,9 @@ exports.optional = ['jar']
exports.func = function (args) {
const jar = args.jar || options.jar
if (settings.session_only) {
if (typeof jar === 'string') {
return jar
}
return jar.session
} else {
const cookies = jar.getCookies('https://roblox.com')
Expand Down

0 comments on commit ddb663d

Please sign in to comment.