From dc3ce27762a87f49f5ddb75528d0d0c727f5d30a Mon Sep 17 00:00:00 2001 From: Philipinho <16838612+Philipinho@users.noreply.github.com> Date: Tue, 3 Sep 2024 10:48:47 +0100 Subject: [PATCH 1/2] fix collaboration websocket --- apps/client/src/lib/config.ts | 26 +++++++++++++++----------- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/apps/client/src/lib/config.ts b/apps/client/src/lib/config.ts index 5ff70e7..add2bf7 100644 --- a/apps/client/src/lib/config.ts +++ b/apps/client/src/lib/config.ts @@ -7,23 +7,27 @@ declare global { export function getAppUrl(): string { //let appUrl = window.CONFIG?.APP_URL || process.env.APP_URL; - // if (import.meta.env.DEV) { - // return appUrl || "http://localhost:3000"; + // if (import.meta.env.DEV) { + // return appUrl || "http://localhost:3000"; //} return `${window.location.protocol}//${window.location.host}`; } export function getBackendUrl(): string { - return getAppUrl() + "/api"; + return getAppUrl() + '/api'; } export function getCollaborationUrl(): string { - const COLLAB_PATH = "/collab"; - const url = process.env.APP_URL || getAppUrl(); + const COLLAB_PATH = '/collab'; - const wsProtocol = url.startsWith("https") ? "wss" : "ws"; - return `${wsProtocol}://${url.split("://")[1]}${COLLAB_PATH}`; + let url = getAppUrl(); + if (import.meta.env.DEV) { + url = process.env.APP_URL; + } + + const wsProtocol = url.startsWith('https') ? 'wss' : 'ws'; + return `${wsProtocol}://${url.split('://')[1]}${COLLAB_PATH}`; } export function getAvatarUrl(avatarUrl: string) { @@ -31,17 +35,17 @@ export function getAvatarUrl(avatarUrl: string) { return null; } - if (avatarUrl?.startsWith("http")) { + if (avatarUrl?.startsWith('http')) { return avatarUrl; } - return getBackendUrl() + "/attachments/img/avatar/" + avatarUrl; + return getBackendUrl() + '/attachments/img/avatar/' + avatarUrl; } export function getSpaceUrl(spaceSlug: string) { - return "/s/" + spaceSlug; + return '/s/' + spaceSlug; } export function getFileUrl(src: string) { - return src?.startsWith("/files/") ? getBackendUrl() + src : src; + return src?.startsWith('/files/') ? getBackendUrl() + src : src; } From 4e2b23c97ed13026b5881f7399edaef53b512714 Mon Sep 17 00:00:00 2001 From: Philipinho <16838612+Philipinho@users.noreply.github.com> Date: Tue, 3 Sep 2024 10:49:38 +0100 Subject: [PATCH 2/2] v0.3.1 --- apps/client/package.json | 2 +- apps/server/package.json | 2 +- package.json | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/apps/client/package.json b/apps/client/package.json index 83d4079..abfa553 100644 --- a/apps/client/package.json +++ b/apps/client/package.json @@ -1,7 +1,7 @@ { "name": "client", "private": true, - "version": "0.3.0", + "version": "0.3.1", "scripts": { "dev": "vite", "build": "tsc && vite build", diff --git a/apps/server/package.json b/apps/server/package.json index 360a822..61baefb 100644 --- a/apps/server/package.json +++ b/apps/server/package.json @@ -1,6 +1,6 @@ { "name": "server", - "version": "0.3.0", + "version": "0.3.1", "description": "", "author": "", "private": true, diff --git a/package.json b/package.json index 62f80e9..e4c6c59 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "docmost", "homepage": "https://docmost.com", - "version": "0.3.0", + "version": "0.3.1", "private": true, "scripts": { "build": "nx run-many -t build",