mirror of
https://github.com/streetwriters/notesnook.git
synced 2026-02-23 19:49:56 +01:00
web: check server version compatibility when testing connection
This commit is contained in:
committed by
Abdullah Atta
parent
cc3ccd041d
commit
7a6ba5d1d1
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user