From 1de638c0580dfd2b363195d9cd2b8da96750b591 Mon Sep 17 00:00:00 2001 From: Aric Lasry Date: Thu, 18 Jan 2024 15:10:04 +0100 Subject: [PATCH] URL Connector: Allow specific customer (#3292) * URL Connector: Allow specific customer * Remove useless line --- front/lib/development.ts | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/front/lib/development.ts b/front/lib/development.ts index 661618051eb3..43f67bed35d6 100644 --- a/front/lib/development.ts +++ b/front/lib/development.ts @@ -1,4 +1,5 @@ import type { WorkspaceType } from "@dust-tt/types"; +import crypto from "crypto"; const PRODUCTION_DUST_WORKSPACE_ID = "0ec9852c2f"; const PRODUCTION_DUST_APPS_WORKSPACE_ID = "78bda07b39"; @@ -22,8 +23,18 @@ export function isActivatedStructuredDB(owner: WorkspaceType) { export function isActivatedPublicURLs(owner: WorkspaceType) { // We will manually add workspace ids here. + const hashedWorkspaceId = crypto + .createHash("md5") + .update(owner.sId) + .digest("hex"); + return ( isDevelopmentOrDustWorkspace(owner) || - [PRODUCTION_DUST_WORKSPACE_ID].includes(owner.sId) + [ + // Customers workspace. + // You can find them in the Database with the following query: + // select * from workspaces where md5("sId") = 'XXX'; + "9904970eeaa283f18656c6e60b66cb19", + ].includes(hashedWorkspaceId) ); }