diff --git a/Notesnook.API/Startup.cs b/Notesnook.API/Startup.cs index 88a047f..9123dfd 100644 --- a/Notesnook.API/Startup.cs +++ b/Notesnook.API/Startup.cs @@ -226,6 +226,7 @@ namespace Notesnook.API app.UseResponseCompression(); app.UseCors("notesnook"); + app.UseVersion(); app.UseWamp(WampServers.NotesnookServer, (realm, server) => { diff --git a/Streetwriters.Common/Extensions/AppBuilderExtensions.cs b/Streetwriters.Common/Extensions/AppBuilderExtensions.cs index 6c6c3c8..28f3871 100644 --- a/Streetwriters.Common/Extensions/AppBuilderExtensions.cs +++ b/Streetwriters.Common/Extensions/AppBuilderExtensions.cs @@ -19,6 +19,7 @@ along with this program. If not, see . using System; using Microsoft.AspNetCore.Builder; +using Microsoft.AspNetCore.Http; using Microsoft.Extensions.DependencyInjection; using WampSharp.AspNetCore.WebSockets.Server; using WampSharp.Binding; @@ -29,6 +30,18 @@ namespace Streetwriters.Common.Extensions { public static class AppBuilderExtensions { + public static IApplicationBuilder UseVersion(this IApplicationBuilder app) + { + app.Map("/version", (app) => + { + app.Run(async context => + { + await context.Response.WriteAsync(Version.AsString()); + }); + }); + return app; + } + public static IApplicationBuilder UseWamp(this IApplicationBuilder app, WampServer server, Action> action) where T : new() { WampHost host = new WampHost(); diff --git a/Streetwriters.Common/Version.cs b/Streetwriters.Common/Version.cs new file mode 100644 index 0000000..41528f4 --- /dev/null +++ b/Streetwriters.Common/Version.cs @@ -0,0 +1,32 @@ +/* +This file is part of the Notesnook Sync Server project (https://notesnook.com/) + +Copyright (C) 2022 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 = 2; + public const int MINOR = 3; + public const int PATCH = 0; + public static string AsString() + { + return $"{Version.MAJOR}.{Version.MINOR}.{Version.PATCH}"; + } + } +} \ No newline at end of file diff --git a/Streetwriters.Identity/Startup.cs b/Streetwriters.Identity/Startup.cs index dfe411c..5ec12a4 100644 --- a/Streetwriters.Identity/Startup.cs +++ b/Streetwriters.Identity/Startup.cs @@ -177,6 +177,7 @@ namespace Streetwriters.Identity } app.UseCors("notesnook"); + app.UseVersion(); app.UseRouting(); diff --git a/Streetwriters.Messenger/Startup.cs b/Streetwriters.Messenger/Startup.cs index 2ebba99..4c4d918 100644 --- a/Streetwriters.Messenger/Startup.cs +++ b/Streetwriters.Messenger/Startup.cs @@ -1,4 +1,4 @@ -/* + /* This file is part of the Notesnook Sync Server project (https://notesnook.com/) Copyright (C) 2022 Streetwriters (Private) Limited @@ -102,6 +102,7 @@ namespace Streetwriters.Messenger } app.UseCors("notesnook"); + app.UseVersion(); app.UseRouting();