@golproductions/check 3.1.1 → 3.1.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/package.json +1 -1
- package/src/index.js +18 -1
package/package.json
CHANGED
package/src/index.js
CHANGED
|
@@ -5,7 +5,7 @@ import { homedir, platform, arch } from "node:os";
|
|
|
5
5
|
import { pipeline } from "node:stream/promises";
|
|
6
6
|
import { Readable } from "node:stream";
|
|
7
7
|
|
|
8
|
-
const VERSION = "3.1.
|
|
8
|
+
const VERSION = "3.1.2";
|
|
9
9
|
const BINARY_VERSION = "3.0.0";
|
|
10
10
|
const API = "https://triage.golproductions.com/preflight";
|
|
11
11
|
const CDN = "https://pub-e55366a7f5994be9be04f0e205179f4a.r2.dev/releases";
|
|
@@ -647,6 +647,23 @@ async function main() {
|
|
|
647
647
|
});
|
|
648
648
|
clearTimeout(timer);
|
|
649
649
|
const d = await res.json();
|
|
650
|
+
|
|
651
|
+
// Billing and account states arrive as non-2xx and carry no `verdict`.
|
|
652
|
+
// Surface what the server actually said so the user knows this is about
|
|
653
|
+
// their account, not their command. Without this, the free-tier wall
|
|
654
|
+
// (HTTP 402) falls through to the generic "denied" below and reads like
|
|
655
|
+
// the command itself was rejected.
|
|
656
|
+
if (!res.ok) {
|
|
657
|
+
if (res.status === 402) {
|
|
658
|
+
const free = d.daily_free || 120;
|
|
659
|
+
const upsell = d.upgrade || "Top up at https://www.golproductions.com/console.html";
|
|
660
|
+
out(f, false, `check: you've used all ${free} free checks for today. Credits you buy never expire. ${upsell}`);
|
|
661
|
+
return;
|
|
662
|
+
}
|
|
663
|
+
out(f, false, d.reason || d.error || "check: request not authorized, command blocked");
|
|
664
|
+
return;
|
|
665
|
+
}
|
|
666
|
+
|
|
650
667
|
if (d.verdict === "runnable") { out(f, true); }
|
|
651
668
|
else { out(f, false, d.reason || "denied — address the issue before continuing"); }
|
|
652
669
|
} catch { out(f, false, "check: verification failed, command blocked"); }
|