File tree Expand file tree Collapse file tree 6 files changed +22
-8
lines changed
Expand file tree Collapse file tree 6 files changed +22
-8
lines changed Original file line number Diff line number Diff line change 11# syntax=docker.io/docker/dockerfile:1
22
3- FROM node:20 -alpine AS base
3+ FROM node:22 -alpine AS base
44RUN corepack enable
55
66FROM base AS builder
Original file line number Diff line number Diff line change @@ -8,7 +8,7 @@ import { getCurrentUser } from "@cap/database/auth/session";
88import { buildEnv, serverEnv } from "@cap/env";
99import { S3_BUCKET_URL } from "@cap/utils";
1010import * as TooltipPrimitive from "@radix-ui/react-tooltip";
11- import crypto from "crypto";
11+ import crypto from "node: crypto";
1212import type { Metadata } from "next";
1313import { PropsWithChildren } from "react";
1414import { AuthProvider } from "./AuthProvider";
Original file line number Diff line number Diff line change 22// It is not suitable (a.k.a DEADLY) for serverless environments where the server will be restarted on each request.
33
44import { serverEnv } from "@cap/env";
5- import { createS3Client } from "./utils/s3";
65import {
76 BucketAlreadyOwnedByYou,
87 CreateBucketCommand,
98 PutBucketPolicyCommand,
9+ S3Client,
1010} from "@aws-sdk/client-s3";
1111
1212export async function register() {
@@ -61,7 +61,15 @@ export async function register() {
6161}
6262
6363async function createS3Bucket() {
64- const [s3Client] = await createS3Client();
64+ const s3Client = new S3Client({
65+ endpoint: serverEnv().CAP_AWS_ENDPOINT,
66+ region: serverEnv().CAP_AWS_REGION,
67+ credentials: {
68+ accessKeyId: serverEnv().CAP_AWS_ACCESS_KEY ?? "",
69+ secretAccessKey: serverEnv().CAP_AWS_SECRET_KEY ?? "",
70+ },
71+ forcePathStyle: serverEnv().S3_PATH_STYLE,
72+ });
6573
6674 await s3Client
6775 .send(new CreateBucketCommand({ Bucket: serverEnv().CAP_AWS_BUCKET }))
Original file line number Diff line number Diff line change 110110 "tailwindcss": "^3",
111111 "typescript": "^5.8.3"
112112 },
113+ "browser": {
114+ "crypto": false
115+ },
113116 "engines": {
114117 "node": "20"
115118 }
116- }
119+ }
Original file line number Diff line number Diff line change 99import type { s3Buckets } from "@cap/database/schema";
1010import type { InferSelectModel } from "drizzle-orm";
1111import { decrypt } from "@cap/database/crypto";
12- import { buildEnv, serverEnv } from "@cap/env";
12+ import { serverEnv } from "@cap/env";
1313import * as S3Presigner from "@aws-sdk/s3-request-presigner";
1414import * as CloudFrontPresigner from "@aws-sdk/cloudfront-signer";
1515import { S3_BUCKET_URL } from "@cap/utils";
Original file line number Diff line number Diff line change 11import { serverEnv } from "@cap/env";
2- import { timingSafeEqual } from "crypto";
2+ import { timingSafeEqual } from "node: crypto";
33
44const ALGORITHM = { name: "AES-GCM", length: 256 };
55const IV_LENGTH = 12;
@@ -162,7 +162,10 @@ export async function hashPassword(password: string): Promise<string> {
162162 return result.toString("base64");
163163}
164164
165- export async function verifyPassword(stored: string, password: string): Promise<boolean> {
165+ export async function verifyPassword(
166+ stored: string,
167+ password: string
168+ ): Promise<boolean> {
166169 if (!stored || !password) return false;
167170
168171 const data = Buffer.from(stored, "base64");
You can’t perform that action at this time.
0 commit comments