Skip to content

Commit

Permalink
Add option to disable IP leak test
Browse files Browse the repository at this point in the history
  • Loading branch information
akuntsch committed Oct 19, 2024
1 parent 2d147c5 commit dd847b4
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 5 deletions.
10 changes: 7 additions & 3 deletions UmlautAdaptarr/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,9 @@ internal class Program
private static void Main(string[] args) {
MainAsync(args).Wait();
}

private static async Task MainAsync(string[] args)
{
Helper.ShowLogo();
Helper.ShowInformation();
// TODO:
// add option to sort by nzb age
var builder = WebApplication.CreateBuilder(args);
Expand All @@ -40,7 +39,7 @@ private static async Task MainAsync(string[] args)
// TODO cache size limit? option?
//options.SizeLimit = 20000;
});

builder.Services.AllowResolvingKeyedServicesAsDictionary();
builder.Services.AddControllers();
builder.AddTitleLookupService();
Expand All @@ -56,6 +55,11 @@ private static async Task MainAsync(string[] args)
builder.Services.AddSingleton<IHostedService, HttpProxyService>();

var app = builder.Build();

if (app.Configuration.GetValue<bool>("IpLeakTest:Enabled")) {
Helper.ShowLogo();
await Helper.ShowInformation();
}

GlobalStaticLogger.Initialize(app.Services.GetService<ILoggerFactory>()!);
app.UseHttpsRedirection();
Expand Down
4 changes: 2 additions & 2 deletions UmlautAdaptarr/Utilities/Helper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ public static void ShowLogo()
"\r\n _ _ _ _ ___ _ _ \r\n| | | | | | | | / _ \\ | | | | \r\n| | | |_ __ ___ | | __ _ _ _| |_/ /_\\ \\ __| | __ _ _ __ | |_ __ _ _ __ _ __ \r\n| | | | '_ ` _ \\| |/ _` | | | | __| _ |/ _` |/ _` | '_ \\| __/ _` | '__| '__|\r\n| |_| | | | | | | | (_| | |_| | |_| | | | (_| | (_| | |_) | || (_| | | | | \r\n \\___/|_| |_| |_|_|\\__,_|\\__,_|\\__\\_| |_/\\__,_|\\__,_| .__/ \\__\\__,_|_| |_| \r\n | | \r\n |_| \r\n");
}

public static void ShowInformation()
public static async Task ShowInformation()
{
Console.WriteLine("--------------------------[IP Leak Test]-----------------------------");
var ipInfo = GetPublicIpAddressInfoAsync().GetAwaiter().GetResult();
var ipInfo = await GetPublicIpAddressInfoAsync();

if (ipInfo != null)
{
Expand Down
3 changes: 3 additions & 0 deletions UmlautAdaptarr/appsettings.json
Original file line number Diff line number Diff line change
Expand Up @@ -64,5 +64,8 @@
"Enabled": false,
"Host": "your_readarr_host_url",
"ApiKey": "your_readarr_api_key"
},
"IpLeakTest": {
"Enabled": true
}
}

0 comments on commit dd847b4

Please sign in to comment.