mirror of
https://github.com/danny-avila/LibreChat.git
synced 2026-02-26 20:34:10 +01:00
🌐 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:
parent
a820863e8b
commit
18d5a75cdc
14 changed files with 252 additions and 199 deletions
|
|
@ -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 },
|
||||
);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue