Skip to content

Commit c1e1225

Browse files
fix
1 parent 4f04e7f commit c1e1225

6 files changed

Lines changed: 8 additions & 44 deletions

File tree

packages/web/src/actions.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@ import { AGENTIC_SEARCH_TUTORIAL_DISMISSED_COOKIE_NAME, MOBILE_UNSUPPORTED_SPLAS
3131
import { orgDomainSchema, orgNameSchema, repositoryQuerySchema } from "./lib/schemas";
3232
import { ApiKeyPayload, TenancyMode } from "./lib/types";
3333
import { withAuthV2, withOptionalAuthV2 } from "./withAuthV2";
34-
import { getBaseUrl } from "./lib/utils.server";
3534
import { getBrowsePath } from "./app/[domain]/browse/hooks/utils";
3635

3736
const logger = createLogger('web-actions');
@@ -478,8 +477,7 @@ export const getRepos = async ({
478477
take,
479478
});
480479

481-
const headersList = await headers();
482-
const baseUrl = getBaseUrl(headersList);
480+
const baseUrl = env.AUTH_URL;
483481

484482
return repos.map((repo) => repositoryQuerySchema.parse({
485483
codeHostType: repo.external_codeHostType,

packages/web/src/app/api/(server)/chat/blocking/route.ts

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,11 @@ import { convertLLMOutputToPortableMarkdown, getAnswerPartFromAssistantMessage,
55
import { ErrorCode } from "@/lib/errorCodes";
66
import { requestBodySchemaValidationError, ServiceError, ServiceErrorException, serviceErrorResponse } from "@/lib/serviceError";
77
import { isServiceError } from "@/lib/utils";
8-
import { getBaseUrl } from "@/lib/utils.server";
98
import { withOptionalAuthV2 } from "@/withAuthV2";
109
import { ChatVisibility, Prisma } from "@sourcebot/db";
11-
import { createLogger } from "@sourcebot/shared";
10+
import { createLogger, env } from "@sourcebot/shared";
1211
import { randomUUID } from "crypto";
1312
import { StatusCodes } from "http-status-codes";
14-
import { headers } from "next/headers";
1513
import { NextRequest, NextResponse } from "next/server";
1614
import { z } from "zod";
1715
import { createMessageStream } from "../route";
@@ -188,8 +186,7 @@ export const POST = apiHandler(async (request: NextRequest) => {
188186
const portableAnswer = convertLLMOutputToPortableMarkdown(answerText);
189187

190188
// Build the chat URL
191-
const headersList = await headers();
192-
const baseUrl = getBaseUrl(headersList);
189+
const baseUrl = env.AUTH_URL;
193190
const chatUrl = `${baseUrl}/${org.domain}/chat/${chat.id}`;
194191

195192
logger.debug(`Completed blocking agent for chat ${chat.id}`, {

packages/web/src/app/api/(server)/repos/listReposApi.ts

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,14 @@ import { sew } from "@/actions";
22
import { repositoryQuerySchema } from "@/lib/schemas";
33
import { ListReposQueryParams } from "@/lib/types";
44
import { withOptionalAuthV2 } from "@/withAuthV2";
5-
import { headers } from "next/headers";
6-
import { getBaseUrl } from "@/lib/utils.server";
75
import { getBrowsePath } from "@/app/[domain]/browse/hooks/utils";
6+
import { env } from "@sourcebot/shared";
87

98
export const listRepos = async ({ query, page, perPage, sort, direction }: ListReposQueryParams) => sew(() =>
109
withOptionalAuthV2(async ({ org, prisma }) => {
1110
const skip = (page - 1) * perPage;
1211
const orderByField = sort === 'pushed' ? 'pushedAt' : 'name';
13-
14-
const headersList = await headers();
15-
const baseUrl = getBaseUrl(headersList);
12+
const baseUrl = env.AUTH_URL;
1613

1714
const [repos, totalCount] = await Promise.all([
1815
prisma.repo.findMany({

packages/web/src/app/components/organizationAccessSettings.tsx

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,10 @@
11
import { createInviteLink } from "@/lib/utils"
2-
import { getBaseUrl } from "@/lib/utils.server"
32
import { AnonymousAccessToggle } from "./anonymousAccessToggle"
43
import { OrganizationAccessSettingsWrapper } from "./organizationAccessSettingsWrapper"
54
import { getOrgFromDomain } from "@/data/org"
65
import { getOrgMetadata } from "@/lib/utils"
7-
import { headers } from "next/headers"
86
import { SINGLE_TENANT_ORG_DOMAIN } from "@/lib/constants"
9-
import { hasEntitlement } from "@sourcebot/shared"
10-
import { env } from "@sourcebot/shared"
7+
import { hasEntitlement, env } from "@sourcebot/shared"
118

129
export async function OrganizationAccessSettings() {
1310
const org = await getOrgFromDomain(SINGLE_TENANT_ORG_DOMAIN);
@@ -18,8 +15,7 @@ export async function OrganizationAccessSettings() {
1815
const metadata = getOrgMetadata(org);
1916
const anonymousAccessEnabled = metadata?.anonymousAccessEnabled ?? false;
2017

21-
const headersList = await headers();
22-
const baseUrl = getBaseUrl(headersList);
18+
const baseUrl = env.AUTH_URL;
2319
const inviteLink = createInviteLink(baseUrl, org.inviteLinkId)
2420

2521
const hasAnonymousAccessEntitlement = hasEntitlement("anonymous-access");

packages/web/src/features/search/zoektSearcher.ts

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,6 @@ import { RepositoryInfo, SearchResponse, SearchResultFile, SearchStats, SourceRa
2020
import { captureEvent } from "@/lib/posthog";
2121
import { getBrowsePath } from "@/app/[domain]/browse/hooks/utils";
2222
import { SINGLE_TENANT_ORG_DOMAIN } from "@/lib/constants";
23-
import { headers } from "next/headers";
24-
import { getBaseUrl } from "@/lib/utils.server";
2523

2624
const logger = createLogger("zoekt-searcher");
2725

@@ -383,9 +381,6 @@ const transformZoektSearchResponse = async (response: ZoektGrpcSearchResponse, r
383381
files: SearchResultFile[],
384382
repositoryInfo: RepositoryInfo[],
385383
}> => {
386-
const headersList = await headers();
387-
const baseUrl = getBaseUrl(headersList);
388-
389384
const files = response.files.map((file) => {
390385
const fileNameChunks = file.chunk_matches.filter((chunk) => chunk.file_name);
391386
const repoId = getRepoIdForFile(file);
@@ -431,7 +426,7 @@ const transformZoektSearchResponse = async (response: ZoektGrpcSearchResponse, r
431426
repository: repo.name,
432427
repositoryId: repo.id,
433428
language: file.language,
434-
webUrl: `${baseUrl}${getBrowsePath({
429+
webUrl: `${env.AUTH_URL}${getBrowsePath({
435430
repoName: repo.name,
436431
path: fileName,
437432
pathType: 'blob',

packages/web/src/lib/utils.server.ts

Lines changed: 0 additions & 19 deletions
This file was deleted.

0 commit comments

Comments
 (0)