Onboarding welcome screen showed a text "Continue with GitHub" button even though NEXT_PUBLIC_GITHUB_CLIENT_ID is unset in prod (nothing to connect to) -- now hidden entirely when unconfigured, icon-only when it is (Apple-design icon-only-chrome rule). Also hoisted the public-path allowlist (middleware's auth gate + the API client's 401-redirect) into one shared apps/ritgram/web/lib/publicPaths.ts so the two definitions can't drift: the 401 interceptor previously hard-redirected any cookie-less visitor on a public page (e.g. /explore's best-effort "recommended for you" call) straight to /login before the page's own try/catch ever ran. ContentComposer's submit button is icon-only too, same rule, with an aria-label/title carrying the real action text for accessibility. tsc --noEmit clean. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
35 lines
1.1 KiB
TypeScript
35 lines
1.1 KiB
TypeScript
// Routes that must stay fully usable for a signed-out (cookie-less) visitor.
|
|
//
|
|
// Shared by:
|
|
// - middleware.ts (server-side redirect gate)
|
|
// - services/api.ts (client-side 401 interceptor — without this, any
|
|
// protected-but-optional API call made from a public page, e.g. /explore's
|
|
// "recommended for you" calls, forced a hard `window.location.href =
|
|
// '/login'` for anonymous visitors even though the page itself has no
|
|
// client-side auth redirect and already degrades gracefully on failure)
|
|
//
|
|
// Keep this the single source of truth so the two can't drift out of sync.
|
|
export const PUBLIC_PATH_PREFIXES = [
|
|
'/',
|
|
'/login',
|
|
'/register',
|
|
'/forgot-password',
|
|
'/reset-password',
|
|
'/pricing',
|
|
'/terms',
|
|
'/privacy-policy',
|
|
'/auth/github/callback',
|
|
'/auth/google/callback',
|
|
'/auth/rithub/callback',
|
|
'/embed',
|
|
'/docs',
|
|
'/import-from-github',
|
|
'/explore',
|
|
]
|
|
|
|
export function isPublicPath(pathname: string): boolean {
|
|
return PUBLIC_PATH_PREFIXES.some(
|
|
(path) => pathname === path || (path !== '/' && pathname.startsWith(`${path}/`))
|
|
)
|
|
}
|