howtofixcli 0.7.7 → 0.7.8
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/brand.js +1 -1
- package/dist/cli-checkin.js +9 -5
- package/dist/ui.js +6 -0
- package/package.json +1 -1
package/dist/brand.js
CHANGED
package/dist/cli-checkin.js
CHANGED
|
@@ -96,21 +96,25 @@ export async function claimCliCheckin(token, options) {
|
|
|
96
96
|
const timeoutMs = options?.timeoutMs ?? 15_000;
|
|
97
97
|
const trimmed = token.trim();
|
|
98
98
|
if (!trimmed)
|
|
99
|
-
return { ok: false, alreadyClaimed: false, quotaAwarded: 0, message: "no token given" };
|
|
99
|
+
return { ok: false, alreadyClaimed: false, blocked: false, quotaAwarded: 0, message: "no token given" };
|
|
100
100
|
try {
|
|
101
101
|
const { status, body } = await callCheckin(trimmed, "POST", baseUrl, fetchImpl, timeoutMs);
|
|
102
102
|
if (body.success === true) {
|
|
103
103
|
const data = (body.data ?? {});
|
|
104
|
-
return { ok: true, alreadyClaimed: false, quotaAwarded: Number(data.quota_awarded ?? 0) || 0, message: "" };
|
|
104
|
+
return { ok: true, alreadyClaimed: false, blocked: false, quotaAwarded: Number(data.quota_awarded ?? 0) || 0, message: "" };
|
|
105
105
|
}
|
|
106
106
|
const message = typeof body.message === "string" ? body.message : `the gateway answered ${status}`;
|
|
107
|
+
// A device that already claimed for another account is a block, not the
|
|
108
|
+
// everyday "today is spent" state: the upstream is closed until staff clear
|
|
109
|
+
// it, so this must not be swallowed as a normal second start.
|
|
110
|
+
const blocked = /device already claimed|account blocked|appeal/i.test(message);
|
|
107
111
|
// The server's own sentence for "today is spent" — recognised so a normal
|
|
108
112
|
// second start never reads as an error.
|
|
109
|
-
const alreadyClaimed = /签到|check-?in|already|今日/.test(message) && !/not enabled/i.test(message);
|
|
110
|
-
return { ok: false, alreadyClaimed, quotaAwarded: 0, message };
|
|
113
|
+
const alreadyClaimed = !blocked && /签到|check-?in|already|今日/.test(message) && !/not enabled/i.test(message);
|
|
114
|
+
return { ok: false, alreadyClaimed, blocked, quotaAwarded: 0, message };
|
|
111
115
|
}
|
|
112
116
|
catch (cause) {
|
|
113
117
|
const aborted = cause instanceof Error && cause.name === "AbortError";
|
|
114
|
-
return { ok: false, alreadyClaimed: false, quotaAwarded: 0, message: aborted ? "the gateway did not answer the check-in in time" : "could not reach the gateway" };
|
|
118
|
+
return { ok: false, alreadyClaimed: false, blocked: false, quotaAwarded: 0, message: aborted ? "the gateway did not answer the check-in in time" : "could not reach the gateway" };
|
|
115
119
|
}
|
|
116
120
|
}
|
package/dist/ui.js
CHANGED
|
@@ -2255,6 +2255,12 @@ export async function runWorkbench(options) {
|
|
|
2255
2255
|
note("check-in", `daily check-in claimed: +${formatQuotaUsd(claim.quotaAwarded)} credited to your howtofix.id account`);
|
|
2256
2256
|
refresh();
|
|
2257
2257
|
}
|
|
2258
|
+
else if (claim.blocked) {
|
|
2259
|
+
// The account lost the upstream for device abuse. Say it once, with
|
|
2260
|
+
// the way to appeal, instead of failing silently until the first
|
|
2261
|
+
// model call returns a 403.
|
|
2262
|
+
note("check-in", claim.message);
|
|
2263
|
+
}
|
|
2258
2264
|
return true;
|
|
2259
2265
|
}
|
|
2260
2266
|
catch (e) {
|