Files
wowcheckout/ui/app/(app)/dashboard/invoices.csv/route.ts
T
jwinterm f8f9b4424c Fork xmrcheckout for Wownero (WOW)
Minimal changes from upstream xmrcheckout to support Wownero:
- Rate provider: Nonlogs WOW-BTC via Kraken BTC/USD
- Subaddress derivation: Wownero network byte overrides (53/63/54)
- Payment URI scheme: wownero:
- Dockerfile: Wownero binaries from Codeberg
- Display text: Monero→Wownero, XMR→WOW throughout UI
- Default daemon: 192.168.88.235:34568
- Added wownero-logo.svg

File and folder structure kept identical to upstream for easy sync.
2026-03-09 11:08:55 -04:00

38 lines
1.2 KiB
TypeScript

import { cookies } from "next/headers";
const apiBaseUrl = process.env.API_BASE_URL ?? "http://localhost:8000";
export async function GET(request: Request) {
const apiKey = (await cookies()).get("wowcheckout_api_key")?.value;
if (!apiKey) {
return new Response("Unauthorized", { status: 401 });
}
const sourceUrl = new URL(request.url);
const targetUrl = new URL(`${apiBaseUrl}/api/core/invoices/export.csv`);
sourceUrl.searchParams.forEach((value, key) => {
targetUrl.searchParams.set(key, value);
});
const response = await fetch(targetUrl.toString(), {
headers: { Authorization: `ApiKey ${apiKey}` },
cache: "no-store",
});
if (!response.ok) {
const message = await response.text().catch(() => "Unable to export invoices.");
return new Response(message, { status: response.status });
}
const headers = new Headers();
headers.set("Content-Type", response.headers.get("content-type") ?? "text/csv");
const disposition = response.headers.get("content-disposition");
headers.set(
"Content-Disposition",
disposition ?? 'attachment; filename="invoices.csv"'
);
return new Response(response.body, { status: 200, headers });
}