diff --git a/public/_redirects b/public/_redirects deleted file mode 100644 index ad37e2c..0000000 --- a/public/_redirects +++ /dev/null @@ -1 +0,0 @@ -/* /index.html 200 diff --git a/scripts/generate.ts b/scripts/generate.ts index d0f64f7..82c9b5a 100644 --- a/scripts/generate.ts +++ b/scripts/generate.ts @@ -801,12 +801,20 @@ async function generate() { console.log('Generated: /app.html') // Generate _redirects for Cloudflare Pages (SPA routes) - const redirects = `/app / 301 -/oauth/* /app.html 200 + // Static files (index.html, post/*/index.html) are served automatically + // Dynamic routes are rewritten to app.html + const redirects = `/oauth/* /app.html 200 +/at/* /app.html 200 +/new /app.html 200 +/app /app.html 200 ` fs.writeFileSync(path.join(distDir, '_redirects'), redirects) console.log('Generated: /_redirects') + // Generate 404.html as SPA fallback for unmatched routes (like /@handle) + fs.writeFileSync(path.join(distDir, '404.html'), spaHtml) + console.log('Generated: /404.html') + // Copy static files const filesToCopy = ['favicon.png', 'favicon.svg', 'config.json', 'networks.json', 'client-metadata.json', 'links.json'] for (const file of filesToCopy) { diff --git a/src/components/browser.ts b/src/components/browser.ts index 26ed08b..bf51378 100644 --- a/src/components/browser.ts +++ b/src/components/browser.ts @@ -13,6 +13,9 @@ export function renderHeader(currentHandle: string, isLoggedIn: boolean, userHan ` + // Use logged-in user's handle for input if available + const inputHandle = isLoggedIn && userHandle ? userHandle : currentHandle + return `