Skip to content

Commit

Permalink
1.0.2 + Remove incorrect type, update docs
Browse files Browse the repository at this point in the history
  • Loading branch information
retrixe committed Dec 24, 2023
1 parent 22b3749 commit f4c8ef8
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 7 deletions.
9 changes: 6 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,11 @@ yarn add @mythicmc/auth
```js
import MythicAuth from '@mythicmc/auth'; // or @mythicmc/auth/standalone.js

const client = new MythicAuth('redis://localhost:6379'); // or MySQL URL or options if using standalone
// Connecting is not required on standalone, but is required on the Redis client.
const client = new MythicAuth('redis://localhost:6379');
// or MySQL URL/options + LuckPerms HTTP API URL if using standalone, e.g.
const client = new MythicAuth('mysql://localhost:3306', 'http://localhost:8080');

// This step is only required with the Redis client, whereas standalone connects automatically.
await client.connect('app.*') // The permission namespace within which you check perms, e.g. app.use (if only checking 1 perm), app.* or even *

// The service will check if the user has the permission *and* if the password matches the user's.
Expand All @@ -28,5 +31,5 @@ console.log(await client.check('username', 'permission', 'password'))
This package also comes with a dummy version of the Redis service, which can be used for testing purposes.

```bash
npx -- @mythicmc/auth dummy-service # optionally, Redis URL can be passed as arg
npx @mythicmc/auth # optionally, Redis URL can be passed as arg
```
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@mythicmc/auth",
"version": "1.0.1",
"version": "1.0.2",
"description": "Node.js client for MythicAuthService.",
"repository": {
"type": "git",
Expand Down
5 changes: 3 additions & 2 deletions src/dummy-service.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
#!/usr/bin/env node
import { Redis } from 'ioredis'

const url = process.argv[2] ?? 'redis://localhost:6379'
if (!process.argv[2]) {
const arg = process.argv[2] === 'dummy-service' ? process.argv[3] : process.argv[2]
const url = arg ?? 'redis://localhost:6379'
if (!arg) {
console.log('No URL passed as parameter, using default redis://localhost:6379')
}

Expand Down
2 changes: 1 addition & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ export default class MythicAuth {

async check(
username: string,
permission: string | null,
permission: string,
password?: string | null,
): Promise<boolean> {
if (password === '') return false // Return false if empty, undefined is a different case
Expand Down

0 comments on commit f4c8ef8

Please sign in to comment.