Files
MyIP/common
jason5ng32andClaude Opus 4.7 75d6248ba1 chore(backend): misc cleanups
Five small quality-of-life fixes found during the backend review, each
independent of the others:

- api/cf-radar.js: drop unused `import { parse } from 'dotenv'`; hoist
  `cleanUpResponseData` from inside the default export to module scope
  so it's not re-created on every request.
- api/mac-checker.js: tighten `isValidMAC` to exactly 12 hex chars. The
  previous 6–12 range was too permissive — partial MAC prefixes would
  reach the upstream API and return garbage.
- common/referer-check.js: drop `dotenv.config()`. It already ran once
  from backend-server.js via normal import order; duplicating on every
  referer check was wasted work and muddied responsibilities
  (referer-check shouldn't own env bootstrap).
- frontend/utils/valid-ip.js: re-export from common/valid-ip.js instead
  of keeping a near-duplicate copy. tests/valid-ip.test.js already
  asserts both paths agree, so the thin re-export keeps that test
  passing while removing the drift risk.

The configs.js "req.method !== 'GET'" branch looked like dead code but
a dedicated smoke test asserts it, so it stays as defensive programming
in case the handler is ever mounted with app.all(). Not touched.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-18 17:44:56 +08:00
..
2026-04-18 17:44:56 +08:00
2026-04-15 01:26:19 +08:00