using Microsoft.AspNetCore.Mvc; using Microsoft.Extensions.Logging; using System; using AyaNova.Util; using AyaNova.Api.ControllerHelpers; using Microsoft.AspNetCore.Authorization; namespace AyaNova.Api.Controllers { /// /// Meta controller class /// [ApiVersion("8.0")] [Route("api/v{version:apiVersion}/")] [Authorize] [ApiController] public class ApiMetaController : ControllerBase { private readonly ApiServerState serverState; private readonly ILogger _log; /// /// /// /// /// public ApiMetaController(ILogger logger, ApiServerState apiServerState) { _log = logger; serverState = apiServerState; } private static string SupportUrl() { /* contactSupportUrl() { let dbId = encodeURIComponent( window.$gz.store.state.globalSettings.serverDbId ); let company = encodeURIComponent( window.$gz.store.state.globalSettings.company ); return `https://contact.ayanova.com/contact?dbid=${dbId}&company=${company}`; } */ var dbId = Uri.EscapeDataString(AyaNova.Core.License.ServerDbId); var company = Uri.EscapeDataString(AyaNova.Core.License.ActiveKey.RegisteredTo); return $"https://contact.ayanova.com/contact?dbid={dbId}&company={company}"; } /// /// Server landing page /// /// [AllowAnonymous] [HttpGet] public ContentResult Index() { //https://superuser.com/questions/361297/what-colour-is-the-dark-green-on-old-fashioned-green-screen-computer-displays var errorBlock = string.Empty; if (serverState.IsSystemLocked) errorBlock = $@"SERVER LOCKED{serverState.Reason}"; var resp = $@" AyaNova server {errorBlock} {AyaNovaVersion.FullNameAndVersion} AyaNova App User and technical guide Contact technical support API explorer for developers {AyaNova.Core.License.LicenseInfo} "; System.Text.RegularExpressions.Regex reg = new System.Text.RegularExpressions.Regex(@"(?<=\s)\s+"); resp = reg.Replace(resp, string.Empty).Replace("\n", "").Replace("\t", ""); return new ContentResult { ContentType = "text/html", StatusCode = 200, Content = resp }; } /// /// Get API server info for general display /// /// API server info [HttpGet("server-info")] public ActionResult ServerInfo() { return Ok(new { data = new { ServerVersion = AyaNovaVersion.FullNameAndVersion, DBSchemaVersion = AySchema.currentSchema, ServerLocalTime = DateUtil.ServerDateTimeString(System.DateTime.UtcNow), ServerTimeZone = TimeZoneInfo.Local.Id, ServerDbId = AyaNova.Core.License.ServerDbId, License = AyaNova.Core.License.LicenseInfoAsJson } }); } #if (DEBUG) /// /// Get build mode of server, used for automated testing purposes /// /// "DEBUG" or "RELEASE" [HttpGet("build-mode")] public ActionResult BuildMode() { return Ok(new { data = new { BuildMode = "DEBUG" } }); } #else /// /// Get build mode of server, used for automated testing purposes /// /// "DEBUG" or "RELEASE" [HttpGet("build-mode")] public ActionResult BuildMode() { return Ok(new { data = new { BuildMode = "RELEASE" } }); } #endif } } #region sigtest script /* SIGTEST - 1 This is the signature header Your browser does not support signing The following browsers are supported: IE 9.0 +, FIREFOX 3.0 +, SAFARI 3.0 +, CHROME 3.0 +, OPERA 10.0 +, IPAD 1.0 +, IPHONE 1.0 +, ANDROID 1.0 + {SigScript()} private string SigScript(){ return @""; } */ #endregion
{AyaNova.Core.License.LicenseInfo}
Your browser does not support signing The following browsers are supported: IE 9.0 +, FIREFOX 3.0 +, SAFARI 3.0 +, CHROME 3.0 +, OPERA 10.0 +, IPAD 1.0 +, IPHONE 1.0 +, ANDROID 1.0 +