Cleanup of server api home page

This commit is contained in:
2020-05-18 00:24:30 +00:00
parent 18fa57d39a
commit 2ca9b07909

View File

@@ -2,10 +2,8 @@ using Microsoft.AspNetCore.Mvc;
using Microsoft.Extensions.Logging;
using System;
using AyaNova.Util;
using AyaNova.Biz;
using AyaNova.Api.ControllerHelpers;
using Microsoft.AspNetCore.Authorization;
using System.Threading.Tasks;
namespace AyaNova.Api.Controllers
{
@@ -41,11 +39,8 @@ namespace AyaNova.Api.Controllers
public ContentResult Index()
{
var errorBlock = string.Empty;
if (serverState.IsSystemLocked)
{
errorBlock = $@"<div style=""color: #D8000C;background-color: #FFD2D2""><h2>SERVER ERROR</h2><p>{serverState.Reason}</p></div>";
}
//todo: remove excess whitespace
if (serverState.IsSystemLocked)
errorBlock = $@"<div class=""error""><h1>SERVER ERROR</h1><h2>{serverState.Reason}</h2></div>";
var resp = $@"<!DOCTYPE html>
<html lang=""en"">
<head>
@@ -57,56 +52,39 @@ namespace AyaNova.Api.Controllers
body {{
text-align: left;
font-family: sans-serif;
background-color: black;
color: whitesmoke;
background-color: #282828;
color: #ffb000;
}}
a {{
color: chartreuse;
color: #33ff33;
text-decoration:none;
}}
}}
.error{{
color: #D8000C;
padding-top:10px;
padding-bottom:10px;
}}
</style>
</head>
<body>
<div style=""text-align: left;"">
{errorBlock}
<div style=""display: inline-block;text-align:left;"">
<h1>{AyaNovaVersion.FullNameAndVersion}</h1>
<h2><a href=""/"" target=""_blank"">AyaNova App</a></h2>
<h2><a href=""/docs"" target=""_blank"">User and technical guide</a></h2>
<h2><a href=""mailto:support@ayanova.com"">Email technical support</a></h2>
<h2><a href=""/api-docs"" target=""_blank"">API explorer for developers</a></h2>
</ul>
</div>
</div>
<body>
{errorBlock}
<div>
<h1>{AyaNovaVersion.FullNameAndVersion}</h1>
<h2><a href=""/"" target=""_blank"">AyaNova App</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=""/api-docs"" target=""_blank"">API explorer for developers</a></h2>
</div>
</body>
</html>";
/*
head had this:
<script src=/jquery-1.9.1.js></script>
probably for signature page
<h4>{await TranslationBiz.GetDefaultTranslationAsync("HelpLicense")}</h4>
<pre>{AyaNova.Core.License.LicenseInfo}</pre>
<h4>Schema version</h4>
<pre>{AySchema.currentSchema.ToString()}</pre>
<h4>Active techs</h4>
<pre>{await UserBiz.ActiveCountAsync()}</pre>
<h4>Server time</h4>
<pre>{DateUtil.ServerDateTimeString(System.DateTime.UtcNow)}</pre>
<pre>{TimeZoneInfo.Local.Id}</pre>
<h4>Server logs</h4>
<pre>{ServerBootConfig.AYANOVA_LOG_PATH}</pre>
*/
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
};
}
#region sigtest script