* Error Status Page

* Dark theme
vnext v1.0.6-rc19
Paul Schneider 3 years ago
parent 2226220636
commit fe7339b851
3 changed files with 3 additions and 89 deletions

@ -325,8 +325,7 @@ namespace Yavsc
loggerFactory.AddConsole(Configuration.GetSection("Logging")); loggerFactory.AddConsole(Configuration.GetSection("Logging"));
loggerFactory.AddDebug(); loggerFactory.AddDebug();
_logger = loggerFactory.CreateLogger<Startup>(); _logger = loggerFactory.CreateLogger<Startup>();
app.UseStatusCodePagesWithReExecute("/Home/Status/{0}");
if (env.IsDevelopment()) if (env.IsDevelopment())
{ {
var logenvvar = Environment.GetEnvironmentVariable("ASPNET_LOG_LEVEL"); var logenvvar = Environment.GetEnvironmentVariable("ASPNET_LOG_LEVEL");
@ -349,7 +348,6 @@ namespace Yavsc
} }
app.UseDeveloperExceptionPage();
app.UseRuntimeInfoPage(); app.UseRuntimeInfoPage();
var epo = new ErrorPageOptions var epo = new ErrorPageOptions
{ {
@ -408,16 +406,6 @@ namespace Yavsc
app.UseRequestLocalization(localizationOptions.Value, (RequestCulture)new RequestCulture((string)"en-US")); app.UseRequestLocalization(localizationOptions.Value, (RequestCulture)new RequestCulture((string)"en-US"));
ConfigureWorkflow(); ConfigureWorkflow();
// Empty this odd chat user list from db
/*
foreach (var p in dbContext.ChatConnection)
{
dbContext.Entry(p).State = EntityState.Deleted;
}
dbContext.SaveChanges();
FIXME */
ConfigureWebSocketsApp(app); ConfigureWebSocketsApp(app);
app.UseMvc(routes => app.UseMvc(routes =>
@ -428,80 +416,6 @@ namespace Yavsc
}); });
_logger.LogInformation("LocalApplicationData: " + Environment.GetFolderPath(SpecialFolder.LocalApplicationData, SpecialFolderOption.DoNotVerify)); _logger.LogInformation("LocalApplicationData: " + Environment.GetFolderPath(SpecialFolder.LocalApplicationData, SpecialFolderOption.DoNotVerify));
#if EXPERIMENTAL
app.Use(async (context, next) =>
{
const string livePath = "live";
var liveCasting = context.Request.Path.StartsWithSegments(Constants.LivePath);
if (liveCasting)
{
// ensure this request is for a websocket
if (context.WebSockets.IsWebSocketRequest)
{
if (!context.User.Identity.IsAuthenticated)
context.Response.StatusCode = 403;
else
{
var liveId = long.Parse(context.Request.Path.Value.Substring(Constants.LivePath.Length + 1));
var userId = context.User.GetUserId();
var user = await _dbContext.Users.FirstAsync(u => u.Id == userId);
var uname = user.UserName;
var flow = _dbContext.LiveFlow.Include(f => f.Owner).SingleOrDefault(f => (f.OwnerId == userId && f.Id == liveId));
if (flow == null)
{
_logger.LogWarning("Aborting. Flow info was not found.");
context.Response.StatusCode = 400;
return;
}
var hubContext = GlobalHost.ConnectionManager.GetHubContext<ChatHub>();
hubContext.Clients.All.addPublicStream(new PublicStreamInfo
{
id = flow.Id,
sender = flow.Owner.UserName,
title = flow.Title,
url = flow.GetFileUrl(),
mediaType = flow.MediaType
}, $"{flow.Owner.UserName} is starting a stream!");
string destDir = context.User.InitPostToFileSystem(livePath);
_logger.LogInformation($"Saving flow to {destDir}");
string fileName = flow.GetFileName();
_logger.LogInformation("flow : " + flow.Title + " for " + uname);
FileInfo destFileInfo = new FileInfo(Path.Combine(destDir, fileName));
// this should end :-)
while (destFileInfo.Exists)
{
flow.SequenceNumber++;
fileName = flow.GetFileName();
destFileInfo = new FileInfo(Path.Combine(destDir, fileName));
}
await _liveProcessor.AcceptStream(context, user, destDir, fileName);
}
}
else
{
context.Response.StatusCode = 400;
}
}
else
{
await next();
}
});
#endif
// FIXME
app.UseStatusCodePages();
CheckApp(env, loggerFactory); CheckApp(env, loggerFactory);
} }

@ -10,7 +10,7 @@
<script src="~/js/bootstrap.js"></script> <script src="~/js/bootstrap.js"></script>
<link rel="stylesheet" href="~/css/main/site.css" asp-append-version="true"/> <link rel="stylesheet" href="~/css/main/site.css" asp-append-version="true"/>
<link rel="stylesheet" href="~/css/main/jquery-ui.css" asp-append-version="true"/> <link rel="stylesheet" href="~/css/main/jquery-ui.css" asp-append-version="true"/>
<link rel="alternate stylesheet" title="Dark" href="~/css/dark/site.css" asp-append-version="true" /> <link rel="stylesheet" title="Dark" href="~/css/dark/site.css" asp-append-version="true" />
<link rel="alternate stylesheet" title="Clear" href="~/css/clear/site.css" asp-append-version="true" /> <link rel="alternate stylesheet" title="Clear" href="~/css/clear/site.css" asp-append-version="true" />
<script src="~/js/jquery-ui.js" asp-append-version="true"></script> <script src="~/js/jquery-ui.js" asp-append-version="true"></script>
<script src="~/js/jquery.signalR-2.2.1.js" asp-append-version="true"></script> <script src="~/js/jquery.signalR-2.2.1.js" asp-append-version="true"></script>

@ -5,7 +5,7 @@
body { body {
/* background-color: #04264f; /* background-color: #04264f;
color:#000;*/ color:#000;*/
background-color: #080225; background-color: #0c0813;
color:#999; color:#999;
} }
h1,h2,h3,h4,h5,h6{color:#fff;} h1,h2,h3,h4,h5,h6{color:#fff;}

Loading…