Update market, account, and onion operations
Capture the current CyberLux UI, commerce, messaging, and Tor ops updates so local main can be pushed to the remote. Made-with: Cursor
This commit is contained in:
34
lib/cyberluxCrossNav.ts
Normal file
34
lib/cyberluxCrossNav.ts
Normal file
@@ -0,0 +1,34 @@
|
||||
/**
|
||||
* Prefixes for routes that must NOT get a dedicated-root rewrite (user jumped to
|
||||
* another vertical, API, or global page). Kept in sync with app routes and onion layout.
|
||||
*/
|
||||
import { DEDICATED_ROOT } from "@/lib/onionRoutes.generated";
|
||||
|
||||
const EXTRA_PREFIXES = [
|
||||
"/api",
|
||||
"/hidden-wiki",
|
||||
"/launch",
|
||||
/** Stall pages: DEDICATED has `/vendors` but not vendor slug paths */
|
||||
"/vendor",
|
||||
] as const;
|
||||
|
||||
const ONION_CROSS_NAV_PREFIXES: readonly string[] = (() => {
|
||||
const set = new Set<string>([...Object.values(DEDICATED_ROOT), ...EXTRA_PREFIXES] as string[]);
|
||||
return Object.freeze(Array.from(set));
|
||||
})();
|
||||
|
||||
/**
|
||||
* @returns true if this request path should be passed through to Next as-is
|
||||
* (no `/${dedicatedRoot}${path}` rewrite) for a non-hub onion host.
|
||||
*/
|
||||
export function isOnionCrossNavPath(pathname: string): boolean {
|
||||
if (pathname === "/w" || pathname.startsWith("/w/")) {
|
||||
return true;
|
||||
}
|
||||
for (const prefix of ONION_CROSS_NAV_PREFIXES) {
|
||||
if (pathname === prefix || pathname.startsWith(`${prefix}/`)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
Reference in New Issue
Block a user