mirror of
https://github.com/danswer-ai/danswer.git
synced 2025-10-10 05:05:34 +02:00
Fix missing sources when auth is on
This commit is contained in:
@@ -3,6 +3,7 @@ import { buildUrl } from "@/lib/utilsSS";
|
||||
import { NextRequest, NextResponse } from "next/server";
|
||||
import { cookies } from "next/headers";
|
||||
import { GOOGLE_DRIVE_AUTH_IS_ADMIN_COOKIE_NAME } from "@/lib/constants";
|
||||
import { processCookies } from "@/lib/userSS";
|
||||
|
||||
export const GET = async (request: NextRequest) => {
|
||||
// Wrapper around the FastAPI endpoint /connectors/google-drive/callback,
|
||||
@@ -12,10 +13,7 @@ export const GET = async (request: NextRequest) => {
|
||||
|
||||
const response = await fetch(url.toString(), {
|
||||
headers: {
|
||||
cookie: cookies()
|
||||
.getAll()
|
||||
.map((cookie) => `${cookie.name}=${cookie.value}`)
|
||||
.join("; "),
|
||||
cookie: processCookies(cookies()),
|
||||
},
|
||||
});
|
||||
|
||||
|
@@ -1,6 +1,6 @@
|
||||
import { SearchSection } from "@/components/search/SearchSection";
|
||||
import { Header } from "@/components/Header";
|
||||
import { getCurrentUserSS } from "@/lib/userSS";
|
||||
import { getCurrentUserSS, processCookies } from "@/lib/userSS";
|
||||
import { redirect } from "next/navigation";
|
||||
import { DISABLE_AUTH } from "@/lib/constants";
|
||||
import { HealthCheckBanner } from "@/components/health/healthcheck";
|
||||
@@ -15,6 +15,9 @@ export default async function Home() {
|
||||
DISABLE_AUTH ? (async () => null)() : getCurrentUserSS(),
|
||||
fetch(buildUrl("/manage/connector"), {
|
||||
next: { revalidate: 0 },
|
||||
headers: {
|
||||
cookie: processCookies(cookies()),
|
||||
},
|
||||
}),
|
||||
];
|
||||
|
||||
|
@@ -1,6 +1,7 @@
|
||||
import { cookies } from "next/headers";
|
||||
import { User } from "./types";
|
||||
import { buildUrl } from "./utilsSS";
|
||||
import { ReadonlyRequestCookies } from "next/dist/server/web/spec-extension/adapters/request-cookies";
|
||||
|
||||
export const getGoogleOAuthUrlSS = async (): Promise<string> => {
|
||||
const res = await fetch(buildUrl("/auth/google/authorize"));
|
||||
@@ -35,3 +36,10 @@ export const getCurrentUserSS = async (): Promise<User | null> => {
|
||||
return null;
|
||||
}
|
||||
};
|
||||
|
||||
export const processCookies = (cookies: ReadonlyRequestCookies): string => {
|
||||
return cookies
|
||||
.getAll()
|
||||
.map((cookie) => `${cookie.name}=${cookie.value}`)
|
||||
.join("; ");
|
||||
};
|
||||
|
Reference in New Issue
Block a user