mirror of
https://github.com/farcasclaudiu/openclaw.git
synced 2026-06-28 11:01:39 +03:00
chore: Enable "curly" rule to avoid single-statement if confusion/errors.
This commit is contained in:
@@ -34,11 +34,17 @@ type ExecApprovalsCliOpts = NodesRpcOpts & {
|
||||
|
||||
function formatAge(msAgo: number) {
|
||||
const s = Math.max(0, Math.floor(msAgo / 1000));
|
||||
if (s < 60) return `${s}s`;
|
||||
if (s < 60) {
|
||||
return `${s}s`;
|
||||
}
|
||||
const m = Math.floor(s / 60);
|
||||
if (m < 60) return `${m}m`;
|
||||
if (m < 60) {
|
||||
return `${m}m`;
|
||||
}
|
||||
const h = Math.floor(m / 60);
|
||||
if (h < 24) return `${h}h`;
|
||||
if (h < 24) {
|
||||
return `${h}h`;
|
||||
}
|
||||
const d = Math.floor(h / 24);
|
||||
return `${d}d`;
|
||||
}
|
||||
@@ -52,9 +58,13 @@ async function readStdin(): Promise<string> {
|
||||
}
|
||||
|
||||
async function resolveTargetNodeId(opts: ExecApprovalsCliOpts): Promise<string | null> {
|
||||
if (opts.gateway) return null;
|
||||
if (opts.gateway) {
|
||||
return null;
|
||||
}
|
||||
const raw = opts.node?.trim() ?? "";
|
||||
if (!raw) return null;
|
||||
if (!raw) {
|
||||
return null;
|
||||
}
|
||||
return await resolveNodeId(opts as NodesRpcOpts, raw);
|
||||
}
|
||||
|
||||
@@ -125,7 +135,9 @@ function renderApprovalsSnapshot(snapshot: ExecApprovalsSnapshot, targetLabel: s
|
||||
const allowlist = Array.isArray(agent.allowlist) ? agent.allowlist : [];
|
||||
for (const entry of allowlist) {
|
||||
const pattern = entry?.pattern?.trim() ?? "";
|
||||
if (!pattern) continue;
|
||||
if (!pattern) {
|
||||
continue;
|
||||
}
|
||||
const lastUsedAt = typeof entry.lastUsedAt === "number" ? entry.lastUsedAt : null;
|
||||
allowlistRows.push({
|
||||
Target: targetLabel,
|
||||
|
||||
Reference in New Issue
Block a user