diff --git a/src/Api/Controllers/AliveController.cs b/src/Api/Controllers/AliveController.cs deleted file mode 100644 index e86bec4637..0000000000 --- a/src/Api/Controllers/AliveController.cs +++ /dev/null @@ -1,31 +0,0 @@ -using System; -using Microsoft.AspNetCore.Mvc; -using System.Linq; -using System.Reflection; - -namespace Bit.Api.Controllers -{ - [Route("alive")] - public class AliveController : Controller - { - [HttpGet("")] - public DateTime Get() - { - return DateTime.UtcNow; - } - - [HttpGet("claims")] - public IActionResult Claims() - { - return new JsonResult(User?.Claims?.Select(c => new { c.Type, c.Value })); - } - - [HttpGet("version")] - public IActionResult Version() - { - var version = Assembly.GetEntryAssembly() - .GetCustomAttribute().InformationalVersion; - return new JsonResult(version); - } - } -} diff --git a/src/Api/Controllers/MiscController.cs b/src/Api/Controllers/MiscController.cs new file mode 100644 index 0000000000..fdd0e3c423 --- /dev/null +++ b/src/Api/Controllers/MiscController.cs @@ -0,0 +1,28 @@ +using System; +using Microsoft.AspNetCore.Mvc; +using System.Linq; +using Bit.Core.Models.Api; + +namespace Bit.Api.Controllers +{ + public class MiscController : Controller + { + [HttpGet("~/alive")] + public DateTime Get() + { + return DateTime.UtcNow; + } + + [HttpGet("~/claims")] + public IActionResult Claims() + { + return new JsonResult(User?.Claims?.Select(c => new { c.Type, c.Value })); + } + + [HttpGet("~/version")] + public VersionResponseModel Version() + { + return new VersionResponseModel(); + } + } +} diff --git a/src/Core/Models/Api/Response/VersionResponseModel.cs b/src/Core/Models/Api/Response/VersionResponseModel.cs new file mode 100644 index 0000000000..9830d7f711 --- /dev/null +++ b/src/Core/Models/Api/Response/VersionResponseModel.cs @@ -0,0 +1,20 @@ +using System; +using System.Reflection; + +namespace Bit.Core.Models.Api +{ + public class VersionResponseModel : ResponseModel + { + public VersionResponseModel() + : base("version") + { + Version = Assembly.GetEntryAssembly() + .GetCustomAttribute() + .InformationalVersion; + VersionInt = Convert.ToInt32(Version.Replace(".", string.Empty)); + } + + public string Version { get; set; } + public int VersionInt { get; set; } + } +}