@irfanshadikrishad/anilist 1.4.1 → 1.4.2
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/bin/helpers/auth.js +5 -3
- package/package.json +2 -1
package/bin/helpers/auth.js
CHANGED
|
@@ -7,6 +7,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
7
7
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
8
|
});
|
|
9
9
|
};
|
|
10
|
+
import { Cipher } from "@irfanshadikrishad/cipher";
|
|
10
11
|
import fs from "fs";
|
|
11
12
|
import inquirer from "inquirer";
|
|
12
13
|
import fetch from "node-fetch";
|
|
@@ -21,8 +22,9 @@ import { activityAllQuery, activityAnimeListQuery, activityMangaListQuery, activ
|
|
|
21
22
|
import { responsiveOutput } from "./truncate.js";
|
|
22
23
|
import { aniListEndpoint, getTitle, redirectUri, timestampToTimeAgo, } from "./workers.js";
|
|
23
24
|
const home_dir = os.homedir();
|
|
24
|
-
const save_path = path.join(home_dir, ".
|
|
25
|
+
const save_path = path.join(home_dir, ".anilist_tok3n");
|
|
25
26
|
const spinner = new Spinner();
|
|
27
|
+
const vigenere = new Cipher.Vigenere("anilist");
|
|
26
28
|
class Auth {
|
|
27
29
|
/**
|
|
28
30
|
* Get access-token from user
|
|
@@ -56,7 +58,7 @@ class Auth {
|
|
|
56
58
|
console.warn("\nNo token provided. Nothing to store.");
|
|
57
59
|
return;
|
|
58
60
|
}
|
|
59
|
-
fs.writeFileSync(save_path, token, { encoding: "utf8" });
|
|
61
|
+
fs.writeFileSync(save_path, vigenere.encrypt(token), { encoding: "utf8" });
|
|
60
62
|
}
|
|
61
63
|
catch (error) {
|
|
62
64
|
console.error(`\nError storing access token: ${error.message}`);
|
|
@@ -67,7 +69,7 @@ class Auth {
|
|
|
67
69
|
return __awaiter(this, void 0, void 0, function* () {
|
|
68
70
|
try {
|
|
69
71
|
if (fs.existsSync(save_path)) {
|
|
70
|
-
return fs.readFileSync(save_path, { encoding: "utf8" });
|
|
72
|
+
return vigenere.decrypt(fs.readFileSync(save_path, { encoding: "utf8" }));
|
|
71
73
|
}
|
|
72
74
|
else {
|
|
73
75
|
return null;
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@irfanshadikrishad/anilist",
|
|
3
3
|
"description": "Minimalist unofficial AniList CLI for Anime and Manga Enthusiasts",
|
|
4
4
|
"author": "Irfan Shadik Rishad",
|
|
5
|
-
"version": "1.4.
|
|
5
|
+
"version": "1.4.2",
|
|
6
6
|
"main": "./bin/index.js",
|
|
7
7
|
"type": "module",
|
|
8
8
|
"types": "./bin/index.d.ts",
|
|
@@ -71,6 +71,7 @@
|
|
|
71
71
|
"typescript": "^5.7.3"
|
|
72
72
|
},
|
|
73
73
|
"dependencies": {
|
|
74
|
+
"@irfanshadikrishad/cipher": "^1.0.1",
|
|
74
75
|
"cli-truncate": "^4.0.0",
|
|
75
76
|
"commander": "^13.1.0",
|
|
76
77
|
"fast-xml-parser": "^5.0.6",
|