- ONION-URLS.md: static registry of all 43 hidden services (port, role, app path) - scripts/export-onion-urls.sh: writes live .onion addresses to onion-urls.txt at runtime - npm run onions:export shortcut added to package.json - onion-urls.txt added to .gitignore (runtime artifact, not source) - README: cohesive rewrite — architecture diagram, operator command table, source-of-truth map, BTCPay notes, full site map, common fixes - BTCPay status route: awaited params destructuring (Next 15 async params) Made-with: Cursor
33 lines
1.0 KiB
TypeScript
33 lines
1.0 KiB
TypeScript
import { NextResponse } from "next/server";
|
|
import { getBtcPayInvoiceStatus, isBtcPayConfigured } from "@/lib/btcpay";
|
|
|
|
export async function GET(
|
|
_req: Request,
|
|
{ params }: { params: Promise<{ invoiceId: string }> },
|
|
) {
|
|
if (!isBtcPayConfigured()) {
|
|
return NextResponse.json({ ok: false, error: "BTCPay not configured" }, { status: 503 });
|
|
}
|
|
|
|
const { invoiceId } = await params;
|
|
if (!invoiceId || invoiceId.length < 4) {
|
|
return NextResponse.json({ ok: false, error: "Invalid invoice ID" }, { status: 400 });
|
|
}
|
|
|
|
const result = await getBtcPayInvoiceStatus(invoiceId);
|
|
if (!result.ok) {
|
|
return NextResponse.json({ ok: false, error: result.error }, { status: 502 });
|
|
}
|
|
|
|
return NextResponse.json({
|
|
ok: true,
|
|
status: result.status,
|
|
usdAmount: result.usdAmount,
|
|
btcAddress: result.paymentMethod?.destination ?? null,
|
|
btcAmount: result.paymentMethod?.due ?? null,
|
|
btcRate: result.paymentMethod?.rate ?? null,
|
|
totalPaid: result.paymentMethod?.totalPaid ?? null,
|
|
settled: result.status === "Settled",
|
|
});
|
|
}
|