Highlights
-
GET /sysinfo— neofetch-style system banner — opt-in route (requires--sysinfoflag) that renders hostname, OS name + version, kernel version, CPU model + core count, total RAM, uptime, and load averages as a standard pylon multi-caption card. Data is collected by a platform-specificCollector(Linux reads/proc/*; Darwin shells out tosysctlwith a 2 s timeout; other platforms return runtime stubs) and cached atomically every five seconds via a background refresher goroutine — the handler never blocks on syscalls.Cache-Control: max-age=5on every response matches the refresh cadence. State-transition logging (log once on ok→fail, once on fail→ok) prevents log floods on sustained collection failures./sysinfois deliberately gated behind--sysinfobecause hostname + OS + kernel + CPU model is enough to fingerprint an exact cloud instance type and cross-reference unpatched CVEs; seedocs/security.md. -
GET /metrics— always-on route analytics — renders per-route request counts since process start as a left-aligned tabular banner. Routes are sorted by count descending, with lexicographic tiebreaking. Counts are in-process only (no external store). The counter middleware is registered as the firstr.Use()so every request — including htmlcache hits — is counted./healthzand/robots.txtare registered inserver.New()before the middleware and are intentionally excluded (infra-probe noise). Route patterns (e.g./stock/:symbol) are visible in the output; unregistered paths are counted under the sentinelno-route. No flag required. -
buildBlockssignature refactor — the 20-parameterbuildBlocksfunction inservice/stockis collapsed into astockRenderInputstruct. No behavior change; removes a class of call-site errors and makes the stock render pipeline easier to extend. -
Locale regression tests —
TestBareZhResolvesToZhTWpins?lang=zh→ zh-TW (Traditional, not Simplified);TestCFIPCountryLocaleResolutionpins TW/HK/MO → zh-TW and CN/SG → zh-CN via theCF-IPCountryheader. Unit tests added forformatThousands,formatLargeNumber, androcYearMonthLabeledge cases.
Other changes
middleware/reqcounter:sync.Map+*atomic.Int64per-route counter, lock-freeSnapshot()(sorted copy),Uptime()since process start. 50-goroutine concurrent increment test confirms no data race under-race.- Darwin sysinfo collector uses
exec.CommandContextwith a 2 s deadline instead of bareexec.Command— prevents the background refresher goroutine from blocking indefinitely on a hungsysctlsubprocess. .github/workflows/test.ymlcross-compile step:GOOS=darwin go build ./...on the ubuntu-latest runner ensures darwin-tagged files compile cleanly in CI even without a macOS runner.docs/security.mdextended with/sysinfo(infrastructure disclosure, CVE fingerprinting risk, CDN caching caveat) and/metrics(route pattern disclosure) sections.
Container image
ghcr.io/cmj0121/imagelet:0.8.0