mirror of
https://github.com/streetwriters/notesnook-sync-server.git
synced 2026-02-12 19:22:45 +00:00
global: add very basic server versioning
This commit is contained in:
@@ -226,6 +226,7 @@ namespace Notesnook.API
|
||||
app.UseResponseCompression();
|
||||
|
||||
app.UseCors("notesnook");
|
||||
app.UseVersion();
|
||||
|
||||
app.UseWamp(WampServers.NotesnookServer, (realm, server) =>
|
||||
{
|
||||
|
||||
@@ -19,6 +19,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
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<T>(this IApplicationBuilder app, WampServer<T> server, Action<IWampHostedRealm, WampServer<T>> action) where T : new()
|
||||
{
|
||||
WampHost host = new WampHost();
|
||||
|
||||
32
Streetwriters.Common/Version.cs
Normal file
32
Streetwriters.Common/Version.cs
Normal file
@@ -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 <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
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}";
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -177,6 +177,7 @@ namespace Streetwriters.Identity
|
||||
}
|
||||
|
||||
app.UseCors("notesnook");
|
||||
app.UseVersion();
|
||||
|
||||
app.UseRouting();
|
||||
|
||||
|
||||
@@ -102,6 +102,7 @@ namespace Streetwriters.Messenger
|
||||
}
|
||||
|
||||
app.UseCors("notesnook");
|
||||
app.UseVersion();
|
||||
|
||||
app.UseRouting();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user