Skip to content

A fully open source & end-to-end encrypted note taking alternative to Evernote.

web: check server version compatibility when testing connection

Abdullah Atta7a6ba5d1d13d
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) {