feat(web): import oh-my-openagent-web Next.js + Cloudflare Workers site
Imports the public marketing site previously living in ../oh-my-opencode-web. Independent of the npm plugin: own package.json, bun.lock, tsconfig.json. Not included in the published package — root files: array still only ships dist/, bin/, postinstall.mjs. Stack: - Next.js 15.5 App Router + RSC, deployed to Cloudflare Workers via @opennextjs/cloudflare (build target .open-next/worker.js). - Tailwind v4 + shadcn/ui primitives. - next-intl with 4 locales (en/ja/ko/zh) under app/[locale]/. - Playwright e2e tests under web/e2e/. - Custom domains ohmyopenagent.com (primary) and ohmyopencode.org (legacy alias) declared in web/wrangler.toml. Source files were re-formatted via `bun run format` to bring them in line with the existing .prettierrc (singleQuote: false). Functional code unchanged.
This commit is contained in:
@@ -0,0 +1,26 @@
|
||||
import { NextResponse, type NextRequest } from "next/server"
|
||||
import createMiddleware from "next-intl/middleware"
|
||||
import { routing } from "./i18n/routing"
|
||||
|
||||
const handleI18nRouting = createMiddleware(routing)
|
||||
const oldHosts = new Set(["ohmyopencode.org", "www.ohmyopencode.org"])
|
||||
const primaryHost = "ohmyopenagent.com"
|
||||
|
||||
export default function middleware(request: NextRequest) {
|
||||
const forwardedHost = request.headers.get("x-forwarded-host")
|
||||
const requestHost = request.headers.get("host")
|
||||
const hostname = (forwardedHost ?? requestHost ?? request.nextUrl.hostname).split(":")[0]
|
||||
|
||||
if (hostname && oldHosts.has(hostname)) {
|
||||
const redirectUrl = request.nextUrl.clone()
|
||||
redirectUrl.protocol = "https"
|
||||
redirectUrl.host = primaryHost
|
||||
return NextResponse.redirect(redirectUrl, 308)
|
||||
}
|
||||
|
||||
return handleI18nRouting(request)
|
||||
}
|
||||
|
||||
export const config = {
|
||||
matcher: ["/", "/((?!api|_next|_vercel|.*\\..*).+)"],
|
||||
}
|
||||
Reference in New Issue
Block a user