Skip to content

Commit

Permalink
Allow HTTPS connection to server in local network
Browse files Browse the repository at this point in the history
  • Loading branch information
dennisreimann committed Feb 19, 2025
1 parent 96dd48f commit 0b7c25a
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 7 deletions.
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
#if DEBUG

namespace BTCPayApp.Maui;

using System.Net.Security;
using System.Net.WebSockets;
using System.Security.Cryptography.X509Certificates;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.DependencyInjection.Extensions;

namespace BTCPayApp.Core.Extensions;

public class DangerousHttpClientFactory : IHttpClientFactory
{
public static bool ServerValidate(object sender, X509Certificate? certificate, X509Chain? chain, SslPolicyErrors errors)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;

namespace BTCPayApp.Core;
namespace BTCPayApp.Core.Extensions;

public static class StartupExtensions
{
Expand Down Expand Up @@ -46,6 +46,7 @@ public static IServiceCollection ConfigureBTCPayAppCore(this IServiceCollection
serviceCollection.AddLDK();
serviceCollection.AddSingleton<IAuthorizationHandler, AuthorizationHandler>();
serviceCollection.AddAuthorizationCore(options => options.AddPolicies());

return serviceCollection;
}
}
2 changes: 1 addition & 1 deletion BTCPayApp.Maui/MauiProgram.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using BTCPayApp.Core;
using BTCPayApp.Core.Extensions;
using BTCPayApp.UI;
using Microsoft.Extensions.Logging;
using Microsoft.Maui.LifecycleEvents;
Expand Down
6 changes: 5 additions & 1 deletion BTCPayApp.Photino/Program.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using System.Drawing;
using BTCPayApp.Core;
using BTCPayApp.Core.Extensions;
using BTCPayApp.Desktop;
using BTCPayApp.UI;
using Microsoft.AspNetCore.Components.Web;
Expand All @@ -17,7 +18,7 @@ public static class Program
private static void Main(string[] args)
{
var builder = PhotinoBlazorAppBuilder.CreateDefault(args);

builder.Services.TryAddSingleton<IConfiguration>(_ =>
{
var configBuilder = new ConfigurationBuilder();
Expand All @@ -28,6 +29,9 @@ private static void Main(string[] args)
builder.Services.ConfigureBTCPayAppCore();
builder.Services.ConfigureBTCPayAppDesktop();
builder.Services.AddLogging();
#if DEBUG
builder.Services.AddDangerousSSLSettingsForDev();
#endif
builder.RootComponents.Add<App>("#app");
builder.RootComponents.Add<HeadOutlet>("head::after");

Expand Down
6 changes: 4 additions & 2 deletions BTCPayApp.Server/Program.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using BTCPayApp.Core;
using BTCPayApp.Core.Extensions;
using BTCPayApp.Desktop;
using BTCPayApp.UI;

Expand All @@ -11,7 +11,9 @@
builder.Services.ConfigureBTCPayAppCore();
builder.Services.ConfigureBTCPayAppDesktop();
builder.Services.AddLogging();

#if DEBUG
builder.Services.AddDangerousSSLSettingsForDev();
#endif
// Configure the HTTP request pipeline.
var app = builder.Build();
if (!app.Environment.IsDevelopment())
Expand Down
1 change: 1 addition & 0 deletions BTCPayApp.Tests/HeadlessTestNode.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
using BTCPayApp.Core.Auth;
using BTCPayApp.Core.BTCPayServer;
using BTCPayApp.Core.Contracts;
using BTCPayApp.Core.Extensions;
using BTCPayApp.Core.Wallet;
using BTCPayApp.Desktop;
using Laraue.EfCoreTriggers.Common.Extensions;
Expand Down

0 comments on commit 0b7c25a

Please sign in to comment.