mirror of
https://github.com/tgstation/tgstation-server.git
synced 2026-08-28 23:52:36 +01:00
Do not browser redirect / if headers are present
This commit is contained in:
@@ -161,15 +161,16 @@ namespace Tgstation.Server.Host.Controllers
|
||||
#pragma warning disable CA1506
|
||||
public async Task<IActionResult> Home(CancellationToken cancellationToken)
|
||||
{
|
||||
// if we are using a browser and the control panel, soft redirect to the app page
|
||||
if (controlPanelConfiguration.Enable && browserResolver.Browser.Type != BrowserType.Generic)
|
||||
{
|
||||
Logger.LogDebug("Unauthorized browser request (User-Agent: \"{0}\"), redirecting to control panel...", browserResolver.UserAgent);
|
||||
return Redirect(Core.Application.ControlPanelRoute);
|
||||
}
|
||||
|
||||
// we only allow authorization header issues
|
||||
if (ApiHeaders == null)
|
||||
{
|
||||
// if we are using a browser and the control panel, soft redirect to the app page
|
||||
if (controlPanelConfiguration.Enable && browserResolver.Browser.Type != BrowserType.Generic)
|
||||
{
|
||||
Logger.LogDebug("Unauthorized browser request (User-Agent: \"{0}\"), redirecting to control panel...", browserResolver.UserAgent);
|
||||
return Redirect(Core.Application.ControlPanelRoute);
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
var headers = new ApiHeaders(Request.GetTypedHeaders(), true);
|
||||
@@ -182,6 +183,7 @@ namespace Tgstation.Server.Host.Controllers
|
||||
{
|
||||
return HeadersIssue(true);
|
||||
}
|
||||
}
|
||||
|
||||
return Json(new ServerInformation
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user