[READ-ONLY] One Calendar is a privacy-first calendar web app built with Next.js. It has modern security features, including e2ee, password-protected sharing, and self-destructing share links ๐Ÿ“… calendar.xyehr.cn
nextjs
0

Configure Feed

Select the types of activity you want to include in your feed.

feat: add redirect and home path

+18 -2
+1
app/(app)/landing/page.tsx
··· 1 + export { default } from '@/app/page'
+17 -2
proxy.ts
··· 3 3 4 4 export default function proxy(request: NextRequest) { 5 5 const sessionCookie = getSessionCookie(request) 6 + 6 7 const { pathname } = request.nextUrl 7 8 8 - if (sessionCookie && ['/sign-in', '/sign-up'].includes(pathname)) { 9 + const isLoggedIn = !!sessionCookie 10 + 11 + if (isLoggedIn && pathname === '/') { 9 12 return NextResponse.redirect(new URL('/app', request.url)) 10 13 } 11 14 15 + if (isLoggedIn && ['/sign-in', '/sign-up'].includes(pathname)) { 16 + return NextResponse.redirect(new URL('/app', request.url)) 17 + } 18 + 19 + if (!isLoggedIn && pathname === '/landing') { 20 + return NextResponse.redirect(new URL('/', request.url)) 21 + } 22 + 23 + if (!isLoggedIn && pathname.startsWith('/app')) { 24 + return NextResponse.redirect(new URL('/sign-in', request.url)) 25 + } 26 + 12 27 return NextResponse.next() 13 28 } 14 29 15 30 export const config = { 16 - matcher: ['/sign-in', '/sign-up'], 31 + matcher: ['/', '/landing', '/app/:path*', '/sign-in', '/sign-up'], 17 32 }