Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions apps/web/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ COPY packages/indexing/package.json ./packages/indexing/
COPY packages/search/package.json ./packages/search/
COPY packages/orchestration/package.json ./packages/orchestration/
COPY packages/editing/package.json ./packages/editing/
COPY packages/google-drive/package.json ./packages/google-drive/
COPY packages/document-conversion-engine/package.json ./packages/document-conversion-engine/
COPY packages/collab/package.json ./packages/collab/
COPY packages/engine/package.json ./packages/engine/
COPY packages/schema-generator/package.json ./packages/schema-generator/
Expand Down
2 changes: 2 additions & 0 deletions apps/web/Dockerfile.prebuilt
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ COPY packages/indexing/package.json ./packages/indexing/
COPY packages/search/package.json ./packages/search/
COPY packages/orchestration/package.json ./packages/orchestration/
COPY packages/editing/package.json ./packages/editing/
COPY packages/google-drive/package.json ./packages/google-drive/
COPY packages/document-conversion-engine/package.json ./packages/document-conversion-engine/
COPY packages/collab/package.json ./packages/collab/
COPY packages/engine/package.json ./packages/engine/
COPY packages/schema-generator/package.json ./packages/schema-generator/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,13 @@ import { users } from "~/server/db/schema";
import { isManagementRole, requireWorkspaceContext } from "~/lib/require-workspace-context";
import {
GOOGLE_DRIVE_SCOPES,
OAUTH_STATE_COOKIE,
getGoogleOAuthApp,
getOAuthRedirectUrl,
isDriveLinkingEnabled,
} from "~/server/services/google-drive/config";
import { upsertGoogleConnection } from "~/server/services/google-drive/connections";

import { OAUTH_STATE_COOKIE } from "../start/route";

function redirectToWorkspace(request: Request, flag: string): NextResponse {
const response = NextResponse.redirect(
new URL(`/employer/documents?googleDrive=${flag}`, request.url)
Expand Down
3 changes: 1 addition & 2 deletions apps/web/src/app/api/connectors/google/oauth/start/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,12 @@ import { buildAuthorizationUrl } from "@launchstack/google-drive";
import { isManagementRole, requireWorkspaceContext } from "~/lib/require-workspace-context";
import {
GOOGLE_DRIVE_SCOPES,
OAUTH_STATE_COOKIE,
getGoogleOAuthApp,
getOAuthRedirectUrl,
isDriveLinkingEnabled,
} from "~/server/services/google-drive/config";

export const OAUTH_STATE_COOKIE = "gdrive_oauth_state";

export async function GET(request: Request) {
if (!isDriveLinkingEnabled()) {
return NextResponse.json({ error: "feature_disabled" }, { status: 404 });
Expand Down
7 changes: 7 additions & 0 deletions apps/web/src/server/services/google-drive/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,13 @@ import { env } from "~/env";

export const GOOGLE_DRIVE_PROVIDER = "google-drive";

/**
* CSRF nonce cookie for the OAuth flow. Lives here, not in the route file:
* Next.js route modules may only export handler fields, and `next build`
* enforces that where plain typechecking does not.
*/
export const OAUTH_STATE_COOKIE = "gdrive_oauth_state";

/**
* drive.file only: the app can touch files it created, nothing else in the
* user's Drive. openid+email identify which Google account holds the files.
Expand Down
2 changes: 2 additions & 0 deletions apps/worker/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ COPY packages/indexing/package.json ./packages/indexing/
COPY packages/search/package.json ./packages/search/
COPY packages/orchestration/package.json ./packages/orchestration/
COPY packages/editing/package.json ./packages/editing/
COPY packages/google-drive/package.json ./packages/google-drive/
COPY packages/document-conversion-engine/package.json ./packages/document-conversion-engine/
COPY packages/collab/package.json ./packages/collab/
COPY packages/engine/package.json ./packages/engine/
COPY packages/schema-generator/package.json ./packages/schema-generator/
Expand Down
Loading