fix(console): redirect old zen and go docs from docs proxy

This commit is contained in:
Frank
2026-10-12 23:02:39 -04:00
Unverified
parent d7cfdaa3c7
commit b4a57f6849
2 changed files with 5 additions and 5 deletions
@@ -5,6 +5,11 @@ import { cookie, docs, localeFromRequest, tag } from "~/lib/language"
async function handler(evt: APIEvent) {
const req = evt.request.clone()
const url = new URL(req.url)
const moved = /^\/docs\/(?:[^/]+\/)?(zen|go)\/?$/.exec(url.pathname)
if (moved) {
return Response.redirect(new URL(moved[1] === "go" ? "/v2/docs/console/go/" : "/v2/docs/console/models/", url), 302)
}
const locale = localeFromRequest(req)
const host = Resource.App.stage === "production" ? "docs.opencode.ai" : "docs.dev.opencode.ai"
const targetUrl = `https://${host}${docs(locale, url.pathname)}${url.search}`
-5
View File
@@ -78,11 +78,6 @@ function localeFromAcceptLanguage(header: string | null) {
}
export const onRequest = defineMiddleware((ctx, next) => {
const moved = /^\/docs\/(?:[^/]+\/)?(zen|go)\/?$/.exec(ctx.url.pathname)
if (moved) {
return redirect(ctx.url, moved[1] === "go" ? "/v2/docs/console/go/" : "/v2/docs/console/models/")
}
const alias = docsAlias(ctx.url.pathname)
if (alias) {
return redirect(ctx.url, alias.path, alias.locale)