Add clock drift error messages to 14 more implementations

When timestamp auth fails (401 with timestamp in error), show helpful message:
- Error: Request timestamp expired (must be within 5 minutes of server time)
- Your computer's clock may have drifted.
- NTP sync commands for Linux/macOS/Windows

Updated: un.awk, un.cpp, un.cr, un.d, un.dart, un.groovy, un.jl, un.kt, un.nim, un.ps1, un.rs, un.tcl, un.ts, un.v
This commit is contained in:
Russell Ballestrini 2025-12-28 14:45:57 -05:00
parent ae8f9ee8c8
commit bc0da08a08
14 changed files with 168 additions and 9 deletions

11
un.ts
View file

@ -191,7 +191,16 @@ function apiRequest(endpoint: string, method: string = "GET", data: any = null,
resolve(body);
}
} else {
console.error(`${RED}Error: HTTP ${res.statusCode} - ${body}${RESET}`);
if (res.statusCode === 401 && body.toLowerCase().includes('timestamp')) {
console.error(`${RED}Error: Request timestamp expired (must be within 5 minutes of server time)${RESET}`);
console.error(`${YELLOW}Your computer's clock may have drifted.${RESET}`);
console.error("Check your system time and sync with NTP if needed:");
console.error(" Linux: sudo ntpdate -s time.nist.gov");
console.error(" macOS: sudo sntp -sS time.apple.com");
console.error(" Windows: w32tm /resync");
} else {
console.error(`${RED}Error: HTTP ${res.statusCode} - ${body}${RESET}`);
}
process.exit(1);
}
});