Skip to content

Virtual whiteboard for sketching hand-drawn like diagrams

refactor: remove portal as it is no longer needed (#7623)

Milos Vetesnikd426cc968d49
diff --git a/.env.development b/.env.development
index 44955884f5..bab59ee075 100644
--- a/.env.development
+++ b/.env.development
@@ -5,10 +5,7 @@ VITE_APP_LIBRARY_URL=https://libraries.excalidraw.com
VITE_APP_LIBRARY_BACKEND=https://us-central1-excalidraw-room-persistence.cloudfunctions.net/libraries
# collaboration WebSocket server (https://github.com/excalidraw/excalidraw-room)
-VITE_APP_WS_SERVER_URL=http://localhost:3002
-
-# set this only if using the collaboration workflow we use on excalidraw.com
-VITE_APP_PORTAL_URL=
+VITE_APP_WS_SERVER_URL=http://localhost:3020
VITE_APP_PLUS_LP=https://plus.excalidraw.com
VITE_APP_PLUS_APP=https://app.excalidraw.com
diff --git a/.env.production b/.env.production
index 26b46a52ab..0c715854a8 100644
--- a/.env.production
+++ b/.env.production
@@ -4,16 +4,13 @@ VITE_APP_BACKEND_V2_POST_URL=https://json.excalidraw.com/api/v2/post/
VITE_APP_LIBRARY_URL=https://libraries.excalidraw.com
VITE_APP_LIBRARY_BACKEND=https://us-central1-excalidraw-room-persistence.cloudfunctions.net/libraries
-VITE_APP_PORTAL_URL=https://portal.excalidraw.com
-
VITE_APP_PLUS_LP=https://plus.excalidraw.com
VITE_APP_PLUS_APP=https://app.excalidraw.com
VITE_APP_AI_BACKEND=https://oss-ai.excalidraw.com
-# Fill to set socket server URL used for collaboration.
-# Meant for forks only: excalidraw.com uses custom VITE_APP_PORTAL_URL flow
-VITE_APP_WS_SERVER_URL=
+# socket server URL used for collaboration
+VITE_APP_WS_SERVER_URL=https://oss-collab.excalidraw.com
VITE_APP_FIREBASE_CONFIG='{"apiKey":"AIzaSyAd15pYlMci_xIp9ko6wkEsDzAAA0Dn0RU","authDomain":"excalidraw-room-persistence.firebaseapp.com","databaseURL":"https://excalidraw-room-persistence.firebaseio.com","projectId":"excalidraw-room-persistence","storageBucket":"excalidraw-room-persistence.appspot.com","messagingSenderId":"654800341332","appId":"1:654800341332:web:4a692de832b55bd57ce0c1"}'
diff --git a/excalidraw-app/collab/Collab.tsx b/excalidraw-app/collab/Collab.tsx
index 92d94dbc9e..267dee66c0 100644
--- a/excalidraw-app/collab/Collab.tsx
+++ b/excalidraw-app/collab/Collab.tsx
@@ -36,7 +36,6 @@ import {
import {
generateCollaborationLinkData,
getCollaborationLink,
- getCollabServer,
getSyncableElements,
SocketUpdateDataSource,
SyncableExcalidrawElement,
@@ -452,13 +451,9 @@ class Collab extends PureComponent<Props, CollabState> {
this.fallbackInitializationHandler = fallbackInitializationHandler;
try {
- const socketServerData = await getCollabServer();
-
this.portal.socket = this.portal.open(
- socketIOClient(socketServerData.url, {
- transports: socketServerData.polling
- ? ["websocket", "polling"]
- : ["websocket"],
+ socketIOClient(import.meta.env.VITE_APP_WS_SERVER_URL, {
+ transports: ["websocket", "polling"],
}),
roomId,
roomKey,
diff --git a/excalidraw-app/data/index.ts b/excalidraw-app/data/index.ts
index 0f54ee880e..5699568b43 100644
--- a/excalidraw-app/data/index.ts
+++ b/excalidraw-app/data/index.ts
@@ -65,35 +65,6 @@ const generateRoomId = async () => {
return bytesToHexString(buffer);
};
-/**
- * Right now the reason why we resolve connection params (url, polling...)
- * from upstream is to allow changing the params immediately when needed without
- * having to wait for clients to update the SW.
- *
- * If REACT_APP_WS_SERVER_URL env is set, we use that instead (useful for forks)
- */
-export const getCollabServer = async (): Promise<{
- url: string;
- polling: boolean;
-}> => {
- if (import.meta.env.VITE_APP_WS_SERVER_URL) {
- return {
- url: import.meta.env.VITE_APP_WS_SERVER_URL,
- polling: true,
- };
- }
-
- try {
- const resp = await fetch(
- `${import.meta.env.VITE_APP_PORTAL_URL}/collab-server`,
- );
- return await resp.json();
- } catch (error) {
- console.error(error);
- throw new Error(t("errors.cannotResolveCollabServer"));
- }
-};
-
export type EncryptedData = {
data: ArrayBuffer;
iv: Uint8Array;
diff --git a/excalidraw-app/tests/collab.test.tsx b/excalidraw-app/tests/collab.test.tsx
index 455316aed4..c3e94a5ef4 100644
--- a/excalidraw-app/tests/collab.test.tsx
+++ b/excalidraw-app/tests/collab.test.tsx
@@ -20,17 +20,6 @@ Object.defineProperty(window, "crypto", {
},
});
-vi.mock("../../excalidraw-app/data/index.ts", async (importActual) => {
- const module = (await importActual()) as any;
- return {
- __esmodule: true,
- ...module,
- getCollabServer: vi.fn(() => ({
- url: /* doesn't really matter */ "http://localhost:3002",
- })),
- };
-});
-
vi.mock("../../excalidraw-app/data/firebase.ts", () => {
const loadFromFirebase = async () => null;
const saveToFirebase = () => {};