From 7a6ba5d1d13d257eb6aee1cf2f929db0cd047b50 Mon Sep 17 00:00:00 2001 From: Abdullah Atta Date: Wed, 7 Aug 2024 15:21:08 +0500 Subject: [PATCH] web: check server version compatibility when testing connection --- .../dialogs/settings/components/servers-configuration.tsx | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/apps/web/src/dialogs/settings/components/servers-configuration.tsx b/apps/web/src/dialogs/settings/components/servers-configuration.tsx index 560a4f67b..20d222eb2 100644 --- a/apps/web/src/dialogs/settings/components/servers-configuration.tsx +++ b/apps/web/src/dialogs/settings/components/servers-configuration.tsx @@ -24,6 +24,7 @@ import { HostId, HostIds, useStore } from "../../../stores/setting-store"; import { useStore as useUserStore } from "../../../stores/user-store"; import { ErrorText } from "../../../components/error-text"; import { TaskManager } from "../../../common/task-manager"; +import { isServerCompatible } from "@notesnook/core"; export const ServerIds = ["notesnook-sync", "auth", "sse"] as const; export type ServerId = (typeof ServerIds)[number]; @@ -35,7 +36,7 @@ type Server = { description: string; }; type VersionResponse = { - version: string; + version: number; id: string; instance: string; }; @@ -159,6 +160,10 @@ export function ServersConfiguration() { throw new Error( `The URL you have given (${url}) does not point to the ${server.title}.` ); + if (!isServerCompatible(version.version)) + throw new Error( + `The ${server.title} at ${url} is not compatible with this client.` + ); } setSuccess(true); } catch (e) {