mirror of
https://github.com/profullstack/logicsrc.git
synced 2026-12-01 09:24:46 +00:00
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>
This commit is contained in:
parent
d8a08c006b
commit
b20afe6f50
10 changed files with 44 additions and 12 deletions
|
|
@ -2,6 +2,7 @@
|
|||
import { Router } from "express";
|
||||
import crypto from "node:crypto";
|
||||
import { config } from "../config.mjs";
|
||||
import { COINPAY_UA } from "../lib/coinpay-ua.mjs";
|
||||
import { token } from "../lib/crypto.mjs";
|
||||
import { createSession, setCeremony, getCeremony, clearCeremony, takeNext } from "../lib/session.mjs";
|
||||
import { userByCoinpay, createUserForCoinpay } from "../lib/users.mjs";
|
||||
|
|
@ -39,7 +40,7 @@ coinpayRouter.get("/auth/coinpay/callback", async (req, res) => {
|
|||
try {
|
||||
const tokenRes = await fetch(config.coinpay.oauth.tokenUrl, {
|
||||
method: "POST",
|
||||
headers: { "content-type": "application/x-www-form-urlencoded" },
|
||||
headers: { "content-type": "application/x-www-form-urlencoded", "user-agent": COINPAY_UA },
|
||||
body: new URLSearchParams({
|
||||
grant_type: "authorization_code",
|
||||
code: String(req.query.code),
|
||||
|
|
@ -52,7 +53,7 @@ coinpayRouter.get("/auth/coinpay/callback", async (req, res) => {
|
|||
const tok = await tokenRes.json();
|
||||
|
||||
const infoRes = await fetch(config.coinpay.oauth.userinfoUrl, {
|
||||
headers: { authorization: `Bearer ${tok.access_token}` },
|
||||
headers: { authorization: `Bearer ${tok.access_token}`, "user-agent": COINPAY_UA },
|
||||
});
|
||||
if (!infoRes.ok) throw new Error(`userinfo ${infoRes.status}`);
|
||||
const info = await infoRes.json();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue