Skip to content

Commit 02604f6

Browse files
authored
Merge branch 'master' into master
2 parents 3e8a287 + f8f4cab commit 02604f6

File tree

154 files changed

+4944
-16929
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

154 files changed

+4944
-16929
lines changed

.eslintrc.js

Lines changed: 0 additions & 21 deletions
This file was deleted.

.github/FUNDING.yml

Lines changed: 0 additions & 3 deletions
This file was deleted.

.github/workflows/doc-publish.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ jobs:
1515
- name: Set up node
1616
uses: actions/setup-node@v1
1717
with:
18-
node-version: 14
18+
node-version: 20
1919

2020
- name: Install yarn
2121
run: npm install -g yarn

.github/workflows/npmpublish.yml

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
name: Test & Publish
22

33
on:
4+
pull_request:
5+
branches:
6+
- master
7+
48
push:
59
branches:
610
- master
@@ -15,7 +19,7 @@ jobs:
1519
- name: Set up node
1620
uses: actions/setup-node@v1
1721
with:
18-
node-version: 14
22+
node-version: 20
1923

2024
- name: Install yarn
2125
run: npm install -g yarn
@@ -28,6 +32,7 @@ jobs:
2832

2933
publish-npm:
3034
needs: test
35+
if: github.event_name == 'push'
3136
runs-on: ubuntu-latest
3237
steps:
3338
- name: Checkout code with ADMIN_TOKEN
@@ -46,25 +51,25 @@ jobs:
4651
- name: Set up node
4752
uses: actions/setup-node@v1
4853
with:
49-
node-version: 14
54+
node-version: 20
5055

5156
- name: Install yarn
5257
run: npm install -g yarn
5358

5459
- name: Install dependencies
5560
run: yarn install --frozen-lockfile
56-
61+
5762
- name: Cache node modules
5863
uses: actions/cache@v1
5964
with:
6065
path: node_modules
6166
key: yarn-deps-${{ hashFiles('yarn.lock') }}
6267
restore-keys: |
6368
yarn-deps-${{ hashFiles('yarn.lock') }}
64-
69+
6570
- name: Create Release
6671
env:
67-
GH_TOKEN: ${{ secrets.GH_TOKEN }}
72+
token: ${{ secrets.ADMIN_TOKEN }}
6873
NPM_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }}
6974
run: |
7075
npx auto shipit

.github/workflows/run-tests.yml

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
name: Run tests
2+
3+
on:
4+
workflow_dispatch
5+
6+
7+
jobs:
8+
test:
9+
permissions:
10+
id-token: write
11+
12+
runs-on: ubuntu-latest
13+
steps:
14+
- name: Checkout code
15+
uses: actions/checkout@v4
16+
17+
- name: Set up node
18+
uses: actions/setup-node@v4
19+
with:
20+
node-version: 20
21+
22+
- name: Enable Corepack
23+
run: corepack enable
24+
25+
- name: Install dependencies
26+
run: yarn install --frozen-lockfile
27+
28+
- name: Lint lib/
29+
run: yarn lint
30+
31+
- id: auth
32+
name: Generate ID Token
33+
uses: google-github-actions/auth@v2
34+
with:
35+
token_format: id_token
36+
workload_identity_provider: ${{ vars.workload_identity_provider }}
37+
service_account: ${{ vars.service_account }}
38+
id_token_audience: "https://${{ vars.forwarder_hostname }}"
39+
id_token_include_email: true
40+
41+
- name: Run tests
42+
env:
43+
API_KEY: ${{ secrets.API_KEY }}
44+
COOKIE: ${{ secrets.COOKIE }}
45+
COOKIE_2: ${{ secrets.COOKIE_2 }}
46+
FORWARDER_HOSTNAME: ${{ vars.forwarder_hostname }}
47+
ID_TOKEN: ${{ steps.auth.outputs.id_token }}
48+
run: yarn test
49+

.travis.yml

Lines changed: 0 additions & 13 deletions
This file was deleted.

README.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99
<a href="https://standardjs.com"><img src="https://img.shields.io/badge/code_style-standard-blue.svg?style=flat-square" alt="JavaScript Style Guide"/></a>
1010
<a href="https://discord.gg/R5GVSyTVGv"><img src="https://img.shields.io/badge/discord-noblox.js-blue.svg?style=flat-square" alt="noblox.js Discord"/></a>
1111
<a href="https://npmjs.org/noblox.js"><img src="https://img.shields.io/npm/v/noblox.js.svg?style=flat-square" alt="NPM package"/>
12-
<a href="https://travis-ci.org/noblox/noblox.js"><img src="https://img.shields.io/travis/noblox/noblox.js/master.svg?style=flat-square" alt="Travis Build Status"/></a></a>
1312
</p>
1413

