This commit is contained in:
2020-08-12 23:24:09 +00:00
parent 7ffd420c2d
commit bdbfa98e79

View File

@@ -30,6 +30,27 @@ namespace AyaNova.Api.Controllers
serverState = apiServerState; 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}";
}
/// <summary> /// <summary>
/// Server landing page /// Server landing page
/// </summary> /// </summary>
@@ -73,7 +94,7 @@ namespace AyaNova.Api.Controllers
<h1>{AyaNovaVersion.FullNameAndVersion}</h1> <h1>{AyaNovaVersion.FullNameAndVersion}</h1>
<h2><a href=""/"" target=""_blank"">AyaNova App</a></h2> <h2><a href=""/"" target=""_blank"">AyaNova App</a></h2>
<h2><a href=""/docs"" target=""_blank"">User and technical guide</a></h2> <h2><a href=""/docs"" target=""_blank"">User and technical guide</a></h2>
<h2><a href=""https://contact.ayanova.com/contact"" target=""_blank"">Contact technical support</a></h2> <h2><a href=""{SupportUrl()}"" target=""_blank"">Contact technical support</a></h2>
<h2><a href=""/api-docs"" target=""_blank"">API explorer for developers</a></h2> <h2><a href=""/api-docs"" target=""_blank"">API explorer for developers</a></h2>
</div> </div>
</body> </body>
@@ -88,6 +109,55 @@ namespace AyaNova.Api.Controllers
}; };
} }
/// <summary>
/// Get API server info for general display
/// </summary>
/// <returns>API server info</returns>
[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)
/// <summary>
/// Get build mode of server, used for automated testing purposes
/// </summary>
/// <returns>"DEBUG" or "RELEASE"</returns>
[HttpGet("build-mode")]
public ActionResult BuildMode()
{
return Ok(new { data = new { BuildMode = "DEBUG" } });
}
#else
/// <summary>
/// Get build mode of server, used for automated testing purposes
/// </summary>
/// <returns>"DEBUG" or "RELEASE"</returns>
[HttpGet("build-mode")]
public ActionResult BuildMode()
{
return Ok(new { data = new { BuildMode = "RELEASE" } });
}
#endif
}
}
#region sigtest script #region sigtest script
/* /*
@@ -428,51 +498,3 @@ namespace AyaNova.Api.Controllers
} }
*/ */
#endregion #endregion
/// <summary>
/// Get API server info for general display
/// </summary>
/// <returns>API server info</returns>
[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)
/// <summary>
/// Get build mode of server, used for automated testing purposes
/// </summary>
/// <returns>"DEBUG" or "RELEASE"</returns>
[HttpGet("build-mode")]
public ActionResult BuildMode()
{
return Ok(new { data = new { BuildMode = "DEBUG" } });
}
#else
/// <summary>
/// Get build mode of server, used for automated testing purposes
/// </summary>
/// <returns>"DEBUG" or "RELEASE"</returns>
[HttpGet("build-mode")]
public ActionResult BuildMode()
{
return Ok(new { data = new { BuildMode = "RELEASE" } });
}
#endif
}
}