@moewolf/moe-icons-cli 0.0.8 → 0.0.9
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/dist/auth/token-store.js +11 -5
- package/package.json +2 -2
package/dist/auth/token-store.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { readFileSync, writeFileSync, mkdirSync, chmodSync, lstatSync } from "node:fs";
|
|
2
2
|
import { homedir } from "node:os";
|
|
3
3
|
import { join } from "node:path";
|
|
4
4
|
import { missingCredential } from "./session-policy.cjs";
|
|
@@ -24,10 +24,16 @@ export function createFileTokenStore(options = {}) {
|
|
|
24
24
|
const root = options.rootDir ?? join(homedir(), ".moeicons");
|
|
25
25
|
const file = join(root, "token-store.json");
|
|
26
26
|
function readAll() {
|
|
27
|
-
|
|
28
|
-
|
|
27
|
+
let meta;
|
|
28
|
+
try {
|
|
29
|
+
meta = lstatSync(file);
|
|
30
|
+
}
|
|
31
|
+
catch (error) {
|
|
32
|
+
if (error.code === "ENOENT")
|
|
33
|
+
return {};
|
|
34
|
+
throw new CliError("AUTH_ERROR", "file credential storage unavailable; check permissions or repair the store");
|
|
35
|
+
}
|
|
29
36
|
try {
|
|
30
|
-
const meta = lstatSync(file);
|
|
31
37
|
if (!meta.isFile() || meta.isSymbolicLink() || meta.size > 1_000_000 || (process.platform !== "win32" && ((meta.mode & 0o077) !== 0 || typeof process.getuid === "function" && meta.uid !== process.getuid())))
|
|
32
38
|
throw new Error("insecure store");
|
|
33
39
|
const raw = JSON.parse(readFileSync(file, "utf8"));
|
|
@@ -64,7 +70,7 @@ export function createFileTokenStore(options = {}) {
|
|
|
64
70
|
delete all[accountId];
|
|
65
71
|
writeAll(all);
|
|
66
72
|
},
|
|
67
|
-
clear() { writeAll({}); },
|
|
73
|
+
clear() { readAll(); writeAll({}); },
|
|
68
74
|
};
|
|
69
75
|
}
|
|
70
76
|
/** Use the native credential store when the platform provides a supported CLI. */
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@moewolf/moe-icons-cli",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.9",
|
|
4
4
|
"description": "Moeicons CLI: install React, Vue, Vanilla, or Assets icon targets, manage releases and login, and expose an MCP server.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/cli.js",
|
|
@@ -74,5 +74,5 @@
|
|
|
74
74
|
"fflate": "^0.8.2",
|
|
75
75
|
"jsonc-parser": "^3.3.1"
|
|
76
76
|
},
|
|
77
|
-
"payloadHash": "
|
|
77
|
+
"payloadHash": "2c4faa8c395ce82af178bd941ababfede769b22f1721b7e6faf3c655cc003231"
|
|
78
78
|
}
|