airship-cli 1.0.1 → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.github/workflows/npm-publish.yml +21 -26
- package/LICENSE +673 -673
- package/README.MD +8 -56
- package/out/AirshipTypes.d.ts +1 -1
- package/out/AirshipTypes.d.ts.map +1 -1
- package/out/cli.d.ts +2 -2
- package/out/cli.d.ts.map +1 -1
- package/out/cli.js +47 -22
- package/out/cli.js.map +1 -1
- package/out/commands/CommandTypes.d.ts +1 -0
- package/out/commands/CommandTypes.d.ts.map +1 -1
- package/out/commands/FetchGame.d.ts.map +1 -1
- package/out/commands/FetchGame.js +28 -15
- package/out/commands/FetchGame.js.map +1 -1
- package/out/commands/FetchUser.d.ts.map +1 -1
- package/out/commands/FetchUser.js +27 -16
- package/out/commands/FetchUser.js.map +1 -1
- package/out/commands/{help.d.ts → Help.d.ts} +1 -1
- package/out/commands/Help.d.ts.map +1 -0
- package/out/commands/{help.js → Help.js} +4 -3
- package/out/commands/Help.js.map +1 -0
- package/out/util/TokenManager.d.ts +1 -1
- package/out/util/TokenManager.d.ts.map +1 -1
- package/out/util/TokenManager.js +7 -4
- package/out/util/TokenManager.js.map +1 -1
- package/package.json +2 -3
- package/src/AirshipTypes.ts +62 -62
- package/src/cli.ts +68 -49
- package/src/commands/CommandTypes.ts +7 -6
- package/src/commands/FetchGame.ts +76 -60
- package/src/commands/FetchUser.ts +74 -60
- package/src/commands/Help.ts +36 -35
- package/src/util/Styles.ts +19 -19
- package/src/util/TokenManager.ts +21 -19
- package/tsconfig.json +42 -42
- package/out/Types.d.ts +0 -2
- package/out/Types.d.ts.map +0 -1
- package/out/Types.js +0 -2
- package/out/Types.js.map +0 -1
- package/out/commands/FetchUser copy.d.ts +0 -3
- package/out/commands/FetchUser copy.d.ts.map +0 -1
- package/out/commands/FetchUser copy.js +0 -46
- package/out/commands/FetchUser copy.js.map +0 -1
- package/out/commands/help.d.ts.map +0 -1
- package/out/commands/help.js.map +0 -1
- package/out/index.d.ts.map +0 -1
- package/out/index.js.map +0 -1
package/src/util/TokenManager.ts
CHANGED
|
@@ -1,20 +1,22 @@
|
|
|
1
|
-
import * as fs from 'fs';
|
|
2
|
-
import type { AccountInfo } from '../AirshipTypes.js';
|
|
3
|
-
import { PrintError } from './Styles.js';
|
|
4
|
-
|
|
5
|
-
const airshipAccountPath = process.env.APPDATA + `../../LocalLow/Easy/Airship/account.json`;
|
|
6
|
-
|
|
7
|
-
function FetchAirshipToken(): string {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
1
|
+
import * as fs from 'fs';
|
|
2
|
+
import type { AccountInfo } from '../AirshipTypes.js';
|
|
3
|
+
import { PrintError } from './Styles.js';
|
|
4
|
+
|
|
5
|
+
const airshipAccountPath = process.env.APPDATA + `../../LocalLow/Easy/Airship/account.json`;
|
|
6
|
+
|
|
7
|
+
function FetchAirshipToken(): string | undefined {
|
|
8
|
+
let jsonData: AccountInfo;
|
|
9
|
+
|
|
10
|
+
try {
|
|
11
|
+
const accountsFile = fs.readFileSync(airshipAccountPath);
|
|
12
|
+
|
|
13
|
+
jsonData = JSON.parse(accountsFile.toString("utf8"));
|
|
14
|
+
} catch(err) {
|
|
15
|
+
PrintError("No Airship Installation Found!");
|
|
16
|
+
return undefined;
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
return jsonData.refreshToken;
|
|
20
|
+
};
|
|
21
|
+
|
|
20
22
|
export const AirshipToken = FetchAirshipToken();
|
package/tsconfig.json
CHANGED
|
@@ -1,42 +1,42 @@
|
|
|
1
|
-
{
|
|
2
|
-
// Visit https://aka.ms/tsconfig to read more about this file
|
|
3
|
-
"compilerOptions": {
|
|
4
|
-
// File Layout
|
|
5
|
-
"rootDir": "./src",
|
|
6
|
-
"outDir": "./out",
|
|
7
|
-
|
|
8
|
-
// Environment Settings
|
|
9
|
-
// See also https://aka.ms/tsconfig/module
|
|
10
|
-
"module": "nodenext",
|
|
11
|
-
"target": "esnext",
|
|
12
|
-
// For nodejs:
|
|
13
|
-
// "lib": ["esnext"],
|
|
14
|
-
"types": ["node"],
|
|
15
|
-
|
|
16
|
-
// Other Outputs
|
|
17
|
-
"sourceMap": true,
|
|
18
|
-
"declaration": true,
|
|
19
|
-
"declarationMap": true,
|
|
20
|
-
|
|
21
|
-
// Stricter Typechecking Options
|
|
22
|
-
"noUncheckedIndexedAccess": true,
|
|
23
|
-
"exactOptionalPropertyTypes": true,
|
|
24
|
-
|
|
25
|
-
// Style Options
|
|
26
|
-
// "noImplicitReturns": true,
|
|
27
|
-
// "noImplicitOverride": true,
|
|
28
|
-
// "noUnusedLocals": true,
|
|
29
|
-
// "noUnusedParameters": true,
|
|
30
|
-
// "noFallthroughCasesInSwitch": true,
|
|
31
|
-
// "noPropertyAccessFromIndexSignature": true,
|
|
32
|
-
|
|
33
|
-
// Recommended Options
|
|
34
|
-
"strict": true,
|
|
35
|
-
"jsx": "react-jsx",
|
|
36
|
-
"verbatimModuleSyntax": true,
|
|
37
|
-
"isolatedModules": true,
|
|
38
|
-
"noUncheckedSideEffectImports": true,
|
|
39
|
-
"moduleDetection": "force",
|
|
40
|
-
"skipLibCheck": true,
|
|
41
|
-
}
|
|
42
|
-
}
|
|
1
|
+
{
|
|
2
|
+
// Visit https://aka.ms/tsconfig to read more about this file
|
|
3
|
+
"compilerOptions": {
|
|
4
|
+
// File Layout
|
|
5
|
+
"rootDir": "./src",
|
|
6
|
+
"outDir": "./out",
|
|
7
|
+
|
|
8
|
+
// Environment Settings
|
|
9
|
+
// See also https://aka.ms/tsconfig/module
|
|
10
|
+
"module": "nodenext",
|
|
11
|
+
"target": "esnext",
|
|
12
|
+
// For nodejs:
|
|
13
|
+
// "lib": ["esnext"],
|
|
14
|
+
"types": ["node"],
|
|
15
|
+
|
|
16
|
+
// Other Outputs
|
|
17
|
+
"sourceMap": true,
|
|
18
|
+
"declaration": true,
|
|
19
|
+
"declarationMap": true,
|
|
20
|
+
|
|
21
|
+
// Stricter Typechecking Options
|
|
22
|
+
"noUncheckedIndexedAccess": true,
|
|
23
|
+
"exactOptionalPropertyTypes": true,
|
|
24
|
+
|
|
25
|
+
// Style Options
|
|
26
|
+
// "noImplicitReturns": true,
|
|
27
|
+
// "noImplicitOverride": true,
|
|
28
|
+
// "noUnusedLocals": true,
|
|
29
|
+
// "noUnusedParameters": true,
|
|
30
|
+
// "noFallthroughCasesInSwitch": true,
|
|
31
|
+
// "noPropertyAccessFromIndexSignature": true,
|
|
32
|
+
|
|
33
|
+
// Recommended Options
|
|
34
|
+
"strict": true,
|
|
35
|
+
"jsx": "react-jsx",
|
|
36
|
+
"verbatimModuleSyntax": true,
|
|
37
|
+
"isolatedModules": true,
|
|
38
|
+
"noUncheckedSideEffectImports": true,
|
|
39
|
+
"moduleDetection": "force",
|
|
40
|
+
"skipLibCheck": true,
|
|
41
|
+
}
|
|
42
|
+
}
|
package/out/Types.d.ts
DELETED
package/out/Types.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Types.d.ts","sourceRoot":"","sources":["../src/Types.ts"],"names":[],"mappings":""}
|
package/out/Types.js
DELETED
package/out/Types.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Types.js","sourceRoot":"","sources":["../src/Types.ts"],"names":[],"mappings":""}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"FetchUser copy.d.ts","sourceRoot":"","sources":["../../src/commands/FetchUser copy.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAWpD,eAAO,MAAM,gBAAgB,EAAE,UAsC9B,CAAC"}
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
import { input, select } from '@inquirer/prompts';
|
|
2
|
-
import { PrintHeader, PrintError, PrintTitle } from '../util/Styles.js';
|
|
3
|
-
import { AirshipToken } from '../util/TokenManager.js';
|
|
4
|
-
const apiMap = {
|
|
5
|
-
"Username": "https://api.airship.gg/game-coordinator/users/user?username=",
|
|
6
|
-
"UserId": "https://api.airship.gg/game-coordinator/users/uid/"
|
|
7
|
-
};
|
|
8
|
-
export const fetchUserCommand = {
|
|
9
|
-
name: "fetch-user",
|
|
10
|
-
description: "Returns data related to the specified user.",
|
|
11
|
-
usage: "fetch-user <method: username | userId> <identifier: string>",
|
|
12
|
-
requiresToken: false,
|
|
13
|
-
execute: async () => {
|
|
14
|
-
const fetchMethod = await select({ message: "Which method would you like to use?", choices: [
|
|
15
|
-
"Username",
|
|
16
|
-
"UserId"
|
|
17
|
-
] });
|
|
18
|
-
const userIdentifier = await input({ message: `Please enter the ${fetchMethod}:` });
|
|
19
|
-
for (let data of Object.entries(apiMap)) {
|
|
20
|
-
const method = data[0];
|
|
21
|
-
const url = data[1];
|
|
22
|
-
if (method === fetchMethod) {
|
|
23
|
-
fetch(url + userIdentifier, {
|
|
24
|
-
method: "GET"
|
|
25
|
-
}).then(raw => raw.text().then(data => {
|
|
26
|
-
const userData = JSON.parse(data);
|
|
27
|
-
const entries = Object.entries(userData);
|
|
28
|
-
if (entries.length === 0) {
|
|
29
|
-
PrintError(`Invalid ${fetchMethod}!`);
|
|
30
|
-
}
|
|
31
|
-
else if (entries.length === 3) {
|
|
32
|
-
const styledError = `${entries[0]?.[1]}`.replaceAll("username", "Username").replaceAll(",", ", ");
|
|
33
|
-
PrintError(styledError);
|
|
34
|
-
}
|
|
35
|
-
;
|
|
36
|
-
})).catch((err) => {
|
|
37
|
-
PrintError(err);
|
|
38
|
-
});
|
|
39
|
-
return;
|
|
40
|
-
}
|
|
41
|
-
;
|
|
42
|
-
}
|
|
43
|
-
;
|
|
44
|
-
}
|
|
45
|
-
};
|
|
46
|
-
//# sourceMappingURL=FetchUser%20copy.js.map
|
|
@@ -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G,IAAI,CAAC,KAAK,CAAC,IAAI,CAAwC,CAAC;oBACzE,MAAM,OAAO,GAAG,MAAM,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;oBAEzC,IAAI,OAAO,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;wBACvB,UAAU,CAAC,WAAW,WAAW,GAAG,CAAC,CAAC;oBAC1C,CAAC;yBAAM,IAAI,OAAO,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;wBAC9B,MAAM,WAAW,GAAG,GAAG,OAAO,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,UAAU,CAAC,UAAU,EAAE,UAAU,CAAC,CAAC,UAAU,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC;wBAClG,UAAU,CAAC,WAAW,CAAC,CAAC;oBAC5B,CAAC;oBAAA,CAAC;gBACN,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,GAAG,EAAE,EAAE;oBACd,UAAU,CAAC,GAAG,CAAC,CAAC;gBACpB,CAAC,CAAC,CAAC;gBAEH,OAAO;YACX,CAAC;YAAA,CAAC;QACN,CAAC;QAAA,CAAC;IACN,CAAC;CACJ,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"help.d.ts","sourceRoot":"","sources":["../../src/commands/help.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAOpD,eAAO,MAAM,WAAW,EAAE,UA4BzB,CAAC"}
|
package/out/commands/help.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"help.js","sourceRoot":"","sources":["../../src/commands/help.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAC3D,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,UAAU,EAA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AE,CAAC;wBACd,SAAS,EAAE,CAAC;oBAChB,CAAC;oBAAA,CAAC;gBACN,CAAC,EAAE,CAAC,CAAC,CAAC;gBAEN,OAAO;YACX,CAAC;YAAA,CAAC;QACN,CAAC;QAAA,CAAC;IACN,CAAC;CACJ,CAAC"}
|
package/out/index.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAQA,eAAO,MAAM,UAAU;;;;CAItB,CAAC;AAEF,eAAO,MAAM,WAAW,UAIvB,CAAC;AAEF,wBAAgB,SAAS,SAMxB"}
|
package/out/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAClD,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AACvE,OAAO,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AACtD,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAC3D,OAAO,EAAE,gBAAgB,EAAE,MAAM,yBAAyB,CAAC;AAE3D,MAAM,CAAC,MAAM,UAAU,GAAG;IACtB,MAAM,EAAE,WAAW;IACnB,YAAY,EAAE,gBAAgB;IAC9B,YAAY,EAAE,gBAAgB;CACjC,CAAC;AAEF,MAAM,CAAC,MAAM,WAAW,GAAG;IACvB,MAAM;IACN,YAAY;IACZ,YAAY;CACf,CAAC;AAEF,MAAM,UAAU,SAAS;IACrB,UAAU,EAAE,CAAC;IAEb,UAAU,CAAC,GAAG,EAAE;QACZ,aAAa,EAAE,CAAC;IACpB,C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