Comparing version 4.9.0 to 4.10.0
@@ -1,5 +0,9 @@ | ||
# v4.9.0 (Wed Aug 18 2021) | ||
# v4.9.0 (Thu Sep 23 2021) | ||
#### 🚀 Enhancement | ||
- Bump auto from 10.31.0 to 10.32.0 [#424](https://github.com/noblox/noblox.js/pull/424) ([@dependabot[bot]](https://github.com/dependabot[bot])) | ||
- Bump @auto-it/conventional-commits from 10.31.0 to 10.32.0 [#425](https://github.com/noblox/noblox.js/pull/425) ([@dependabot[bot]](https://github.com/dependabot[bot]) [@Neztore](https://github.com/Neztore)) | ||
- Bump jest from 27.1.1 to 27.2.1 [#427](https://github.com/noblox/noblox.js/pull/427) ([@dependabot[bot]](https://github.com/dependabot[bot]) [@Neztore](https://github.com/Neztore)) | ||
- Bump jest from 27.0.6 to 27.1.0 [#421](https://github.com/noblox/noblox.js/pull/421) ([@dependabot[bot]](https://github.com/dependabot[bot])) | ||
- Add uploadAnimation & getGroupAssets [#394](https://github.com/noblox/noblox.js/pull/394) ([@popeeyy](https://github.com/popeeyy) [@Neztore](https://github.com/Neztore) [@suufi](https://github.com/suufi)) | ||
@@ -12,2 +16,10 @@ - Implement searchGroups [#404](https://github.com/noblox/noblox.js/pull/404) ([@Neztore](https://github.com/Neztore) [@suufi](https://github.com/suufi)) | ||
- Fix overloaded jar in CSRF and wss based methods [#419](https://github.com/noblox/noblox.js/pull/419) ([@alanbixby](https://github.com/alanbixby) [@suufi](https://github.com/suufi) [@Neztore](https://github.com/Neztore)) | ||
- Bump eslint-plugin-jest from 24.4.0 to 24.4.2 [#426](https://github.com/noblox/noblox.js/pull/426) ([@dependabot[bot]](https://github.com/dependabot[bot]) [@Neztore](https://github.com/Neztore)) | ||
- Bump tmpl from 1.0.4 to 1.0.5 [#428](https://github.com/noblox/noblox.js/pull/428) ([@dependabot[bot]](https://github.com/dependabot[bot]) [@Neztore](https://github.com/Neztore)) | ||
- Bump nth-check from 2.0.0 to 2.0.1 [#430](https://github.com/noblox/noblox.js/pull/430) ([@dependabot[bot]](https://github.com/dependabot[bot]) [@Neztore](https://github.com/Neztore)) | ||
- Bump jest from 27.1.0 to 27.1.1 [#422](https://github.com/noblox/noblox.js/pull/422) ([@dependabot[bot]](https://github.com/dependabot[bot]) [@suufi](https://github.com/suufi)) | ||
- Fix configureItem part 2 [#415](https://github.com/noblox/noblox.js/pull/415) ([@policetonyR](https://github.com/policetonyR) [@alanbixby](https://github.com/alanbixby) [@suufi](https://github.com/suufi)) | ||
- Bump eslint-plugin-import from 2.24.1 to 2.24.2 [#420](https://github.com/noblox/noblox.js/pull/420) ([@dependabot[bot]](https://github.com/dependabot[bot])) | ||
- Bump eslint-plugin-import from 2.24.0 to 2.24.1 [#416](https://github.com/noblox/noblox.js/pull/416) ([@dependabot[bot]](https://github.com/dependabot[bot]) [@suufi](https://github.com/suufi)) | ||
- Fix typo that is causing errors [#413](https://github.com/noblox/noblox.js/pull/413) ([@policetonyR](https://github.com/policetonyR) [@suufi](https://github.com/suufi)) | ||
@@ -26,2 +38,11 @@ - Bump path-parse from 1.0.6 to 1.0.7 [#410](https://github.com/noblox/noblox.js/pull/410) ([@dependabot[bot]](https://github.com/dependabot[bot])) | ||
#### ⚠️ Pushed to `master` | ||
- Try GITHUB_TOKEN ([@Neztore](https://github.com/Neztore)) | ||
- Rename GitHub token env. variable ([@suufi](https://github.com/suufi)) | ||
#### 🏠 Internal | ||
- Use GH_TOKEN instead of GITHUB_TOKEN for auto [#414](https://github.com/noblox/noblox.js/pull/414) ([@suufi](https://github.com/suufi)) | ||
#### 🔩 Dependency Updates | ||
@@ -28,0 +49,0 @@ |
@@ -18,8 +18,8 @@ // Includes | ||
* @param {boolean=} enableComments - Enable comments on your asset. | ||
* @param {number|boolean=} [sellForRobux=false] - The amount of robux to sell for | ||
* @param {number|boolean=} [sellForRobux=false] - The amount of robux to sell for; use a number for sellable assets, boolean for copyable assets | ||
* @param {string=} [genreSelection="All"] - The genre of your asset. | ||
* @returns {Promise<void>} | ||
* @returns {Promise<ConfigureItemResponse>} | ||
* @example const noblox = require("noblox.js") | ||
* // Login using your cookie | ||
* noblox.configureItem(1117747196, "Item", "A cool item.") | ||
* noblox.configureItem(1117747196, "Item", "A cool item.", false, 100) | ||
**/ | ||
@@ -29,3 +29,3 @@ | ||
function configure (jar, token, id, name, description, enableComments, sellForRobux, genreSelection, sellingPrice) { | ||
const httpOpt = { | ||
return http({ | ||
url: '//develop.roblox.com/v1/assets/' + id, | ||
@@ -46,7 +46,19 @@ options: { | ||
} | ||
} | ||
return http(httpOpt).then(function (json) { | ||
}).then(function (json) { | ||
if (!json.errors) { | ||
return { name: name, description: description, assetId: id, price: sellingPrice || 0 } | ||
const response = { | ||
name, | ||
description, | ||
assetId: id | ||
} | ||
if (typeof sellForRobux === 'boolean') { | ||
response.isCopyingAllowed = sellForRobux | ||
} else { | ||
response.price = sellingPrice || 0 | ||
} | ||
return response | ||
} else { | ||
if (json.errors[0].code === 13) { // "Only a marketplace asset can be updated with IsCopyingAllowed." | ||
throw new Error('Attempting to make a sellable asset copyable; it must be sold for robux. (Use a number for sellForRobux.)') | ||
} | ||
throw new Error(json.errors[0].message) | ||
@@ -58,3 +70,3 @@ } | ||
function configureRobux (args) { | ||
const httpOpt = { | ||
return http({ | ||
url: '//itemconfiguration.roblox.com/v1/assets/' + args.id + '/release', | ||
@@ -74,10 +86,40 @@ options: { | ||
} | ||
} | ||
return http(httpOpt).then(function (json) { | ||
if (!json.errors) { | ||
return configure(args.jar, args.token, args.id, args.name, args.description, args.enableComments, args.sellForRobux, args.genreSelection, args.sellForRobux) | ||
} else { | ||
throw new Error(json.errors[0].message) | ||
} | ||
}) | ||
.then(function (json) { | ||
if (!json.errors) { | ||
return configure(args.jar, args.token, args.id, args.name, args.description, args.enableComments, args.sellForRobux, args.genreSelection, args.sellForRobux) | ||
} else { | ||
// Code 6: "Asset is released"; caused when changing the price of an on-sale asset from non-zero to non-zero | ||
if (json.errors[0].code === 6) { | ||
return http({ | ||
url: '//itemconfiguration.roblox.com/v1/assets/' + args.id + '/update-price', | ||
options: { | ||
method: 'POST', | ||
jar: args.jar, | ||
headers: { | ||
'X-CSRF-TOKEN': args.token | ||
}, | ||
json: { | ||
priceConfiguration: { | ||
priceInRobux: args.sellForRobux | ||
} | ||
} | ||
} | ||
}).then((err) => { | ||
if (!err.errors) { | ||
return configure(args.jar, args.token, args.id, args.name, args.description, args.enableComments, args.sellForRobux, args.genreSelection, args.sellForRobux) | ||
} else { | ||
throw new Error(json.errors[0].message) | ||
} | ||
}) | ||
} else if (json.errors[0].code === 3) { // "Cannot release the associated asset type" - caused by copyable asset using sellForRobux: 2 or greater | ||
// Throw an error as the developer may have intended to sell the asset for robux instead of making it free. | ||
throw new Error('Attempting to sell a copyable asset for robux; it can only be made free. (Use true for sellForRobux.)') | ||
} else if (json.errors[0].code === 20) { // "Cannot set the associated asset type to remove-from-release" - caused by copyable asset using sellForRobux: 0 | ||
// Continue and ignore the error as the intended outcome makes the asset private; set sellForRobux from 0 to false | ||
return configure(args.jar, args.token, args.id, args.name, args.description, args.enableComments, args.sellForRobux, args.genreSelection, !!args.sellForRobux) | ||
} | ||
throw new Error(`An unknown error occurred: [${json.errors[0].code}] ${json.errors[0].message}`) | ||
} | ||
}) | ||
} | ||
@@ -91,3 +133,6 @@ | ||
.then(function (token) { | ||
if (args.sellForRobux && typeof (args.sellForRobux) === 'number') { | ||
if (typeof (args.sellForRobux) === 'number') { | ||
if (args.sellForRobux < 2 && args.sellForRobux !== 0) { | ||
throw new Error('Assets cannot be sold for less than 2R.') | ||
} | ||
args.token = token | ||
@@ -94,0 +139,0 @@ return configureRobux(args) |
@@ -30,2 +30,5 @@ // Dependencies | ||
function connect (retries) { | ||
if (typeof args.jar === 'string') { | ||
args.jar = { session: args.jar } | ||
} | ||
const session = getSession({ jar: args.jar }) | ||
@@ -32,0 +35,0 @@ const client = new SignalR('wss://realtime.roblox.com/notifications', ['usernotificationhub'], 3, true) // wss for https |
@@ -23,5 +23,8 @@ // Dependencies | ||
// 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') | ||
} |
@@ -24,2 +24,5 @@ // Includes | ||
if (settings.session_only) { | ||
if (typeof jar === 'string') { | ||
return jar | ||
} | ||
return jar.session | ||
@@ -26,0 +29,0 @@ } else { |
{ | ||
"name": "noblox.js", | ||
"version": "4.9.0", | ||
"version": "4.10.0", | ||
"description": "A Node.js wrapper for Roblox. (original from sentanos)", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
@@ -274,2 +274,13 @@ // types/Types | ||
/** | ||
* @typedef | ||
*/ | ||
type ConfigureItemResponse = { | ||
name: string; | ||
assetId: number; | ||
description?: string; | ||
price?: number; | ||
isCopyingAllowed?: boolean; | ||
} | ||
/// Avatar | ||
@@ -276,0 +287,0 @@ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
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
611578
13946