🚑 Move cache control header into the post policy
This commit is contained in:
@@ -31,7 +31,6 @@ export const UploadButton = ({
|
|||||||
Object.entries(data.formData).forEach(([key, value]) => {
|
Object.entries(data.formData).forEach(([key, value]) => {
|
||||||
formData.append(key, value)
|
formData.append(key, value)
|
||||||
})
|
})
|
||||||
formData.append('Cache-Control', 'max-age=86400')
|
|
||||||
formData.append('file', file)
|
formData.append('file', file)
|
||||||
const upload = await fetch(data.presignedUrl, {
|
const upload = await fetch(data.presignedUrl, {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
|
|||||||
@@ -40,7 +40,6 @@ export const uploadFiles = async ({
|
|||||||
Object.entries(data.formData).forEach(([key, value]) => {
|
Object.entries(data.formData).forEach(([key, value]) => {
|
||||||
formData.append(key, value)
|
formData.append(key, value)
|
||||||
})
|
})
|
||||||
formData.append('Cache-Control', 'max-age=86400')
|
|
||||||
formData.append('file', file)
|
formData.append('file', file)
|
||||||
const upload = await fetch(data.presignedUrl, {
|
const upload = await fetch(data.presignedUrl, {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@typebot.io/js",
|
"name": "@typebot.io/js",
|
||||||
"version": "0.2.12",
|
"version": "0.2.13",
|
||||||
"description": "Javascript library to display typebots on your website",
|
"description": "Javascript library to display typebots on your website",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"main": "dist/index.js",
|
"main": "dist/index.js",
|
||||||
|
|||||||
@@ -43,7 +43,6 @@ export const uploadFiles = async ({
|
|||||||
Object.entries(data.formData).forEach(([key, value]) => {
|
Object.entries(data.formData).forEach(([key, value]) => {
|
||||||
formData.append(key, value)
|
formData.append(key, value)
|
||||||
})
|
})
|
||||||
formData.append('Cache-Control', 'max-age=86400')
|
|
||||||
formData.append('file', file)
|
formData.append('file', file)
|
||||||
const upload = await fetch(data.presignedUrl, {
|
const upload = await fetch(data.presignedUrl, {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@typebot.io/nextjs",
|
"name": "@typebot.io/nextjs",
|
||||||
"version": "0.2.12",
|
"version": "0.2.13",
|
||||||
"description": "Convenient library to display typebots on your Next.js website",
|
"description": "Convenient library to display typebots on your Next.js website",
|
||||||
"main": "dist/index.js",
|
"main": "dist/index.js",
|
||||||
"types": "dist/index.d.ts",
|
"types": "dist/index.d.ts",
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@typebot.io/react",
|
"name": "@typebot.io/react",
|
||||||
"version": "0.2.12",
|
"version": "0.2.13",
|
||||||
"description": "Convenient library to display typebots on your React app",
|
"description": "Convenient library to display typebots on your React app",
|
||||||
"main": "dist/index.js",
|
"main": "dist/index.js",
|
||||||
"types": "dist/index.d.ts",
|
"types": "dist/index.d.ts",
|
||||||
|
|||||||
@@ -34,6 +34,8 @@ export const generatePresignedPostPolicy = async ({
|
|||||||
postPolicy.setKey(filePath)
|
postPolicy.setKey(filePath)
|
||||||
postPolicy.setBucket(env.S3_BUCKET)
|
postPolicy.setBucket(env.S3_BUCKET)
|
||||||
postPolicy.setExpires(new Date(Date.now() + tenMinutes * 1000))
|
postPolicy.setExpires(new Date(Date.now() + tenMinutes * 1000))
|
||||||
|
postPolicy.formData['Cache-Control'] = 'max-age=86400'
|
||||||
|
postPolicy.policy.conditions.push(['eq', '$Cache-Control', 'max-age=86400'])
|
||||||
if (fileType) postPolicy.setContentType(fileType)
|
if (fileType) postPolicy.setContentType(fileType)
|
||||||
|
|
||||||
return minioClient.presignedPostPolicy(postPolicy)
|
return minioClient.presignedPostPolicy(postPolicy)
|
||||||
|
|||||||
Reference in New Issue
Block a user