mirror of
https://github.com/btcpayserver/btcpayserver.git
synced 2025-02-22 22:25:28 +01:00
Merge pull request #2180 from btcpayserver/attempt-onion-modal-fix
Do not tell tor browser to redirect if invoice is loaded as a modal
This commit is contained in:
commit
a38a4d6f69
1 changed files with 8 additions and 1 deletions
|
@ -58,7 +58,14 @@ namespace BTCPayServer.Hosting
|
|||
return;
|
||||
}
|
||||
|
||||
if (!httpContext.Request.IsOnion() && (httpContext.Request.Headers["Accept"].ToString().StartsWith("text/html", StringComparison.InvariantCulture)))
|
||||
var isHtml = httpContext.Request.Headers.TryGetValue("Accept", out var accept)
|
||||
&& accept.ToString().StartsWith("text/html", StringComparison.OrdinalIgnoreCase);
|
||||
var isModal = httpContext.Request.Query.TryGetValue("view", out var view)
|
||||
&& view.ToString().Equals("modal", StringComparison.OrdinalIgnoreCase);
|
||||
if (!string.IsNullOrEmpty(_Env.OnionUrl) &&
|
||||
!httpContext.Request.IsOnion() &&
|
||||
isHtml &&
|
||||
!isModal)
|
||||
{
|
||||
var onionLocation = _Env.OnionUrl + httpContext.Request.GetEncodedPathAndQuery();
|
||||
httpContext.Response.SetHeader("Onion-Location", onionLocation);
|
||||
|
|
Loading…
Add table
Reference in a new issue