From dfabfcbc23411aa5faa46420da700bd750a1c21b Mon Sep 17 00:00:00 2001 From: Abdullah Atta Date: Wed, 7 Aug 2024 15:06:58 +0500 Subject: [PATCH] common: simplify compatibility version --- Streetwriters.Common/Constants.cs | 1 + .../Extensions/AppBuilderExtensions.cs | 4 +-- Streetwriters.Common/Version.cs | 32 ------------------- 3 files changed, 3 insertions(+), 34 deletions(-) delete mode 100644 Streetwriters.Common/Version.cs diff --git a/Streetwriters.Common/Constants.cs b/Streetwriters.Common/Constants.cs index 5410ce4..ff3aa9e 100644 --- a/Streetwriters.Common/Constants.cs +++ b/Streetwriters.Common/Constants.cs @@ -23,6 +23,7 @@ namespace Streetwriters.Common { public class Constants { + public static int COMPATIBILITY_VERSION = 1; public static bool IS_SELF_HOSTED => Environment.GetEnvironmentVariable("SELF_HOSTED") == "1"; public static bool DISABLE_ACCOUNT_CREATION => Environment.GetEnvironmentVariable("DISABLE_ACCOUNT_CREATION") == "1"; public static string INSTANCE_NAME => Environment.GetEnvironmentVariable("INSTANCE_NAME") ?? "default"; diff --git a/Streetwriters.Common/Extensions/AppBuilderExtensions.cs b/Streetwriters.Common/Extensions/AppBuilderExtensions.cs index 451b73d..0c159bb 100644 --- a/Streetwriters.Common/Extensions/AppBuilderExtensions.cs +++ b/Streetwriters.Common/Extensions/AppBuilderExtensions.cs @@ -39,9 +39,9 @@ namespace Streetwriters.Common.Extensions app.Run(async context => { context.Response.ContentType = "application/json"; - var data = new Dictionary + var data = new Dictionary { - { "version", Version.AsString() }, + { "version", Constants.COMPATIBILITY_VERSION }, { "id", server.Id }, { "instance", Constants.INSTANCE_NAME } }; diff --git a/Streetwriters.Common/Version.cs b/Streetwriters.Common/Version.cs deleted file mode 100644 index 7e66f24..0000000 --- a/Streetwriters.Common/Version.cs +++ /dev/null @@ -1,32 +0,0 @@ -/* -This file is part of the Notesnook Sync Server project (https://notesnook.com/) - -Copyright (C) 2023 Streetwriters (Private) Limited - -This program is free software: you can redistribute it and/or modify -it under the terms of the Affero GNU General Public License as published by -the Free Software Foundation, either version 3 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -Affero GNU General Public License for more details. - -You should have received a copy of the Affero GNU General Public License -along with this program. If not, see . -*/ - -namespace Streetwriters.Common -{ - public class Version - { - public const int MAJOR = 1; - public const int MINOR = 0; - public const int PATCH = 0; - public static string AsString() - { - return $"{Version.MAJOR}.{Version.MINOR}.{Version.PATCH}"; - } - } -} \ No newline at end of file