Comparing version 2.2.1 to 2.2.2
@@ -14,8 +14,44 @@ // Dependencies | ||
// Define | ||
function getId (body, username) { | ||
var $ = parser.load(body); | ||
return $('#JoinRequestsList').find('td:contains(\'' + username + '\')').parent().find('[data-rbx-join-request]').attr('data-rbx-join-request'); // Yes this is technically vulnerable to injection, but the module will assume that whoever is entering information is correctly sanitizing it. | ||
} | ||
function search (jar, searchUrl, group, username, resolve, reject) { | ||
var httpOpt = { | ||
url: '//www.roblox.com' + searchUrl + '?groupId=' + group + '&username=' + username, | ||
options: { | ||
jar: jar, | ||
headers: { | ||
'Cache-Control': 'max-age=0' | ||
}, | ||
followRedirect: false, | ||
resolveWithFullResponse: true | ||
} | ||
}; | ||
http(httpOpt) | ||
.then(function (res) { | ||
if (res.statusCode === 200) { | ||
var body = res.body; | ||
var id = getId(body, username); | ||
if (id) { | ||
resolve(id); | ||
} else { | ||
reject(new Error('No join request was found with that username')); | ||
} | ||
} else { | ||
reject(new Error('Couldn\'t load search API')); | ||
} | ||
}); | ||
} | ||
function joinRequestId (jar, group, username) { | ||
return function (resolve, reject) { | ||
var httpOpt = { | ||
url: '//www.roblox.com/My/GroupAdmin.aspx?gid=' + group, | ||
url: '//www.roblox.com/my/groupadmin.aspx?gid=' + group, | ||
options: { | ||
jar: jar, | ||
headers: { | ||
'Cache-Control': 'max-age=0' | ||
}, | ||
followRedirect: false, | ||
@@ -29,19 +65,8 @@ resolveWithFullResponse: true | ||
var body = res.body; | ||
var searchUrl = body.match(/Roblox\.GroupAdmin\.InitializeGlobalVars\(.*".*", "(.*)", .*\)/)[1]; | ||
var httpOpt = { | ||
url: '//www.roblox.com' + searchUrl + '?groupId=' + group + '&username=' + username, | ||
options: { | ||
jar: jar | ||
} | ||
}; | ||
http(httpOpt) | ||
.then(function (body) { | ||
var $ = parser.load(body); | ||
var id = $('[data-rbx-join-request]').attr('data-rbx-join-request'); | ||
if (id) { | ||
resolve(id); | ||
} else { | ||
reject(new Error('No join request was found with that username')); | ||
} | ||
}); | ||
var id = getId(body, username); | ||
if (id) { | ||
resolve(id); | ||
} else { | ||
search(jar, body.match(/Roblox\.GroupAdmin\.InitializeGlobalVars\(.*".*", "(.*)", .*\)/)[1], group, username, resolve, reject); | ||
} | ||
} else { | ||
@@ -48,0 +73,0 @@ reject(new Error('Group admin page load failed, make sure the user is logged in, in the group, and allowed to handle join requests')); |
{ | ||
"name": "roblox-js", | ||
"version": "2.2.1", | ||
"version": "2.2.2", | ||
"description": "A node module that provides an interface for performing actions on ROBLOX, mostly for use with their HttpService feature.", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
73153
1663