1514
<p align="center">
@@ -30,15 +29,15 @@
3029

3130
`noblox.js` is an open-source Roblox API wrapper written in JavaScript (with TypeScript compatibility) as a fork from sentanos's <a href="https://github.com/sentanos/roblox-js"> roblox-js module</a>.
3231

33-
This NPM package enables operations froms the [Roblox website](https://www.roblox.com) to be executed via NodeJS; many individuals leverage `noblox.js` along side [Roblox's HTTPService](http://wiki.roblox.com/index.php?title=API:Class/HttpService) to create in-game scripts that interact with the website, i.e. promote users, shout events, and so on, or to create Discord utiltiies to manage their community.
32+
This NPM package enables operations froms the [Roblox website](https://www.roblox.com) to be executed via NodeJS; many individuals leverage `noblox.js` along side [Roblox's HTTPService](http://wiki.roblox.com/index.php?title=API:Class/HttpService) to create in-game scripts that interact with the website, i.e. promote users, shout events, and so on, or to create Discord utilities to manage their community.
3433

3534
If you are looking for more information on how to create something like this, check out [our sister library, `noblox.js-server`](https://github.com/noblox/noblox.js-server) or [our YouTube series](https://www.youtube.com/playlist?list=PLEW4K4VqMUb_VMA3Yp9LI4gReRyVWGTnU). Keep in mind that these resources may not always be up to date, so it is **highly** encouraged that you learn to use the `noblox.js` library directly.
3635

3736
---
3837

3938
## Prerequisites
4039

41-
- [**Node.js®**](https://nodejs.org/en/download/current/)
40+
- [**Node.js®**](https://nodejs.org/en/download/current/) v18.18 or later
4241

4342
---
4443

eslint.config.mjs

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
import jest from "eslint-plugin-jest";
2+
import globals from "globals";
3+
import path from "node:path";
4+
import { fileURLToPath } from "node:url";
5+
import js from "@eslint/js";
6+
import { FlatCompat } from "@eslint/eslintrc";
7+
8+
const __filename = fileURLToPath(import.meta.url);
9+
const __dirname = path.dirname(__filename);
10+
const compat = new FlatCompat({
11+
baseDirectory: __dirname,
12+
recommendedConfig: js.configs.recommended,
13+
allConfig: js.configs.all
14+
});
15+
16+
export default [...compat.extends("standard", "plugin:jest/recommended"), {
17+
plugins: {
18+
jest,
19+
},
20+
21+
languageOptions: {
22+
globals: {
23+
...globals.commonjs,
24+
...globals.node,
25+
Atomics: "readonly",
26+
SharedArrayBuffer: "readonly",
27+
},
28+
29+
ecmaVersion: 2018,
30+
sourceType: "commonjs",
31+
},
32+
33+
rules: {},
34+
}];

lib/accountinformation/getUserSocialLinks.js

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
// Includes
22
const http = require('../util/http.js').func
3+
const RobloxAPIError = require('../util/apiError.js')
34

45
// Args
56
exports.required = ['userId']
@@ -25,14 +26,11 @@ function getUserSocialLinks (userId, jar) {
2526
resolveWithFullResponse: true
2627
}
2728
})
28-
.then(({ statusCode, body }) => {
29-
const { errors } = JSON.parse(body)
30-
if (statusCode === 200) {
31-
return JSON.parse(body)
32-
} else if (statusCode === 400) {
33-
throw new Error(`${errors[0].message} | userId: ${userId}`)
29+
.then((res) => {
30+
if (res.statusCode === 200) {
31+
return JSON.parse(res.body)
3432
} else {
35-
throw new Error(`An unknown error occurred with getUserSocialLinks() | [${statusCode}] userId: ${userId}`)
33+
throw new RobloxAPIError(res)
3634
}
3735
})
3836
}

lib/accountsettings/block.js

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
// Includes
22
const http = require('../util/http.js').func
33
const getGeneralToken = require('../util/getGeneralToken.js').func
4+
const RobloxAPIError = require('../util/apiError.js')
45

56
// Args
67
exports.required = ['userId']
@@ -37,13 +38,7 @@ function block (jar, token, userId) {
3738
if (res.statusCode === 200) {
3839
resolve()
3940
} else {
40-
const body = JSON.parse(res.body) || {}
41-
if (body.errors && body.errors.length > 0) {
42-
const errors = body.errors.map((e) => {
43-
return e.message
44-
})
45-
reject(new Error(`${res.statusCode} ${errors.join(', ')}`))
46-
}
41+
reject(new RobloxAPIError(res))
4742
}
4843
})
4944
})

0 commit comments

Comments
 (0)