Skip to content

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

core: add function for checking compability with server

Abdullah Attacc3ccd041d4b
diff --git a/packages/core/src/index.ts b/packages/core/src/index.ts
index 351e6a417..1fc654351 100644
--- a/packages/core/src/index.ts
+++ b/packages/core/src/index.ts
@@ -32,3 +32,4 @@ export {
type TextSlice
} from "./utils/content-block";
export { type DatabaseUpdatedEvent } from "./database";
+export { isServerCompatible } from "./utils/constants";
diff --git a/packages/core/src/utils/constants.ts b/packages/core/src/utils/constants.ts
index 1533c1aea..eb9a6352c 100644
--- a/packages/core/src/utils/constants.ts
+++ b/packages/core/src/utils/constants.ts
@@ -19,6 +19,12 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
import { extractHostname } from "./hostname";
+const COMPATIBLE_SERVER_VERSION = 1;
+
+export function isServerCompatible(version: number) {
+ return COMPATIBLE_SERVER_VERSION === version;
+}
+
function isProduction() {
return (
process.env.NODE_ENV === "production" || process.env.NODE_ENV === "test"