🌐 feat: Add support to SubDirectory hosting (#9155)

* feat: Add support to SubDirectory hosting

* fix: address linting and failing test

* fix: browser context validation

---------

Co-authored-by: Danny Avila <danny@librechat.ai>
This commit is contained in:
José Pedro Silva 2025-08-27 07:00:18 +01:00 committed by GitHub
parent a820863e8b
commit 18d5a75cdc
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
14 changed files with 252 additions and 199 deletions

View file

@ -27,95 +27,101 @@ const AuthLayout = () => (
</AuthContextProvider>
);
export const router = createBrowserRouter([
{
path: 'share/:shareId',
element: <ShareRoute />,
errorElement: <RouteErrorBoundary />,
},
{
path: 'oauth',
errorElement: <RouteErrorBoundary />,
children: [
{
path: 'success',
element: <OAuthSuccess />,
},
{
path: 'error',
element: <OAuthError />,
},
],
},
{
path: '/',
element: <StartupLayout />,
errorElement: <RouteErrorBoundary />,
children: [
{
path: 'register',
element: <Registration />,
},
{
path: 'forgot-password',
element: <RequestPasswordReset />,
},
{
path: 'reset-password',
element: <ResetPassword />,
},
],
},
{
path: 'verify',
element: <VerifyEmail />,
errorElement: <RouteErrorBoundary />,
},
{
element: <AuthLayout />,
errorElement: <RouteErrorBoundary />,
children: [
{
path: '/',
element: <LoginLayout />,
children: [
{
path: 'login',
element: <Login />,
},
{
path: 'login/2fa',
element: <TwoFactorScreen />,
},
],
},
dashboardRoutes,
{
path: '/',
element: <Root />,
children: [
{
index: true,
element: <Navigate to="/c/new" replace={true} />,
},
{
path: 'c/:conversationId?',
element: <ChatRoute />,
},
{
path: 'search',
element: <Search />,
},
{
path: 'agents',
element: <AgentMarketplace />,
},
{
path: 'agents/:category',
element: <AgentMarketplace />,
},
],
},
],
},
]);
const baseEl = document.querySelector('base');
const baseHref = baseEl?.getAttribute('href') || '/';
export const router = createBrowserRouter(
[
{
path: 'share/:shareId',
element: <ShareRoute />,
errorElement: <RouteErrorBoundary />,
},
{
path: 'oauth',
errorElement: <RouteErrorBoundary />,
children: [
{
path: 'success',
element: <OAuthSuccess />,
},
{
path: 'error',
element: <OAuthError />,
},
],
},
{
path: '/',
element: <StartupLayout />,
errorElement: <RouteErrorBoundary />,
children: [
{
path: 'register',
element: <Registration />,
},
{
path: 'forgot-password',
element: <RequestPasswordReset />,
},
{
path: 'reset-password',
element: <ResetPassword />,
},
],
},
{
path: 'verify',
element: <VerifyEmail />,
errorElement: <RouteErrorBoundary />,
},
{
element: <AuthLayout />,
errorElement: <RouteErrorBoundary />,
children: [
{
path: '/',
element: <LoginLayout />,
children: [
{
path: 'login',
element: <Login />,
},
{
path: 'login/2fa',
element: <TwoFactorScreen />,
},
],
},
dashboardRoutes,
{
path: '/',
element: <Root />,
children: [
{
index: true,
element: <Navigate to="/c/new" replace={true} />,
},
{
path: 'c/:conversationId?',
element: <ChatRoute />,
},
{
path: 'search',
element: <Search />,
},
{
path: 'agents',
element: <AgentMarketplace />,
},
{
path: 'agents/:category',
element: <AgentMarketplace />,
},
],
},
],
},
],
{ basename: baseHref },
);