-
Notifications
You must be signed in to change notification settings - Fork 141
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'noblox:master' into addDeveloperProductFix
- Loading branch information
Showing
20 changed files
with
2,415 additions
and
13,848 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
name: Run tests | ||
|
||
on: | ||
workflow_dispatch | ||
|
||
|
||
jobs: | ||
test: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v2 | ||
|
||
- name: Set up node | ||
uses: actions/setup-node@v1 | ||
with: | ||
node-version: 20 | ||
|
||
- name: Install yarn | ||
run: npm install -g yarn | ||
|
||
- name: Install dependencies | ||
run: yarn install | ||
|
||
- name: Lint lib/ | ||
run: yarn lint | ||
- name: Run tests | ||
env: | ||
COOKIE: ${{ secrets.COOKIE }} | ||
COOKIE_2: ${{ secrets.COOKIE_2 }} | ||
run: yarn test | ||
|
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
import jest from "eslint-plugin-jest"; | ||
import globals from "globals"; | ||
import path from "node:path"; | ||
import { fileURLToPath } from "node:url"; | ||
import js from "@eslint/js"; | ||
import { FlatCompat } from "@eslint/eslintrc"; | ||
|
||
const __filename = fileURLToPath(import.meta.url); | ||
const __dirname = path.dirname(__filename); | ||
const compat = new FlatCompat({ | ||
baseDirectory: __dirname, | ||
recommendedConfig: js.configs.recommended, | ||
allConfig: js.configs.all | ||
}); | ||
|
||
export default [...compat.extends("standard", "plugin:jest/recommended"), { | ||
plugins: { | ||
jest, | ||
}, | ||
|
||
languageOptions: { | ||
globals: { | ||
...globals.commonjs, | ||
...globals.node, | ||
Atomics: "readonly", | ||
SharedArrayBuffer: "readonly", | ||
}, | ||
|
||
ecmaVersion: 2018, | ||
sourceType: "commonjs", | ||
}, | ||
|
||
rules: {}, | ||
}]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
// Includes | ||
const http = require('./http.js').func | ||
|
||
// Args | ||
exports.optional = ['jar'] | ||
|
||
// Docs | ||
/** | ||
* 🔐 Get the current authenticated user. | ||
* @category Utility | ||
* @alias getAuthenticatedUser | ||
* @returns {AuthenticatedUserData} | ||
* @example const noblox = require("noblox.js") | ||
* // Login using your cookie. | ||
* const user = await noblox.getAuthenticatedUser() | ||
**/ | ||
|
||
// Define | ||
exports.func = async function (args) { | ||
const jar = args.jar | ||
const httpOpt = { | ||
url: '//users.roblox.com/v1/users/authenticated', | ||
options: { | ||
method: 'GET', | ||
followRedirect: false, | ||
jar, | ||
json: true, | ||
resolveWithFullResponse: true | ||
} | ||
} | ||
|
||
const res = await http(httpOpt) | ||
|
||
if (res.statusCode === 401) { | ||
throw new Error('You are not logged in.') | ||
} else if (res.statusCode !== 200) { | ||
throw new Error(JSON.stringify(res.body)) | ||
} | ||
|
||
return res.body | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.