diff --git a/apps/nomadweb/frontend/src/app/profile/page.tsx b/apps/nomadweb/frontend/src/app/profile/page.tsx
index 82f9fc0..d6f07f4 100644
--- a/apps/nomadweb/frontend/src/app/profile/page.tsx
+++ b/apps/nomadweb/frontend/src/app/profile/page.tsx
@@ -95,7 +95,7 @@ export default function ProfilePage() {
useEffect(() => {
if (!token) {
- router.push("/community/login?next=/profile");
+ router.push("/community/login?next=/community/profile");
return;
}
setLoading(true);
diff --git a/apps/nomadweb/frontend/src/components/ChatClient.tsx b/apps/nomadweb/frontend/src/components/ChatClient.tsx
index ebc3b63..0642c6e 100644
--- a/apps/nomadweb/frontend/src/components/ChatClient.tsx
+++ b/apps/nomadweb/frontend/src/components/ChatClient.tsx
@@ -47,7 +47,7 @@ export default function ChatClient() {
-
+
{t.nav.login}
diff --git a/apps/nomadweb/frontend/src/components/ContentSubmitClient.tsx b/apps/nomadweb/frontend/src/components/ContentSubmitClient.tsx
index 972a151..1995568 100644
--- a/apps/nomadweb/frontend/src/components/ContentSubmitClient.tsx
+++ b/apps/nomadweb/frontend/src/components/ContentSubmitClient.tsx
@@ -54,7 +54,7 @@ export default function ContentSubmitClient() {
const submit = async () => {
if (!token) {
- router.push("/community/login?next=/submit");
+ router.push("/community/login?next=/community/submit");
return;
}
if (!title.trim() || title.trim().length < 4) {
@@ -149,7 +149,7 @@ export default function ContentSubmitClient() {
{!token && (
- {t.nav.login} · {t.gigs.loginFirst}
+ {t.nav.login} · {t.gigs.loginFirst}
)}
diff --git a/apps/nomadweb/frontend/src/components/DatingClient.tsx b/apps/nomadweb/frontend/src/components/DatingClient.tsx
index 2f81d86..ac15fa8 100644
--- a/apps/nomadweb/frontend/src/components/DatingClient.tsx
+++ b/apps/nomadweb/frontend/src/components/DatingClient.tsx
@@ -95,7 +95,7 @@ export default function DatingClient() {
const quickJoin = async () => {
if (!token) {
- router.push("/community/login?next=/dating");
+ router.push("/community/login?next=/community/dating");
return;
}
setLoading(true);
@@ -206,7 +206,7 @@ export default function DatingClient() {
{t.dating.loginTitle}
-
+
{t.nav.login}
diff --git a/apps/nomadweb/frontend/src/components/DigitalLessonClient.tsx b/apps/nomadweb/frontend/src/components/DigitalLessonClient.tsx
index 6dcea52..970f100 100644
--- a/apps/nomadweb/frontend/src/components/DigitalLessonClient.tsx
+++ b/apps/nomadweb/frontend/src/components/DigitalLessonClient.tsx
@@ -128,7 +128,7 @@ export default function DigitalLessonClient({
{t.digital.lockedDesc}
{!token && (
-
+
{t.nav.login}
)}
diff --git a/apps/nomadweb/frontend/src/components/DiscussionDetailClient.tsx b/apps/nomadweb/frontend/src/components/DiscussionDetailClient.tsx
index d806a82..378ef12 100644
--- a/apps/nomadweb/frontend/src/components/DiscussionDetailClient.tsx
+++ b/apps/nomadweb/frontend/src/components/DiscussionDetailClient.tsx
@@ -214,7 +214,7 @@ export default function DiscussionDetailClient({
{t.community.replyHint}
-
+
{t.nav.login}
diff --git a/apps/nomadweb/frontend/src/components/FavoriteButton.tsx b/apps/nomadweb/frontend/src/components/FavoriteButton.tsx
index 2399561..432bf14 100644
--- a/apps/nomadweb/frontend/src/components/FavoriteButton.tsx
+++ b/apps/nomadweb/frontend/src/components/FavoriteButton.tsx
@@ -17,7 +17,7 @@ export default function FavoriteButton({ slug }: { slug: string }) {
if (!user) {
return (
diff --git a/apps/nomadweb/frontend/src/components/Footer.tsx b/apps/nomadweb/frontend/src/components/Footer.tsx
index e9022bb..1ca3c28 100644
--- a/apps/nomadweb/frontend/src/components/Footer.tsx
+++ b/apps/nomadweb/frontend/src/components/Footer.tsx
@@ -68,7 +68,7 @@ export default function Footer() {
{t.footer.account}
-
{t.footer.login}
+
{t.footer.login}
{t.footer.help}
{t.footer.about}
{t.footer.privacy}
diff --git a/apps/nomadweb/frontend/src/components/GigPostClient.tsx b/apps/nomadweb/frontend/src/components/GigPostClient.tsx
index ce7f0d2..2053f70 100644
--- a/apps/nomadweb/frontend/src/components/GigPostClient.tsx
+++ b/apps/nomadweb/frontend/src/components/GigPostClient.tsx
@@ -59,7 +59,7 @@ export default function GigPostClient() {
{t.gigs.postTitle}
{t.gigs.loginFirst}
-
{t.nav.login}
+
{t.nav.login}
@@ -68,7 +68,7 @@ export default function GigPostClient() {
const submit = async () => {
if (!token) {
- router.push("/community/login?next=/gigs/post");
+ router.push("/community/login?next=/community/gigs/post");
return;
}
if (!title.trim() || !description.trim()) {
diff --git a/apps/nomadweb/frontend/src/components/GigsClient.tsx b/apps/nomadweb/frontend/src/components/GigsClient.tsx
index b1a548b..e0c4bf4 100644
--- a/apps/nomadweb/frontend/src/components/GigsClient.tsx
+++ b/apps/nomadweb/frontend/src/components/GigsClient.tsx
@@ -50,7 +50,7 @@ export default function GigsClient({ gigs }: { gigs: GigItem[] }) {
const apply = async (id: string) => {
if (!token) {
- router.push("/community/login?next=/gigs");
+ router.push("/community/login?next=/community/gigs");
return;
}
const message = msg[id]?.trim();
@@ -133,7 +133,7 @@ export default function GigsClient({ gigs }: { gigs: GigItem[] }) {
{!token && (
- {t.nav.login} · {t.gigs.loginFirst}
+ {t.nav.login} · {t.gigs.loginFirst}
)}
{gigs.map((g) => {
@@ -155,7 +155,7 @@ export default function GigsClient({ gigs }: { gigs: GigItem[] }) {
{applied[g.id] ? (
{t.gigs.applied}
) : !token ? (
-
+
{t.gigs.apply}
) : (
diff --git a/apps/nomadweb/frontend/src/components/JoinClient.tsx b/apps/nomadweb/frontend/src/components/JoinClient.tsx
index aa1374e..a9d5ea2 100644
--- a/apps/nomadweb/frontend/src/components/JoinClient.tsx
+++ b/apps/nomadweb/frontend/src/components/JoinClient.tsx
@@ -62,7 +62,7 @@ export default function JoinClient() {
const submit = async () => {
if (!token) {
- router.push("/community/login?next=/join");
+ router.push("/community/login?next=/community/join");
return;
}
setLoading(true);
@@ -85,7 +85,7 @@ export default function JoinClient() {
const pay = async () => {
if (!token) {
- router.push("/community/login?next=/join");
+ router.push("/community/login?next=/community/join");
return;
}
if (vip) {
@@ -151,7 +151,7 @@ export default function JoinClient() {
{vip ? t.join.goDating : t.join.payBtn}
{!vip &&
{t.join.payMethods}
}
- {!user &&
{t.nav.login}}
+ {!user &&
{t.nav.login}}
diff --git a/apps/nomadweb/frontend/src/components/JoinPaidClient.tsx b/apps/nomadweb/frontend/src/components/JoinPaidClient.tsx
index 8e621d0..b4b08be 100644
--- a/apps/nomadweb/frontend/src/components/JoinPaidClient.tsx
+++ b/apps/nomadweb/frontend/src/components/JoinPaidClient.tsx
@@ -63,7 +63,7 @@ export default function JoinPaidClient() {
{status === "need-login" && (
<>
{t.join.paidFail}
-
{t.nav.login}
+
{t.nav.login}
>
)}
{status === "ok" && (
diff --git a/apps/nomadweb/frontend/src/components/MeetupLiveClient.tsx b/apps/nomadweb/frontend/src/components/MeetupLiveClient.tsx
index 801c74f..63957f3 100644
--- a/apps/nomadweb/frontend/src/components/MeetupLiveClient.tsx
+++ b/apps/nomadweb/frontend/src/components/MeetupLiveClient.tsx
@@ -146,7 +146,7 @@ export default function MeetupLiveClient({
{t.live.back}
) : (
-
+
{t.nav.login}
)}
diff --git a/apps/nomadweb/frontend/src/components/MeetupsClient.tsx b/apps/nomadweb/frontend/src/components/MeetupsClient.tsx
index 53af786..5e782a4 100644
--- a/apps/nomadweb/frontend/src/components/MeetupsClient.tsx
+++ b/apps/nomadweb/frontend/src/components/MeetupsClient.tsx
@@ -172,7 +172,7 @@ export default function MeetupsClient({ meetups }: Props) {
{t.meetups.subtitle}
{!token && (
- {t.nav.login} · {t.meetups.loginHint}
+ {t.nav.login} · {t.meetups.loginHint}
)}
diff --git a/apps/nomadweb/frontend/src/components/MeetupsHostClient.tsx b/apps/nomadweb/frontend/src/components/MeetupsHostClient.tsx
index 05fd4bf..400f387 100644
--- a/apps/nomadweb/frontend/src/components/MeetupsHostClient.tsx
+++ b/apps/nomadweb/frontend/src/components/MeetupsHostClient.tsx
@@ -96,7 +96,7 @@ export default function MeetupsHostClient() {
diff --git a/apps/nomadweb/frontend/src/components/Navbar.tsx b/apps/nomadweb/frontend/src/components/Navbar.tsx
index 07aa068..5bb483b 100644
--- a/apps/nomadweb/frontend/src/components/Navbar.tsx
+++ b/apps/nomadweb/frontend/src/components/Navbar.tsx
@@ -218,7 +218,7 @@ export default function Navbar() {
{!user && (
@@ -247,7 +247,7 @@ export default function Navbar() {
) : (
) : (
) : (
{t.nav.login}
diff --git a/apps/nomadweb/frontend/src/components/NotificationSettingsClient.tsx b/apps/nomadweb/frontend/src/components/NotificationSettingsClient.tsx
index ff117d9..fa5dfcf 100644
--- a/apps/nomadweb/frontend/src/components/NotificationSettingsClient.tsx
+++ b/apps/nomadweb/frontend/src/components/NotificationSettingsClient.tsx
@@ -65,7 +65,7 @@ export default function NotificationSettingsClient() {
{t.notifSettings.title}
{t.notifSettings.loginDesc}
-
+
{t.nav.login}
diff --git a/apps/nomadweb/frontend/src/components/NotificationsClient.tsx b/apps/nomadweb/frontend/src/components/NotificationsClient.tsx
index 55bcd04..1faff27 100644
--- a/apps/nomadweb/frontend/src/components/NotificationsClient.tsx
+++ b/apps/nomadweb/frontend/src/components/NotificationsClient.tsx
@@ -50,7 +50,7 @@ export default function NotificationsClient() {
{t.notifications.title}
{t.notifications.loginDesc}
-
+
{t.nav.login}
diff --git a/apps/nomadweb/frontend/src/components/ebook/AdminConsole.tsx b/apps/nomadweb/frontend/src/components/ebook/AdminConsole.tsx
index 95a0f58..6613b1d 100644
--- a/apps/nomadweb/frontend/src/components/ebook/AdminConsole.tsx
+++ b/apps/nomadweb/frontend/src/components/ebook/AdminConsole.tsx
@@ -80,7 +80,7 @@ export function AdminConsole() {
async function login() {
setLoading(true);
try {
- const res = await fetch('/api/admin/login', { method: 'POST', headers: { Authorization: auth } });
+ const res = await fetch('/api/admin/community/login', { method: 'POST', headers: { Authorization: auth } });
const body = (await res.json()) as { ok?: boolean; error?: string };
if (!res.ok || !body.ok) throw new Error(body.error || t('admin.loginFailed'));
setAuthorized(true);
diff --git a/apps/nomadweb/frontend/src/lib/api.ts b/apps/nomadweb/frontend/src/lib/api.ts
index dd13269..d18bf49 100644
--- a/apps/nomadweb/frontend/src/lib/api.ts
+++ b/apps/nomadweb/frontend/src/lib/api.ts
@@ -133,7 +133,7 @@ export const api = {
getChartRadar: () => fetchWithFallback
("/charts/radar", { labels: [], datasets: [] }),
// Auth
login: (email: string, password: string) =>
- fetchAPI("/auth/login", { method: "POST", body: JSON.stringify({ email, password }) }),
+ fetchAPI("/auth/community/login", { method: "POST", body: JSON.stringify({ email, password }) }),
register: (email: string, password: string, name: string) =>
fetchAPI("/auth/register", { method: "POST", body: JSON.stringify({ email, password, name }) }),
demoLogin: () => fetchAPI("/auth/demo"),
diff --git a/apps/nomadweb/frontend/src/lib/authNext.ts b/apps/nomadweb/frontend/src/lib/authNext.ts
index bfb8e9d..30ac86c 100644
--- a/apps/nomadweb/frontend/src/lib/authNext.ts
+++ b/apps/nomadweb/frontend/src/lib/authNext.ts
@@ -64,7 +64,7 @@ export interface AuthNextMeta {
/** Post-login redirect when opening login from site chrome */
export function loginNextFrom(pathname: string | null): string {
- if (!pathname || pathname === "/" || pathname === "/login") return "/profile";
+ if (!pathname || pathname === "/" || pathname === "/community/login") return "/profile";
return pathname;
}
diff --git a/middleware.ts b/middleware.ts
new file mode 100644
index 0000000..bd4c20e
--- /dev/null
+++ b/middleware.ts
@@ -0,0 +1,85 @@
+import { NextResponse } from "next/server";
+import type { NextRequest } from "next/server";
+
+/**
+ * Compat redirects for vertical apps mounted under path prefixes.
+ * Old standalone URLs → portal mounts.
+ */
+const COMMUNITY_ROOTS = new Set([
+ "about",
+ "ai",
+ "blog",
+ "careers",
+ "changelog",
+ "chat",
+ "compare",
+ "contact",
+ "cookies",
+ "dating",
+ "destinations",
+ "digital",
+ "feedback",
+ "gigs",
+ "guidelines",
+ "help",
+ "join",
+ "login",
+ "map",
+ "meetups",
+ "members",
+ "next-stop",
+ "notifications",
+ "plan",
+ "press",
+ "pricing",
+ "privacy",
+ "profile",
+ "report",
+ "safety",
+ "services",
+ "settings",
+ "submit",
+ "support",
+ "terms",
+ "tools",
+ "videos",
+]);
+
+export function middleware(request: NextRequest) {
+ const { pathname, search } = request.nextUrl;
+
+ // /read and /read/* already handled by app/read routes.
+ // Extra: bare community routes that used to live at site root.
+ const seg = pathname.split("/").filter(Boolean)[0];
+ if (
+ seg &&
+ COMMUNITY_ROOTS.has(seg) &&
+ !pathname.startsWith("/community/") &&
+ pathname !== "/community"
+ ) {
+ const url = request.nextUrl.clone();
+ url.pathname = `/community${pathname}`;
+ return NextResponse.redirect(url, 308);
+ }
+
+ // Fix login?next=/foo → next=/community/foo when missing prefix
+ if (pathname === "/community/login" || pathname === "/login") {
+ const next = request.nextUrl.searchParams.get("next");
+ if (next && next.startsWith("/") && !next.startsWith("/community") && !next.startsWith("/book") && !next.startsWith("/nav") && !next.startsWith("/http")) {
+ const url = request.nextUrl.clone();
+ if (pathname === "/login") {
+ url.pathname = "/community/login";
+ }
+ url.searchParams.set("next", `/community${next === "/" ? "" : next}`);
+ return NextResponse.redirect(url, 308);
+ }
+ }
+
+ return NextResponse.next();
+}
+
+export const config = {
+ matcher: [
+ "/((?!_next/static|_next/image|favicon.ico|icons/|api/|.*\\..*).*)",
+ ],
+};
diff --git a/scripts/fix-community-login-next.py b/scripts/fix-community-login-next.py
new file mode 100644
index 0000000..2b9b8bf
--- /dev/null
+++ b/scripts/fix-community-login-next.py
@@ -0,0 +1,44 @@
+#!/usr/bin/env python3
+from __future__ import annotations
+
+import pathlib
+import re
+
+ROOT = pathlib.Path(__file__).resolve().parents[1] / "apps/nomadweb/frontend/src"
+
+
+def fix(text: str) -> str:
+ t = text
+ t = re.sub(r"(? str:
+ path = m.group(1)
+ if path.startswith(("/community", "/book", "/nav", "http")):
+ return m.group(0)
+ if not path.startswith("/"):
+ path = "/" + path
+ return f"next=/community{path}"
+
+ t = re.sub(r"next=(/[^\s\"'?]+)", repl_next, t)
+ t = t.replace("/community/community/", "/community/")
+ return t
+
+
+def main() -> None:
+ n = 0
+ for p in ROOT.rglob("*"):
+ if p.suffix not in {".ts", ".tsx"}:
+ continue
+ raw = p.read_text(encoding="utf-8")
+ out = fix(raw)
+ if out != raw:
+ p.write_text(out, encoding="utf-8")
+ n += 1
+ print("fixed", p.relative_to(ROOT))
+ print("files", n)
+
+
+if __name__ == "__main__":
+ main()