mirror of
https://github.com/nexu-io/open-design.git
synced 2026-10-27 09:51:12 +01:00
* fix(landing-page): emit localized plugins/templates/[kind] pages in production
The `[locale]/plugins/templates/[kind]` route imported `getStaticPaths`
from the sibling English `[kind]` page and re-invoked it. That cross-page
`getStaticPaths` re-export resolved to zero paths in the CI (Linux)
production build, so every `/<locale>/plugins/templates/<kind>/` URL
(deck, prototype, image, video, audio, live-artifact, hyperframes) 404'd
in production for all non-English locales — while the English routes and
the localized category index built fine. The language switcher on the
English category pages links straight into these 404s.
Derive the locale x category paths directly from PLUGIN_CATEGORIES (the
same source the English page's own getStaticPaths uses), mirroring the
self-contained `[locale]/plugins/[slug]` wrapper, so the route no longer
depends on the fragile cross-page getStaticPaths import.
* fix(landing-page): stop download function shadowing localized catalog pages
The attributed-download function `functions/[os]/[arch]/[token]/[asset].ts`
has a file-path route (`/[os]/[arch]/[token]/[asset]`) that structurally
matches ANY four-segment path. Pages Functions run before static-asset
serving, so it was intercepting the localized plugin catalog pages — e.g.
`/zh/plugins/templates/deck/` bound os=zh, arch=plugins, token=templates,
asset=deck — and returning `{"error":"download_not_found"}` (404) instead
of the real page. Every `/<locale>/plugins/templates/<kind>/` URL (the only
four-segment paths on the site) 404'd for all non-English locales, and the
language switcher on the English category pages links straight into them.
Real download URLs are minted only as `/{windows|macos|linux}/{arch}/{token}
/{asset}` (see `functions/api/attribution/mint.ts`), so gate the function on
the platform segment: anything whose first segment isn't a download platform
falls through to the static asset via `context.next()`. Download requests
are unaffected. Adds `next` to the local `PagesFunctionContext` type.
Paired with the localized `templates/[kind]` getStaticPaths fix in the same
branch, which makes those static pages exist in the first place.
---------
Co-authored-by: Joey <236967869+joeylee12629-star@users.noreply.github.com>