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 Microsoft.Extensions.Logging;
using System; using System;
using AyaNova.Util; using AyaNova.Util;
using AyaNova.Biz;
using AyaNova.Api.ControllerHelpers; using AyaNova.Api.ControllerHelpers;
using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Authorization;
using System.Threading.Tasks;
namespace AyaNova.Api.Controllers namespace AyaNova.Api.Controllers
{ {
@@ -41,11 +39,8 @@ namespace AyaNova.Api.Controllers
public ContentResult Index() public ContentResult Index()
{ {
var errorBlock = string.Empty; var errorBlock = string.Empty;
if (serverState.IsSystemLocked) if (serverState.IsSystemLocked)
{ errorBlock = $@"<div class=""error""><h1>SERVER ERROR</h1><h2>{serverState.Reason}</h2></div>";
errorBlock = $@"<div style=""color: #D8000C;background-color: #FFD2D2""><h2>SERVER ERROR</h2><p>{serverState.Reason}</p></div>";
}
//todo: remove excess whitespace
var resp = $@"<!DOCTYPE html> var resp = $@"<!DOCTYPE html>
<html lang=""en""> <html lang=""en"">
<head> <head>
@@ -57,56 +52,39 @@ namespace AyaNova.Api.Controllers
body {{ body {{
text-align: left; text-align: left;
font-family: sans-serif; font-family: sans-serif;
background-color: black; background-color: #282828;
color: whitesmoke; color: #ffb000;
}} }}
a {{ a {{
color: chartreuse; color: #33ff33;
text-decoration:none; text-decoration:none;
}} }}
.error{{
color: #D8000C;
padding-top:10px;
padding-bottom:10px;
}}
</style> </style>
</head> </head>
<body> <body>
{errorBlock}
<div style=""text-align: left;""> <div>
{errorBlock} <h1>{AyaNovaVersion.FullNameAndVersion}</h1>
<div style=""display: inline-block;text-align:left;""> <h2><a href=""/"" target=""_blank"">AyaNova App</a></h2>
<h1>{AyaNovaVersion.FullNameAndVersion}</h1> <h2><a href=""/docs"" target=""_blank"">User and technical guide</a></h2>
<h2><a href=""/"" target=""_blank"">AyaNova App</a></h2> <h2><a href=""https://contact.ayanova.com/contact"" target=""_blank"">Contact technical support</a></h2>
<h2><a href=""/docs"" target=""_blank"">User and technical guide</a></h2> <h2><a href=""/api-docs"" target=""_blank"">API explorer for developers</a></h2>
<h2><a href=""mailto:support@ayanova.com"">Email technical support</a></h2> </div>
<h2><a href=""/api-docs"" target=""_blank"">API explorer for developers</a></h2>
</ul>
</div>
</div>
</body> </body>
</html>"; </html>";
/* System.Text.RegularExpressions.Regex reg = new System.Text.RegularExpressions.Regex(@"(?<=\s)\s+");
resp = reg.Replace(resp, string.Empty).Replace("\n","").Replace("\t","");
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>
*/
return new ContentResult return new ContentResult
{ {
ContentType = "text/html", ContentType = "text/html",
StatusCode = 200, StatusCode = 200,
Content = resp Content = resp
}; };
} }
#region sigtest script #region sigtest script