diff --git a/BTCPayServer/Services/BTCPayServerEnvironment.cs b/BTCPayServer/Services/BTCPayServerEnvironment.cs index 0610836ae..c2cd18390 100644 --- a/BTCPayServer/Services/BTCPayServerEnvironment.cs +++ b/BTCPayServer/Services/BTCPayServerEnvironment.cs @@ -14,7 +14,8 @@ namespace BTCPayServer.Services public class BTCPayServerEnvironment { IHttpContextAccessor httpContext; - public BTCPayServerEnvironment(IHostingEnvironment env, BTCPayNetworkProvider provider, IHttpContextAccessor httpContext) + TorServices torServices; + public BTCPayServerEnvironment(IHostingEnvironment env, BTCPayNetworkProvider provider, IHttpContextAccessor httpContext, TorServices torServices) { this.httpContext = httpContext; Version = typeof(BTCPayServerEnvironment).GetTypeInfo().Assembly.GetCustomAttribute().Version; @@ -25,6 +26,7 @@ namespace BTCPayServer.Services #endif Environment = env; NetworkType = provider.NetworkType; + this.torServices = torServices; } public IHostingEnvironment Environment { @@ -34,6 +36,8 @@ namespace BTCPayServer.Services public string ExpectedDomain => httpContext.HttpContext.Request.Host.Host; public string ExpectedHost => httpContext.HttpContext.Request.Host.Value; public string ExpectedProtocol => httpContext.HttpContext.Request.Scheme; + public string OnionUrl => this.torServices.Services.Where(s => s.ServiceType == TorServiceType.BTCPayServer) + .Select(s => $"http://{s.OnionHost}").FirstOrDefault(); public NetworkType NetworkType { get; set; } public string Version diff --git a/BTCPayServer/Views/Shared/_Layout.cshtml b/BTCPayServer/Views/Shared/_Layout.cshtml index 2f963dd94..10280d635 100644 --- a/BTCPayServer/Views/Shared/_Layout.cshtml +++ b/BTCPayServer/Views/Shared/_Layout.cshtml @@ -55,6 +55,14 @@ @env.NetworkType.ToString() } + @if (env.OnionUrl != null) + { + + + + + + } diff --git a/BTCPayServer/wwwroot/img/icons/onion.svg b/BTCPayServer/wwwroot/img/icons/onion.svg new file mode 100644 index 000000000..620729a7e --- /dev/null +++ b/BTCPayServer/wwwroot/img/icons/onion.svg @@ -0,0 +1 @@ +Artboard 1 \ No newline at end of file