🚑 (upload) Fix upload in embed
This commit is contained in:
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@typebot.io/js",
|
||||
"version": "0.1.27",
|
||||
"version": "0.1.28",
|
||||
"description": "Javascript library to display typebots on your website",
|
||||
"type": "module",
|
||||
"main": "dist/index.js",
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@typebot.io/nextjs",
|
||||
"version": "0.1.27",
|
||||
"version": "0.1.28",
|
||||
"description": "Convenient library to display typebots on your Next.js website",
|
||||
"main": "dist/index.js",
|
||||
"types": "dist/index.d.ts",
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@typebot.io/react",
|
||||
"version": "0.1.27",
|
||||
"version": "0.1.28",
|
||||
"description": "Convenient library to display typebots on your React app",
|
||||
"main": "dist/index.js",
|
||||
"types": "dist/index.d.ts",
|
||||
|
32
packages/lib/s3/deprecated/generatePresignedUrl.ts
Normal file
32
packages/lib/s3/deprecated/generatePresignedUrl.ts
Normal file
@ -0,0 +1,32 @@
|
||||
import { env } from '@typebot.io/env'
|
||||
import { Client } from 'minio'
|
||||
|
||||
type GeneratePresignedUrlProps = {
|
||||
filePath: string
|
||||
fileType?: string
|
||||
}
|
||||
|
||||
const tenMinutes = 10 * 60
|
||||
|
||||
export const generatePresignedUrl = async ({
|
||||
filePath,
|
||||
fileType,
|
||||
}: GeneratePresignedUrlProps): Promise<string> => {
|
||||
if (!env.S3_ENDPOINT || !env.S3_ACCESS_KEY || !env.S3_SECRET_KEY)
|
||||
throw new Error(
|
||||
'S3 not properly configured. Missing one of those variables: S3_ENDPOINT, S3_ACCESS_KEY, S3_SECRET_KEY'
|
||||
)
|
||||
|
||||
const minioClient = new Client({
|
||||
endPoint: env.S3_ENDPOINT,
|
||||
port: env.S3_PORT,
|
||||
useSSL: env.S3_SSL,
|
||||
accessKey: env.S3_ACCESS_KEY,
|
||||
secretKey: env.S3_SECRET_KEY,
|
||||
region: env.S3_REGION,
|
||||
})
|
||||
|
||||
return minioClient.presignedUrl('PUT', env.S3_BUCKET, filePath, tenMinutes, {
|
||||
'Content-Type': fileType,
|
||||
})
|
||||
}
|
Reference in New Issue
Block a user