airship-cli 1.1.0 → 1.2.1
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/README.MD +28 -4
- package/out/AirshipTypes.d.ts +19 -3
- package/out/AirshipTypes.d.ts.map +1 -1
- package/out/AirshipTypes.js +2 -0
- package/out/AirshipTypes.js.map +1 -1
- package/out/cli.d.ts +11 -5
- package/out/cli.d.ts.map +1 -1
- package/out/cli.js +70 -23
- package/out/cli.js.map +1 -1
- package/out/commands/ExitCommand.d.ts +3 -0
- package/out/commands/ExitCommand.d.ts.map +1 -0
- package/out/commands/ExitCommand.js +13 -0
- package/out/commands/ExitCommand.js.map +1 -0
- package/out/commands/FavoriteGame.d.ts +3 -0
- package/out/commands/FavoriteGame.d.ts.map +1 -0
- package/out/commands/FavoriteGame.js +22 -0
- package/out/commands/FavoriteGame.js.map +1 -0
- package/out/commands/FetchGame.d.ts.map +1 -1
- package/out/commands/FetchGame.js +28 -54
- package/out/commands/FetchGame.js.map +1 -1
- package/out/commands/FetchProfilePhoto.d.ts +3 -0
- package/out/commands/FetchProfilePhoto.d.ts.map +1 -0
- package/out/commands/FetchProfilePhoto.js +31 -0
- package/out/commands/FetchProfilePhoto.js.map +1 -0
- package/out/commands/FetchUser.d.ts.map +1 -1
- package/out/commands/FetchUser.js +26 -52
- package/out/commands/FetchUser.js.map +1 -1
- package/out/commands/FetchUserPhoto.d.ts +3 -0
- package/out/commands/FetchUserPhoto.d.ts.map +1 -0
- package/out/commands/FetchUserPhoto.js +45 -0
- package/out/commands/FetchUserPhoto.js.map +1 -0
- package/out/commands/HelpCommand.d.ts +3 -0
- package/out/commands/HelpCommand.d.ts.map +1 -0
- package/out/commands/HelpCommand.js +39 -0
- package/out/commands/HelpCommand.js.map +1 -0
- package/out/commands/RestartCommand copy.d.ts +3 -0
- package/out/commands/RestartCommand copy.d.ts.map +1 -0
- package/out/commands/RestartCommand copy.js +14 -0
- package/out/commands/RestartCommand copy.js.map +1 -0
- package/out/commands/RestartCommand.d.ts +3 -0
- package/out/commands/RestartCommand.d.ts.map +1 -0
- package/out/commands/RestartCommand.js +14 -0
- package/out/commands/RestartCommand.js.map +1 -0
- package/out/commands/games/FavoriteGame.d.ts +3 -0
- package/out/commands/games/FavoriteGame.d.ts.map +1 -0
- package/out/commands/games/FavoriteGame.js +22 -0
- package/out/commands/games/FavoriteGame.js.map +1 -0
- package/out/commands/games/FetchGame.d.ts +3 -0
- package/out/commands/games/FetchGame.d.ts.map +1 -0
- package/out/commands/games/FetchGame.js +42 -0
- package/out/commands/games/FetchGame.js.map +1 -0
- package/out/commands/users/FetchProfilePhoto.d.ts +3 -0
- package/out/commands/users/FetchProfilePhoto.d.ts.map +1 -0
- package/out/commands/users/FetchProfilePhoto.js +31 -0
- package/out/commands/users/FetchProfilePhoto.js.map +1 -0
- package/out/commands/users/FetchUser.d.ts +3 -0
- package/out/commands/users/FetchUser.d.ts.map +1 -0
- package/out/commands/users/FetchUser.js +40 -0
- package/out/commands/users/FetchUser.js.map +1 -0
- package/out/util/IdentifierConversion.d.ts +2 -0
- package/out/util/IdentifierConversion.d.ts.map +1 -0
- package/out/util/IdentifierConversion.js +14 -0
- package/out/util/IdentifierConversion.js.map +1 -0
- package/out/util/TokenManager.d.ts.map +1 -1
- package/out/util/TokenManager.js +44 -3
- package/out/util/TokenManager.js.map +1 -1
- package/out/util/platform/FavoriteGame.d.ts +3 -0
- package/out/util/platform/FavoriteGame.d.ts.map +1 -0
- package/out/util/platform/FavoriteGame.js +28 -0
- package/out/util/platform/FavoriteGame.js.map +1 -0
- package/out/util/platform/FetchGame.d.ts +6 -0
- package/out/util/platform/FetchGame.d.ts.map +1 -0
- package/out/util/platform/FetchGame.js +14 -0
- package/out/util/platform/FetchGame.js.map +1 -0
- package/out/util/platform/FetchUser.d.ts +6 -0
- package/out/util/platform/FetchUser.d.ts.map +1 -0
- package/out/util/platform/FetchUser.js +14 -0
- package/out/util/platform/FetchUser.js.map +1 -0
- package/package.json +6 -2
- package/.github/workflows/npm-publish.yml +0 -22
- package/src/AirshipTypes.ts +0 -63
- package/src/cli.ts +0 -68
- package/src/commands/CommandTypes.ts +0 -8
- package/src/commands/FetchGame.ts +0 -77
- package/src/commands/FetchUser.ts +0 -75
- package/src/commands/Help.ts +0 -37
- package/src/util/Styles.ts +0 -20
- package/src/util/TokenManager.ts +0 -22
- package/tsconfig.json +0 -42
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FetchUserPhoto.d.ts","sourceRoot":"","sources":["../../src/commands/FetchUserPhoto.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAYpD,eAAO,MAAM,qBAAqB,EAAE,UAuCnC,CAAC"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { setTimeout } from "node:timers/promises";
|
|
2
|
+
import { PrintError, PrintHeader } from "../util/Styles.js";
|
|
3
|
+
import { input, select } from "@inquirer/prompts";
|
|
4
|
+
import chalk from "chalk";
|
|
5
|
+
import { RestartTool } from "../cli.js";
|
|
6
|
+
const apiMap = {
|
|
7
|
+
"Username": "https://api.airship.gg/game-coordinator/users/user?username=",
|
|
8
|
+
"UserId": "https://api.airship.gg/game-coordinator/users/uid/"
|
|
9
|
+
};
|
|
10
|
+
export const FetchUserPhotoCommand = {
|
|
11
|
+
name: "fetch-profile-photo",
|
|
12
|
+
displayName: "Fetch Profile Photo",
|
|
13
|
+
description: "Returns the profile picture of the given user.",
|
|
14
|
+
usage: "<method: username | userId> <identifier: string>",
|
|
15
|
+
requiresToken: false,
|
|
16
|
+
execute: async () => {
|
|
17
|
+
const fetchMethod = await select({ message: "Which method would you like to use?", choices: Object.keys(apiMap) });
|
|
18
|
+
const userIdentifier = await input({ message: `Please enter the ${fetchMethod}:` });
|
|
19
|
+
// for (let [ method, url ] of Object.entries(apiMap)) {
|
|
20
|
+
// if (method === fetchMethod) {
|
|
21
|
+
// fetch(url )
|
|
22
|
+
// };
|
|
23
|
+
// };
|
|
24
|
+
fetch(apiMap[fetchMethod] + userIdentifier, {
|
|
25
|
+
method: "GET"
|
|
26
|
+
}).then((raw) => raw.text().then((data) => {
|
|
27
|
+
const result = JSON.parse(data);
|
|
28
|
+
const keys = Object.keys(result);
|
|
29
|
+
const entries = Object.entries(result);
|
|
30
|
+
if (entries.length === 0 || "error" in result || keys.length === 0) {
|
|
31
|
+
PrintError(`Invalid ${fetchMethod}!`);
|
|
32
|
+
return;
|
|
33
|
+
}
|
|
34
|
+
;
|
|
35
|
+
const user = result.user;
|
|
36
|
+
const profileImageId = user.profileImageId;
|
|
37
|
+
if (!profileImageId)
|
|
38
|
+
return PrintError("User has no profile image!");
|
|
39
|
+
console.log(chalk.green(`\nhttps://cdn.airship.gg/images/${profileImageId}\n`));
|
|
40
|
+
}));
|
|
41
|
+
RestartTool();
|
|
42
|
+
return;
|
|
43
|
+
}
|
|
44
|
+
};
|
|
45
|
+
//# sourceMappingURL=FetchUserPhoto.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FetchUserPhoto.js","sourceRoot":"","sources":["../../src/commands/FetchUserPhoto.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAElD,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAC5D,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAElD,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAExC,MAAM,MAAM,GAA8B;IACtC,UAAU,EAAE,8DAA8D;IAC1E,QAAQ,EAAE,oDAAoD;CACjE,CAAC;AAEF,MAAM,CAAC,MAAM,qBAAqB,GAAe;IAC7C,IAAI,EAAE,qBAAqB;IAC3B,WAAW,EAAE,qBAAqB;IAClC,WAAW,EAAE,gDAAgD;IAC7D,KAA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IAAI,CAAC,CAAC,CAAC;QACpF,CAAC,CAAC,CAAC,CAAC;QAEJ,WAAW,EAAE,CAAC;QAEd,OAAO;IACX,CAAC;CACJ,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"HelpCommand.d.ts","sourceRoot":"","sources":["../../src/commands/HelpCommand.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAOpD,eAAO,MAAM,WAAW,EAAE,UAgCzB,CAAC"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import chalk from "chalk";
|
|
2
|
+
import { input, select, confirm } from '@inquirer/prompts';
|
|
3
|
+
import { PrintHeader, PrintError, PrintTitle } from '../util/Styles.js';
|
|
4
|
+
import { AirshipToken } from '../util/TokenManager.js';
|
|
5
|
+
import { commandMap, RestartTool, StartTool } from "../cli.js";
|
|
6
|
+
export const helpCommand = {
|
|
7
|
+
name: "help",
|
|
8
|
+
displayName: "Help",
|
|
9
|
+
description: "Returns the usage of a command.",
|
|
10
|
+
usage: "help <command: string>",
|
|
11
|
+
requiresToken: false,
|
|
12
|
+
execute: async () => {
|
|
13
|
+
let helpInfo = [];
|
|
14
|
+
let choices = [];
|
|
15
|
+
for (let [categoryName, category] of Object.entries(commandMap)) {
|
|
16
|
+
if (categoryName === "default")
|
|
17
|
+
continue;
|
|
18
|
+
for (let [cmdName, cmd] of Object.entries(category)) {
|
|
19
|
+
helpInfo.push(cmd);
|
|
20
|
+
choices.push(cmdName);
|
|
21
|
+
}
|
|
22
|
+
;
|
|
23
|
+
}
|
|
24
|
+
;
|
|
25
|
+
const commandSelect = await select({ message: "Which command do you need help with?", choices });
|
|
26
|
+
for (let command of helpInfo) {
|
|
27
|
+
if (command.displayName === commandSelect) {
|
|
28
|
+
console.log(`\n${chalk.bold(chalk.green(`${commandSelect} Help:`))}`);
|
|
29
|
+
console.log(`- Description: ${chalk.gray(command.description)}`);
|
|
30
|
+
console.log(`- Usage: ${chalk.gray(command.usage)}\n`);
|
|
31
|
+
}
|
|
32
|
+
;
|
|
33
|
+
}
|
|
34
|
+
;
|
|
35
|
+
RestartTool();
|
|
36
|
+
return;
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
//# sourceMappingURL=HelpCommand.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"HelpCommand.js","sourceRoot":"","sources":["../../src/commands/HelpCommand.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,EAAE,MAAM,mBAAmB,CAAC;AACxE,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AACvD,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAE/D,MAAM,CAAC,MAAM,WAAW,GAAe;IACnC,IAAI,EAAE,MAAM;IACZ,WAAW,EAAE,MAAM;IACnB,WAAW,EAAE,iCAAiC;IAC9C,KAAK,EAAE,wBAAwB;IAC/B,aAAa,EAAE,KAAK;IACpB,OAAO,EAAE,KAAK,IAAI,EAAE;QAChB,IAAI,QAAQ,GAAiB,EAAE,CAAC;QAChC,IAAI,OAAO,GAAa,EAAE,CAAC;QAE3B,KAAK,IAAI,CAAE,YAAY,EAAE,QAAQ,CAAE,IAAI,MAAM,CAAC,OAAO,CAAC,UAAU,CAAC,EAAE,CAAC;YAChE,IAAI,YAAY,KAAK,SAAS;gBAAE,SAAS;YAEzC,KAAK,IAAI,CAAE,OAAO,EAAE,GAAG,CAAE,IAAI,MAAM,CAAC,OAAO,CAAC,QAAQ,CAAC,EAAE,CAAC;gBACpD,QAAQ,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;gBACnB,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;YAC1B,CAAC;YAAA,CAAC;QACN,CAAC;QAAA,CAAC;QAEF,MAAM,aAAa,GAAG,MAAM,MAAM,CAAC,EAAE,OAAO,EAAE,sCAAsC,EAAE,OAAO,EAAE,CAAC,CAAC;QAEjG,KAAK,IAAI,OAAO,IAAI,QAAQ,EAAE,CAAC;YAC3B,IAAI,OAAO,CAAC,WAAW,KAAK,aAAa,EAAE,CAAC;gBACxC,OAAO,CAAC,GAAG,CAAC,KAAK,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,GAAG,aAAa,QAAQ,CAAC,CAAC,EAAE,CAAC,CAAC;gBACtE,OAAO,CAAC,GAAG,CAAC,kBAAkB,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,WAAW,CAAC,EAAE,CAAC,CAAC;gBACjE,OAAO,CAAC,GAAG,CAAC,YAAY,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;YAC3D,CAAC;YAAA,CAAC;QACN,CAAC;QAAA,CAAC;QAEF,WAAW,EAAE,CAAC;QACd,OAAO;IACX,CAAC;CACJ,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RestartCommand copy.d.ts","sourceRoot":"","sources":["../../src/commands/RestartCommand copy.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAEpD,eAAO,MAAM,cAAc,EAAE,UAY5B,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { StartTool } from "../cli.js";
|
|
2
|
+
export const restartCommand = {
|
|
3
|
+
name: "back",
|
|
4
|
+
displayName: "Back",
|
|
5
|
+
description: "Returns to the main command list.",
|
|
6
|
+
usage: "back",
|
|
7
|
+
requiresToken: false,
|
|
8
|
+
execute: async () => {
|
|
9
|
+
console.clear();
|
|
10
|
+
StartTool();
|
|
11
|
+
return;
|
|
12
|
+
}
|
|
13
|
+
};
|
|
14
|
+
//# sourceMappingURL=RestartCommand%20copy.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RestartCommand copy.js","sourceRoot":"","sources":["../../src/commands/RestartCommand copy.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAGtC,MAAM,CAAC,MAAM,cAAc,GAAe;IACtC,IAAI,EAAE,MAAM;IACZ,WAAW,EAAE,MAAM;IACnB,WAAW,EAAE,mCAAmC;IAChD,KAAK,EAAE,MAAM;IACb,aAAa,EAAE,KAAK;IACpB,OAAO,EAAE,KAAK,IAAI,EAAE;QAChB,OAAO,CAAC,KAAK,EAAE,CAAC;QAEhB,SAAS,EAAE,CAAC;QACZ,OAAO;IACX,CAAC;CACJ,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RestartCommand.d.ts","sourceRoot":"","sources":["../../src/commands/RestartCommand.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAEpD,eAAO,MAAM,cAAc,EAAE,UAY5B,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { StartTool } from "../cli.js";
|
|
2
|
+
export const restartCommand = {
|
|
3
|
+
name: "back",
|
|
4
|
+
displayName: "Back",
|
|
5
|
+
description: "Returns to the main command list.",
|
|
6
|
+
usage: "back",
|
|
7
|
+
requiresToken: false,
|
|
8
|
+
execute: async () => {
|
|
9
|
+
console.clear();
|
|
10
|
+
StartTool();
|
|
11
|
+
return;
|
|
12
|
+
}
|
|
13
|
+
};
|
|
14
|
+
//# sourceMappingURL=RestartCommand.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RestartCommand.js","sourceRoot":"","sources":["../../src/commands/RestartCommand.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAGtC,MAAM,CAAC,MAAM,cAAc,GAAe;IACtC,IAAI,EAAE,MAAM;IACZ,WAAW,EAAE,MAAM;IACnB,WAAW,EAAE,mCAAmC;IAChD,KAAK,EAAE,MAAM;IACb,aAAa,EAAE,KAAK;IACpB,OAAO,EAAE,KAAK,IAAI,EAAE;QAChB,OAAO,CAAC,KAAK,EAAE,CAAC;QAEhB,SAAS,EAAE,CAAC;QACZ,OAAO;IACX,CAAC;CACJ,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FavoriteGame.d.ts","sourceRoot":"","sources":["../../../src/commands/games/FavoriteGame.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAKrD,eAAO,MAAM,mBAAmB,EAAE,UAmBjC,CAAC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { input, select } from "@inquirer/prompts";
|
|
2
|
+
import { FetchGame, gameApiMap } from "../../util/platform/FetchGame.js";
|
|
3
|
+
import { FavoriteGame } from "../../util/platform/FavoriteGame.js";
|
|
4
|
+
import { RestartTool } from "../../cli.js";
|
|
5
|
+
export const favoriteGameCommand = {
|
|
6
|
+
name: "favorite-game",
|
|
7
|
+
displayName: "Favorite Game",
|
|
8
|
+
description: "Mark a game as your favorite. Requires Auth Token!",
|
|
9
|
+
usage: "favorite-game <action: Favorite | Remove Favorite> <method: Slug | GameId> <identifier: string> <isFavorite?: boolean>",
|
|
10
|
+
requiresToken: true,
|
|
11
|
+
execute: async () => {
|
|
12
|
+
const action = await select({ message: "What would you like to do?", choices: ["Favorite", "Remove Favorite"] });
|
|
13
|
+
const fetchType = await select({ message: "Which method would you like to use?", choices: Object.keys(gameApiMap) });
|
|
14
|
+
const gameIdentifier = await input({ message: `What is the ${fetchType}?` });
|
|
15
|
+
const isFavorite = action === "Favorite" ? true : false;
|
|
16
|
+
const result = await FavoriteGame(fetchType, gameIdentifier, isFavorite);
|
|
17
|
+
console.log(result);
|
|
18
|
+
RestartTool();
|
|
19
|
+
return;
|
|
20
|
+
}
|
|
21
|
+
};
|
|
22
|
+
//# sourceMappingURL=FavoriteGame.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FavoriteGame.js","sourceRoot":"","sources":["../../../src/commands/games/FavoriteGame.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAElD,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,kCAAkC,CAAC;AACzE,OAAO,EAAE,YAAY,EAAE,MAAM,qCAAqC,CAAC;AACnE,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAE3C,MAAM,CAAC,MAAM,mBAAmB,GAAe;IAC3C,IAAI,EAAE,eAAe;IACrB,WAAW,EAAE,eAAe;IAC5B,WAAW,EAAE,oDAAoD;IACjE,KAAK,EAAE,wHAAwH;IAC/H,aAAa,EAAE,IAAI;IACnB,OAAO,EAAE,KAAK,IAAI,EAAE;QAChB,MAAM,MAAM,GAAG,MAAM,MAAM,CAAC,EAAE,OAAO,EAAE,4BAA4B,EAAE,OAAO,EAAE,CAAE,UAAU,EAAE,iBAAiB,CAAE,EAAE,CAAC,CAAC;QACnH,MAAM,SAAS,GAAG,MAAM,MAAM,CAAC,EAAE,OAAO,EAAE,qCAAqC,EAAE,OAAO,EAAE,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC,EAAE,CAAC,CAAC;QACrH,MAAM,cAAc,GAAG,MAAM,KAAK,CAAC,EAAE,OAAO,EAAE,eAAe,SAAS,GAAG,EAAE,CAAC,CAAC;QAE7E,MAAM,UAAU,GAAG,MAAM,KAAK,UAAU,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC;QACxD,MAAM,MAAM,GAAG,MAAM,YAAY,CAAC,SAAS,EAAE,cAAc,EAAE,UAAU,CAAC,CAAC;QAEzE,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;QAEpB,WAAW,EAAE,CAAC;QACd,OAAO;IACX,CAAC;CACJ,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FetchGame.d.ts","sourceRoot":"","sources":["../../../src/commands/games/FetchGame.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAQrD,eAAO,MAAM,gBAAgB,EAAE,UAsC9B,CAAC"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { input, select } from '@inquirer/prompts';
|
|
2
|
+
import { RestartTool } from "../../cli.js";
|
|
3
|
+
import { FetchGame, gameApiMap } from "../../util/platform/FetchGame.js";
|
|
4
|
+
import { PrintError } from "../../util/Styles.js";
|
|
5
|
+
import chalk from "chalk";
|
|
6
|
+
export const fetchGameCommand = {
|
|
7
|
+
name: "fetch-game",
|
|
8
|
+
displayName: "Fetch Game",
|
|
9
|
+
description: "Returns data related to the specified game.",
|
|
10
|
+
usage: "fetch-game <method: slug | gameId> <identifier: string>",
|
|
11
|
+
requiresToken: false,
|
|
12
|
+
execute: async () => {
|
|
13
|
+
const fetchMethod = await select({ message: "Which method would you like to use?", choices: Object.keys(gameApiMap) });
|
|
14
|
+
const dataType = await select({ message: "How would you like your data?", choices: ["Simple", "Verbose"] });
|
|
15
|
+
const gameIdentifier = await input({ message: `Please enter the ${fetchMethod}:` });
|
|
16
|
+
const result = await FetchGame(fetchMethod, gameIdentifier);
|
|
17
|
+
const entries = Object.entries(result);
|
|
18
|
+
const keys = Object.keys(result);
|
|
19
|
+
if (entries.length === 0 || keys.length === 0 || "error" in result) {
|
|
20
|
+
return PrintError(`Invalid ${fetchMethod}`);
|
|
21
|
+
}
|
|
22
|
+
;
|
|
23
|
+
const game = result.game;
|
|
24
|
+
switch (dataType) {
|
|
25
|
+
case "Simple":
|
|
26
|
+
console.log(`\n${chalk.green("Game Id")}: ${game.id}`);
|
|
27
|
+
console.log(`${chalk.green("Name")}: ${game.name}`);
|
|
28
|
+
console.log(`${chalk.green("Slug")}: ${game.slug || ""}`);
|
|
29
|
+
console.log(`${chalk.green("Developer")}: ${game.organization.name}`);
|
|
30
|
+
console.log(`${chalk.green("Description")}: ${game.description || ""}\n`);
|
|
31
|
+
break;
|
|
32
|
+
case "Verbose":
|
|
33
|
+
console.dir(result, { depth: null });
|
|
34
|
+
console.log();
|
|
35
|
+
break;
|
|
36
|
+
}
|
|
37
|
+
;
|
|
38
|
+
RestartTool();
|
|
39
|
+
return;
|
|
40
|
+
}
|
|
41
|
+
};
|
|
42
|
+
//# sourceMappingURL=FetchGame.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FetchGame.js","sourceRoot":"","sources":["../../../src/commands/games/FetchGame.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAElD,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAC3C,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,kCAAkC,CAAC;AACzE,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAClD,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,MAAM,CAAC,MAAM,gBAAgB,GAAe;IACxC,IAAI,EAAE,YAAY;IAClB,WAAW,EAAE,YAAY;IACzB,WAAW,EAAE,6CAA6C;IAC1D,KAAK,EAAE,yDAAyD;IAChE,aAAa,EAAE,KAAK;IACpB,OAAO,EAAE,KAAK,IAAI,EAAE;QAChB,MAAM,WAAW,GAAG,MAAM,MAAM,CAAC,EAAE,OAAO,EAAE,qCAAqC,EAAE,OAAO,EAAE,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC,EAAC,CAAC,CAAC;QACtH,MAAM,QAAQ,GAAG,MAAM,MAAM,CAAC,EAAE,OAAO,EAAE,+BAA+B,EAAE,OAAO,EAAE,CAAE,QAAQ,EAAE,SAAS,CAAE,EAAE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E,MAAM;YACV,KAAK,SAAS;gBACV,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;gBACrC,OAAO,CAAC,GAAG,EAAE,CAAC;gBACd,MAAM;QACd,CAAC;QAAA,CAAC;QAEF,WAAW,EAAE,CAAC;QACd,OAAO;IACX,CAAC;CACJ,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FetchProfilePhoto.d.ts","sourceRoot":"","sources":["../../../src/commands/users/FetchProfilePhoto.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAOrD,eAAO,MAAM,wBAAwB,EAAE,UA2BtC,CAAC"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { PrintError } from "../../util/Styles.js";
|
|
2
|
+
import { input, select } from "@inquirer/prompts";
|
|
3
|
+
import chalk from "chalk";
|
|
4
|
+
import { RestartTool } from "../../cli.js";
|
|
5
|
+
import { FetchUser, userApiMap } from "../../util/platform/FetchUser.js";
|
|
6
|
+
export const fetchProfilePhotoCommand = {
|
|
7
|
+
name: "fetch-profile-photo",
|
|
8
|
+
displayName: "Fetch Profile Photo",
|
|
9
|
+
description: "Returns the profile picture of the given user.",
|
|
10
|
+
usage: "fetch-profile-photo <method: username | userId> <identifier: string>",
|
|
11
|
+
requiresToken: false,
|
|
12
|
+
execute: async () => {
|
|
13
|
+
const fetchMethod = await select({ message: "Which method would you like to use?", choices: Object.keys(userApiMap) });
|
|
14
|
+
const userIdentifier = await input({ message: `Please enter the ${fetchMethod}:` });
|
|
15
|
+
const result = await FetchUser(fetchMethod, userIdentifier);
|
|
16
|
+
const entries = Object.entries(result);
|
|
17
|
+
const keys = Object.keys(result);
|
|
18
|
+
if (entries.length === 0 || keys.length === 0 || "error" in result) {
|
|
19
|
+
return PrintError(`Invalid ${fetchMethod}`);
|
|
20
|
+
}
|
|
21
|
+
;
|
|
22
|
+
const user = result.user;
|
|
23
|
+
const profileImageId = user.profileImageId;
|
|
24
|
+
if (!profileImageId)
|
|
25
|
+
return PrintError("User has no profile image!");
|
|
26
|
+
console.log(chalk.green(`\nhttps://cdn.airship.gg/images/${profileImageId}\n`));
|
|
27
|
+
RestartTool();
|
|
28
|
+
return;
|
|
29
|
+
}
|
|
30
|
+
};
|
|
31
|
+
//# sourceMappingURL=FetchProfilePhoto.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FetchProfilePhoto.js","sourceRoot":"","sources":["../../../src/commands/users/FetchProfilePhoto.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAClD,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAClD,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAC3C,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,kCAAkC,CAAC;AAEzE,MAAM,CAAC,MAAM,wBAAwB,GAAe;IAChD,IAAI,EAAE,qBAAqB;IAC3B,WAAW,EAAE,qBAAqB;IAClC,WAAW,EAAE,gDAAgD;IAC7D,KAAK,EAAE,sEAAsE;IAC7E,aAAa,EAAE,KAAK;IACpB,OAAO,EAAE,KAAK,IAAI,EAAE;QAChB,MAAM,WAAW,GAAG,MAAM,MAAM,CAAC,EAAE,OAAO,EAAE,qCAAqC,EAAE,OAAO,EAAE,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC,EAAC,CAAC,CAAC;QACtH,MAAM,cAAc,GAAG,MAAM,KAAK,CAAC,EAAE,OAAO,EAAE,oBAAoB,WAAW,GAAG,EAAE,CAAC,CAAC;QAEpF,MAAM,MAAM,GAAG,MAAM,SAAS,CAAC,WAAW,EAAE,cAAc,CAAC,CAAC;QAC5D,MAAM,OAAO,GAAG,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;QACvC,MAAM,IAAI,GAAG,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QAEjC,IAAI,OAAO,CAAC,MAAM,KAAK,CAAC,IAAI,IAAI,CAAC,MAAM,KAAK,CAAC,IAAI,OAAO,IAAI,MAAM,EAAE,CAAC;YACjE,OAAO,UAAU,CAAC,WAAW,WAAW,EAAE,CAAC,CAAC;QAChD,CAAC;QAAA,CAAC;QAEF,MAAM,IAAI,GAAG,MAAM,CAAC,IAAI,CAAC;QACzB,MAAM,cAAc,GAAG,IAAI,CAAC,cAAc,CAAC;QAC3C,IAAI,CAAC,cAAc;YAAE,OAAO,UAAU,CAAC,4BAA4B,CAAC,CAAC;QAErE,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,KAAK,CAAC,mCAAmC,cAAc,IAAI,CAAC,CAAC,CAAC;QAEhF,WAAW,EAAE,CAAC;QACd,OAAO;IACX,CAAC;CACJ,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FetchUser.d.ts","sourceRoot":"","sources":["../../../src/commands/users/FetchUser.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAOrD,eAAO,MAAM,gBAAgB,EAAE,UAmC9B,CAAC"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { input, select } from '@inquirer/prompts';
|
|
2
|
+
import { PrintError } from '../../util/Styles.js';
|
|
3
|
+
import { RestartTool } from "../../cli.js";
|
|
4
|
+
import chalk from "chalk";
|
|
5
|
+
import { FetchUser, userApiMap } from "../../util/platform/FetchUser.js";
|
|
6
|
+
export const fetchUserCommand = {
|
|
7
|
+
name: "fetch-user",
|
|
8
|
+
displayName: "Fetch User",
|
|
9
|
+
description: "Returns data related to the specified user.",
|
|
10
|
+
usage: "fetch-user <method: username | userId> <identifier: string>",
|
|
11
|
+
requiresToken: false,
|
|
12
|
+
execute: async () => {
|
|
13
|
+
const fetchMethod = await select({ message: "Which method would you like to use?", choices: Object.keys(userApiMap) });
|
|
14
|
+
const dataType = await select({ message: "How would you like your data?", choices: ["Simple", "Verbose"] });
|
|
15
|
+
const userIdentifier = await input({ message: `Please enter the ${fetchMethod}:` });
|
|
16
|
+
const result = await FetchUser(fetchMethod, userIdentifier);
|
|
17
|
+
const entries = Object.entries(result);
|
|
18
|
+
const keys = Object.keys(result);
|
|
19
|
+
if (entries.length === 0 || keys.length === 0 || "error" in result) {
|
|
20
|
+
return PrintError(`Invalid ${fetchMethod}`);
|
|
21
|
+
}
|
|
22
|
+
;
|
|
23
|
+
const user = result.user;
|
|
24
|
+
switch (dataType) {
|
|
25
|
+
case "Simple":
|
|
26
|
+
console.log(`\n${chalk.green("User Id")}: ${user.uid}`);
|
|
27
|
+
console.log(`${chalk.green("Username")}: ${user.username}`);
|
|
28
|
+
console.log(`${chalk.green("Status Text")}: ${user.statusText || ""}\n`);
|
|
29
|
+
break;
|
|
30
|
+
case "Verbose":
|
|
31
|
+
console.dir(result, { depth: null });
|
|
32
|
+
console.log();
|
|
33
|
+
break;
|
|
34
|
+
}
|
|
35
|
+
;
|
|
36
|
+
RestartTool();
|
|
37
|
+
return;
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
//# sourceMappingURL=FetchUser.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FetchUser.js","sourceRoot":"","sources":["../../../src/commands/users/FetchUser.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAClD,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAClD,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAC3C,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,kCAAkC,CAAC;AAEzE,MAAM,CAAC,MAAM,gBAAgB,GAAe;IACxC,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CAAC,QAAQ,EAAE,CAAC,CAAC;gBAC5D,OAAO,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC,KAAK,CAAC,aAAa,CAAC,KAAK,IAAI,CAAC,UAAU,IAAI,EAAE,IAAI,CAAC,CAAC;gBACzE,MAAM;YACV,KAAK,SAAS;gBACV,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;gBACrC,OAAO,CAAC,GAAG,EAAE,CAAC;gBACd,MAAM;QACd,CAAC;QAAA,CAAC;QAEF,WAAW,EAAE,CAAC;QACd,OAAO;IACX,CAAC;CACJ,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IdentifierConversion.d.ts","sourceRoot":"","sources":["../../src/util/IdentifierConversion.ts"],"names":[],"mappings":"AAEA,wBAAsB,mBAAmB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,OAAO,CAAC,CAWjF"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { FetchGame } from "./platform/FetchGame.js";
|
|
2
|
+
export async function ConvertSlugToGameId(slug) {
|
|
3
|
+
const result = await FetchGame("Slug", slug);
|
|
4
|
+
const entries = Object.entries(result);
|
|
5
|
+
if (entries.length === 0 || "error" in result) {
|
|
6
|
+
// TODO: Handle Error!
|
|
7
|
+
return false;
|
|
8
|
+
}
|
|
9
|
+
;
|
|
10
|
+
const game = result.game;
|
|
11
|
+
return game.id;
|
|
12
|
+
}
|
|
13
|
+
;
|
|
14
|
+
//# sourceMappingURL=IdentifierConversion.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IdentifierConversion.js","sourceRoot":"","sources":["../../src/util/IdentifierConversion.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AAEpD,MAAM,CAAC,KAAK,UAAU,mBAAmB,CAAC,IAAY;IAClD,MAAM,MAAM,GAAG,MAAM,SAAS,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;IAC7C,MAAM,OAAO,GAAG,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;IAEvC,IAAI,OAAO,CAAC,MAAM,KAAK,CAAC,IAAI,OAAO,IAAI,MAAM,EAAE,CAAC;QAC5C,sBAAsB;QACtB,OAAO,KAAK,CAAC;IACjB,CAAC;IAAA,CAAC;IAEF,MAAM,IAAI,GAAG,MAAM,CAAC,IAAI,CAAC;IACzB,OAAO,IAAI,CAAC,EAAE,CAAC;AACnB,CAAC;AAAA,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TokenManager.d.ts","sourceRoot":"","sources":["../../src/util/TokenManager.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"TokenManager.d.ts","sourceRoot":"","sources":["../../src/util/TokenManager.ts"],"names":[],"mappings":"AAoEA,eAAO,MAAM,YAAY,oBAA0B,CAAC"}
|
package/out/util/TokenManager.js
CHANGED
|
@@ -1,8 +1,22 @@
|
|
|
1
1
|
import * as fs from 'fs';
|
|
2
2
|
import { PrintError } from './Styles.js';
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
import path, { join } from 'path';
|
|
4
|
+
const firebaseApiKey = "AIzaSyAYw0C18Mt3wijT0ZHKGcS7zVdaPlR_sGI";
|
|
5
|
+
// Ya'know, this is probably horrific but who cares!
|
|
6
|
+
const platformPathMap = {
|
|
7
|
+
"win32": path.join(`${process.env.APPDATA}`, `../../LocalLow`),
|
|
8
|
+
"darwin": path.join(`${process.env.HOME}`, "Library", "Preferences"),
|
|
9
|
+
"linux": path.join(`${process.env.HOME}`, ".steam/steam/steamapps/compatdata/2381730/pfx/drive_c/users/steamuser/AppData/LocalLow")
|
|
10
|
+
};
|
|
11
|
+
function GetApplicationPath() {
|
|
12
|
+
const platform = process.platform;
|
|
13
|
+
const applicationPath = platformPathMap[platform];
|
|
14
|
+
return applicationPath;
|
|
15
|
+
}
|
|
16
|
+
;
|
|
17
|
+
function FetchAirshipRefreshToken() {
|
|
5
18
|
let jsonData;
|
|
19
|
+
const airshipAccountPath = path.join(GetApplicationPath() + `/Easy/Airship/account.json`);
|
|
6
20
|
try {
|
|
7
21
|
const accountsFile = fs.readFileSync(airshipAccountPath);
|
|
8
22
|
jsonData = JSON.parse(accountsFile.toString("utf8"));
|
|
@@ -15,5 +29,32 @@ function FetchAirshipToken() {
|
|
|
15
29
|
return jsonData.refreshToken;
|
|
16
30
|
}
|
|
17
31
|
;
|
|
18
|
-
|
|
32
|
+
async function UseRefreshToken() {
|
|
33
|
+
const refreshToken = FetchAirshipRefreshToken();
|
|
34
|
+
if (refreshToken === undefined) {
|
|
35
|
+
// TODO: Handle Error!
|
|
36
|
+
return;
|
|
37
|
+
}
|
|
38
|
+
;
|
|
39
|
+
const body = `grantType=refresh_token&refresh_token=${refreshToken}`;
|
|
40
|
+
const request = await fetch(`https://securetoken.googleapis.com/v1/token?key=${firebaseApiKey}&${body}`, {
|
|
41
|
+
method: "POST",
|
|
42
|
+
headers: {
|
|
43
|
+
"Content-Type": "application/x-www-form-urlencoded"
|
|
44
|
+
}
|
|
45
|
+
});
|
|
46
|
+
const data = await request.text();
|
|
47
|
+
const result = JSON.parse(data);
|
|
48
|
+
if ("error" in result) {
|
|
49
|
+
// TODO: Handle Error!
|
|
50
|
+
return;
|
|
51
|
+
}
|
|
52
|
+
;
|
|
53
|
+
// const newRefresh = result.refresh_token;
|
|
54
|
+
const accessToken = result.access_token;
|
|
55
|
+
return "Bearer " + accessToken;
|
|
56
|
+
}
|
|
57
|
+
;
|
|
58
|
+
UseRefreshToken();
|
|
59
|
+
export const AirshipToken = await UseRefreshToken();
|
|
19
60
|
//# sourceMappingURL=TokenManager.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TokenManager.js","sourceRoot":"","sources":["../../src/util/TokenManager.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,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,EAAE,UAAU,EAAE,OAAO,GAAG,OAAO,CAAC,EAAE,GAAG,YAAY,CAAC,CAsB/H"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import chalk from "chalk";
|
|
2
|
+
import { ConvertSlugToGameId } from "../IdentifierConversion.js";
|
|
3
|
+
import { AirshipToken } from "../TokenManager.js";
|
|
4
|
+
const apiPath = "https://api.airship.gg/content/favorites/GAME";
|
|
5
|
+
export async function FavoriteGame(fetchMethod, gameIdentifier, isFavorite) {
|
|
6
|
+
const gameId = fetchMethod === "Slug" ? await ConvertSlugToGameId(gameIdentifier) : gameIdentifier;
|
|
7
|
+
if (gameId === false) {
|
|
8
|
+
// TODO: Handle Error!
|
|
9
|
+
return {};
|
|
10
|
+
}
|
|
11
|
+
;
|
|
12
|
+
const request = await fetch(apiPath, {
|
|
13
|
+
method: "POST",
|
|
14
|
+
body: JSON.stringify({
|
|
15
|
+
"resourceId": gameId,
|
|
16
|
+
"isFavorite": isFavorite
|
|
17
|
+
}),
|
|
18
|
+
headers: {
|
|
19
|
+
"Authorization": AirshipToken,
|
|
20
|
+
"Content-Type": "application/json"
|
|
21
|
+
}
|
|
22
|
+
});
|
|
23
|
+
const data = await request.text();
|
|
24
|
+
const result = data ? JSON.parse(data) : chalk.green(`\nSuccessfully set Favorite to "${isFavorite}" on "${gameIdentifier}"!\n`);
|
|
25
|
+
return result;
|
|
26
|
+
}
|
|
27
|
+
;
|
|
28
|
+
//# sourceMappingURL=FavoriteGame.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FavoriteGame.js","sourceRoot":"","sources":["../../../src/util/platform/FavoriteGame.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AACjE,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAElD,MAAM,OAAO,GAAG,+CAA+C,CAAC;AAEhE,MAAM,CAAC,KAAK,UAAU,YAAY,CAAC,WAAmB,EAAE,cAAsB,EAAE,UAAmB;IAC/F,MAAM,MAAM,GAAG,WAAW,KAAK,MAAM,CAAC,CAAC,CAAC,MAAM,mBAAmB,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC,cAAc,CAAC;IACnG,IAAI,MAAM,KAAK,KAAK,EAAE,CAAC;QACnB,sBAAsB;QACtB,OAAO,EAAkB,CAAC;IAC9B,CAAC;IAAA,CAAC;IAEF,MAAM,OAAO,GAAG,MAAM,KAAK,CAAC,OAAO,EAAE;QACjC,MAAM,EAAE,MAAM;QACd,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC;YACjB,YAAY,EAAE,MAAM;YACpB,YAAY,EAAE,UAAU;SAC3B,CAAC;QACF,OAAO,EAAE;YACL,eAAe,EAAE,YAAa;YAC9B,cAAc,EAAE,kBAAkB;SACrC;KACJ,CAAC,CAAC;IACH,MAAM,IAAI,GAAG,MAAM,OAAO,CAAC,IAAI,EAAE,CAAC;IAClC,MAAM,MAAM,GAAG,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAsB,CAAC,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,mCAAmC,UAAU,SAAS,cAAc,MAAM,CAAC,CAAC;IAEtJ,OAAO,MAAM,CAAC;AAClB,CAAC;AAAA,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { AirshipError, AirshipGame } from "../../AirshipTypes.js";
|
|
2
|
+
export declare const gameApiMap: {
|
|
3
|
+
[key: string]: string;
|
|
4
|
+
};
|
|
5
|
+
export declare function FetchGame(fetchMethod: string, gameIdentifier: string): Promise<AirshipGame | AirshipError>;
|
|
6
|
+
//# sourceMappingURL=FetchGame.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FetchGame.d.ts","sourceRoot":"","sources":["../../../src/util/platform/FetchGame.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAEvE,eAAO,MAAM,UAAU,EAAE;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAA;CAG/C,CAAC;AAEF,wBAAsB,SAAS,CAAC,WAAW,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,GAAG,YAAY,CAAC,CAQhH"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export const gameApiMap = {
|
|
2
|
+
"Slug": "https://api.airship.gg/content/games/slug/",
|
|
3
|
+
"GameId": "https://api.airship.gg/content/games/game-id/"
|
|
4
|
+
};
|
|
5
|
+
export async function FetchGame(fetchMethod, gameIdentifier) {
|
|
6
|
+
const request = await fetch(gameApiMap[fetchMethod] + gameIdentifier, {
|
|
7
|
+
method: "GET"
|
|
8
|
+
});
|
|
9
|
+
const data = await request.text();
|
|
10
|
+
const result = JSON.parse(data);
|
|
11
|
+
return result;
|
|
12
|
+
}
|
|
13
|
+
;
|
|
14
|
+
//# sourceMappingURL=FetchGame.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FetchGame.js","sourceRoot":"","sources":["../../../src/util/platform/FetchGame.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,UAAU,GAA8B;IACjD,MAAM,EAAE,4CAA4C;IACpD,QAAQ,EAAE,+CAA+C;CAC5D,CAAC;AAEF,MAAM,CAAC,KAAK,UAAU,SAAS,CAAC,WAAmB,EAAE,cAAsB;IACvE,MAAM,OAAO,GAAG,MAAM,KAAK,CAAC,UAAU,CAAC,WAAW,CAAC,GAAG,cAAc,EAAE;QAClE,MAAM,EAAE,KAAK;KAChB,CAAC,CAAC;IACH,MAAM,IAAI,GAAG,MAAM,OAAO,CAAC,IAAI,EAAE,CAAC;IAClC,MAAM,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAA+B,CAAC;IAE9D,OAAO,MAAM,CAAC;AAClB,CAAC;AAAA,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { AirshipError, AirshipUser } from "../../AirshipTypes.js";
|
|
2
|
+
export declare const userApiMap: {
|
|
3
|
+
[key: string]: string;
|
|
4
|
+
};
|
|
5
|
+
export declare function FetchUser(fetchMethod: string, userIdentifier: string): Promise<AirshipUser | AirshipError>;
|
|
6
|
+
//# sourceMappingURL=FetchUser.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FetchUser.d.ts","sourceRoot":"","sources":["../../../src/util/platform/FetchUser.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAEvE,eAAO,MAAM,UAAU,EAAE;IAAE,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAAA;CAG/C,CAAC;AAEF,wBAAsB,SAAS,CAAC,WAAW,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM,GAAG,OAAO,CAAC,WAAW,GAAG,YAAY,CAAC,CAQhH"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export const userApiMap = {
|
|
2
|
+
"Username": "https://api.airship.gg/game-coordinator/users/user?username=",
|
|
3
|
+
"UserId": "https://api.airship.gg/game-coordinator/users/uid/"
|
|
4
|
+
};
|
|
5
|
+
export async function FetchUser(fetchMethod, userIdentifier) {
|
|
6
|
+
const request = await fetch(userApiMap[fetchMethod] + userIdentifier, {
|
|
7
|
+
method: "GET"
|
|
8
|
+
});
|
|
9
|
+
const data = await request.text();
|
|
10
|
+
const result = JSON.parse(data);
|
|
11
|
+
return result;
|
|
12
|
+
}
|
|
13
|
+
;
|
|
14
|
+
//# sourceMappingURL=FetchUser.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FetchUser.js","sourceRoot":"","sources":["../../../src/util/platform/FetchUser.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,UAAU,GAA8B;IACjD,UAAU,EAAE,8DAA8D;IAC1E,QAAQ,EAAE,oDAAoD;CACjE,CAAC;AAEF,MAAM,CAAC,KAAK,UAAU,SAAS,CAAC,WAAmB,EAAE,cAAsB;IACvE,MAAM,OAAO,GAAG,MAAM,KAAK,CAAC,UAAU,CAAC,WAAW,CAAC,GAAG,cAAc,EAAE;QAClE,MAAM,EAAE,KAAK;KAChB,CAAC,CAAC;IACH,MAAM,IAAI,GAAG,MAAM,OAAO,CAAC,IAAI,EAAE,CAAC;IAClC,MAAM,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAA+B,CAAC;IAE9D,OAAO,MAAM,CAAC;AAClB,CAAC;AAAA,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,14 +1,18 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "airship-cli",
|
|
3
|
-
"version": "1.1
|
|
3
|
+
"version": "1.2.1",
|
|
4
4
|
"description": "A CLI Tool to interact with Airship's API endpoints.",
|
|
5
5
|
"main": "out/cli.js",
|
|
6
6
|
"bin": {
|
|
7
7
|
"airship": "out/cli.js"
|
|
8
8
|
},
|
|
9
|
+
"files": [
|
|
10
|
+
"out/"
|
|
11
|
+
],
|
|
9
12
|
"type": "module",
|
|
10
13
|
"scripts": {
|
|
11
|
-
"tsc": "tsc --w"
|
|
14
|
+
"tsc": "tsc --w",
|
|
15
|
+
"publish": "npm ci && npm publish"
|
|
12
16
|
},
|
|
13
17
|
"author": "Max McDaniel",
|
|
14
18
|
"license": "ISC",
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
name: Public NPM Package
|
|
2
|
-
|
|
3
|
-
on:
|
|
4
|
-
release:
|
|
5
|
-
types: [created]
|
|
6
|
-
|
|
7
|
-
permissions:
|
|
8
|
-
id-token: write
|
|
9
|
-
contents: read
|
|
10
|
-
|
|
11
|
-
jobs:
|
|
12
|
-
publish:
|
|
13
|
-
runs-on: ubuntu-latest
|
|
14
|
-
steps:
|
|
15
|
-
- uses: actions/checkout@v4
|
|
16
|
-
|
|
17
|
-
- uses: actions/setup-node@v4
|
|
18
|
-
with:
|
|
19
|
-
node-version: '24'
|
|
20
|
-
registry-url: 'https://registry.npmjs.org'
|
|
21
|
-
- run: npm ci
|
|
22
|
-
- run: npm publish
|