Files
trumpsignal-frontend/app/api/proxy/[...path]/route.ts
T
k f34ae9eb00 feat(macro-vibes): rename BTC Signal → Macro Vibes; add MacroPanel UI
Module rename across page H1, navbar tab, URL (/en/btc → /en/macro),
all metadata/JSON-LD, sitemap, llms.txt, opengraph image, and SystemControl
copy. Old /btc route fully removed.

New components/btc/MacroPanel.tsx polls /api/macro/snapshot and lays out
the 8 indicators in four sections (Valuation / Bottom trigger reference /
Market structure / Sentiment & flows / Positioning) with tone-coloured
values, current-band threshold chips, and a single CoinGlass / source
chart link per card. Composite -100..+100 needle pulses on score change.

Also fixes the pinned bottom-reversal alert on the homepage, which still
linked to the now-404 /en/btc — now routes to /en/macro.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-26 01:05:18 +08:00

54 lines
1.5 KiB
TypeScript

import { NextRequest, NextResponse } from 'next/server'
const API_BASE = process.env.NEXT_PUBLIC_API_URL || 'http://localhost:8000'
async function handler(request: NextRequest): Promise<NextResponse> {
const url = new URL(request.url)
const targetPath = url.pathname.replace('/api/proxy', '')
const targetUrl = `${API_BASE}${targetPath}${url.search}`
const headers = new Headers(request.headers)
// Remove Next.js internal headers
headers.delete('host')
headers.delete('x-forwarded-for')
headers.delete('x-forwarded-host')
headers.delete('x-forwarded-proto')
const body =
request.method !== 'GET' && request.method !== 'HEAD'
? await request.arrayBuffer()
: undefined
try {
const upstream = await fetch(targetUrl, {
method: request.method,
headers,
body,
})
const responseHeaders = new Headers(upstream.headers)
responseHeaders.delete('transfer-encoding')
const responseBody = await upstream.arrayBuffer()
return new NextResponse(responseBody, {
status: upstream.status,
statusText: upstream.statusText,
headers: responseHeaders,
})
} catch (err) {
return NextResponse.json(
{ error: 'Upstream request failed', detail: String(err) },
{ status: 502 },
)
}
}
export const GET = handler
export const POST = handler
export const PUT = handler
export const PATCH = handler
export const DELETE = handler
export const HEAD = handler
export const OPTIONS = handler