logicsrc/apps/pwa/src/lib/coinpay-ua.mjs
Anthony Ettinger b20afe6f50
Name logicsrc apps in the User-Agent of CoinPay calls (#293)
logicsrc.com (Next), app.logicsrc.com (pwa) and the rotation CLI now send a
descriptive User-Agent on every server-side CoinPay request, so CoinPay's
logs and throttle can tell them apart from the other apps on dev2:

- logicsrc.com: logicsrc.com/<version> (+https://logicsrc.com) on merchant
  eligibility, checkout sessions, OAuth token and userinfo; x402-gateway
  ^0.18.2 names the site on crawl-gateway calls.
- app.logicsrc.com: app.logicsrc.com/<version> on the CoinPay OAuth calls and,
  through coinpay-onboard 0.3.1's fetch hook, on the auto-rotation client.
- logicsrc CLI rotators: logicsrc-cli/<version> (+https://logicsrc.com).

Co-authored-by: riotcoder <riotcoder@profullstack.com>
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-22 04:15:30 -08:00

10 lines
432 B
JavaScript

import { readFileSync } from "node:fs";
// Sent on every server-side call to CoinPay so its logs and throttle can tell
// app.logicsrc.com apart from the other apps on the same box.
let version = "";
try {
version = JSON.parse(readFileSync(new URL("../../package.json", import.meta.url), "utf8")).version || "";
} catch {}
export const COINPAY_UA = `app.logicsrc.com${version ? `/${version}` : ""} (+https://app.logicsrc.com)`;