@@ -1,31 +0,0 @@
|
||||
import { env } from '@typebot.io/env'
|
||||
import { Client } from 'minio'
|
||||
|
||||
export const deleteFilesFromBucket = async ({
|
||||
urls,
|
||||
}: {
|
||||
urls: string[]
|
||||
}): Promise<void> => {
|
||||
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,
|
||||
})
|
||||
|
||||
const bucket = env.S3_BUCKET ?? 'typebot'
|
||||
|
||||
return minioClient.removeObjects(
|
||||
bucket,
|
||||
urls
|
||||
.filter((url) => url.includes(env.S3_ENDPOINT as string))
|
||||
.map((url) => url.split(`/${bucket}/`)[1])
|
||||
)
|
||||
}
|
||||
@@ -1,4 +1,8 @@
|
||||
export const isCloudProdInstance =
|
||||
(typeof window !== 'undefined' &&
|
||||
window.location.hostname === 'app.typebot.io') ||
|
||||
process.env.NEXTAUTH_URL === 'https://app.typebot.io'
|
||||
import { env } from '@typebot.io/env'
|
||||
|
||||
export const isCloudProdInstance = () => {
|
||||
if (typeof window !== 'undefined') {
|
||||
return window.location.hostname === 'app.typebot.io'
|
||||
}
|
||||
return env.NEXTAUTH_URL === 'https://app.typebot.io'
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@ import { webhookRouter } from '@/features/blocks/integrations/webhook/api/router
|
||||
import { getLinkedTypebots } from '@/features/blocks/logic/typebotLink/api/getLinkedTypebots'
|
||||
import { credentialsRouter } from '@/features/credentials/api/router'
|
||||
import { getAppVersionProcedure } from '@/features/dashboard/api/getAppVersionProcedure'
|
||||
import { sendWhatsAppInitialMessage } from '@/features/preview/api/sendWhatsAppInitialMessage'
|
||||
import { resultsRouter } from '@/features/results/api/router'
|
||||
import { processTelemetryEvent } from '@/features/telemetry/api/processTelemetryEvent'
|
||||
import { themeRouter } from '@/features/theme/api/router'
|
||||
@@ -12,12 +13,14 @@ import { router } from '../../trpc'
|
||||
import { analyticsRouter } from '@/features/analytics/api/router'
|
||||
import { collaboratorsRouter } from '@/features/collaboration/api/router'
|
||||
import { customDomainsRouter } from '@/features/customDomains/api/router'
|
||||
import { whatsAppRouter } from '@/features/whatsapp/router'
|
||||
|
||||
export const trpcRouter = router({
|
||||
getAppVersionProcedure,
|
||||
processTelemetryEvent,
|
||||
getLinkedTypebots,
|
||||
analytics: analyticsRouter,
|
||||
sendWhatsAppInitialMessage,
|
||||
workspace: workspaceRouter,
|
||||
typebot: typebotRouter,
|
||||
webhook: webhookRouter,
|
||||
@@ -27,6 +30,7 @@ export const trpcRouter = router({
|
||||
theme: themeRouter,
|
||||
collaborators: collaboratorsRouter,
|
||||
customDomains: customDomainsRouter,
|
||||
whatsApp: whatsAppRouter,
|
||||
})
|
||||
|
||||
export type AppRouter = typeof trpcRouter
|
||||
|
||||
Reference in New Issue
Block a user