feat: HTTP/SOCKS Proxy-Support für alle HttpClient-Requests
- Program.cs: ProxyUrl aus Config lesen, WebProxy auf allen HttpClients via ConfigureHttpClientDefaults - ServerSettingsEndpoint: ProxyUrl Setting im Frontend (Text-Feld) - appsettings.json: ProxyUrl Default (leer = kein Proxy) - Unterstützt HTTP und SOCKS5 Proxies (z.B. socks5://127.0.0.1:1080) - Betrifft alle ausgehenden Requests: Anthropic, OpenAI, GitHub, Serper, Telegram, Krea
This commit is contained in:
1 parent
192f41e91e
commit
cc46cf2bbc
3 files changed
+18
-2
No files matched your search
@@ -33,6 +33,7 @@ public static class ServerSettingsEndpoint
|
||||
new SettingDefinition("KreaApiKey", "string", "", "API-Key für Krea-Endpoints (Automation)", "password"),
|
||||
new SettingDefinition("GitHubToken", "string", "", "GitHub PAT für Key-Scanner", "password"),
|
||||
new SettingDefinition("SerperApiKey", "string", "", "Serper.dev API-Key für Google-Suche (Key-Scanner)", "password"),
|
||||
new SettingDefinition("ProxyUrl", "string", "", "HTTP/SOCKS Proxy für alle Requests (z.B. socks5://127.0.0.1:1080)", "text"),
|
||||
new SettingDefinition("ScanIntervalHours", "int", 0, "Key-Scanner Intervall in Stunden (0 = nur manuell)", "number"),
|
||||
};
|
||||
|
||||
|
||||
+15
-1
@@ -1,5 +1,6 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Net;
|
||||
using System.Net.Http;
|
||||
using System.Runtime.InteropServices;
|
||||
using Gott.Endpoints;
|
||||
@@ -15,7 +16,20 @@ var builder = WebApplication.CreateBuilder(args);
|
||||
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
|
||||
builder.Services.AddWindowsService();
|
||||
|
||||
builder.Services.AddHttpClient();
|
||||
var proxyUrl = builder.Configuration["ProxyUrl"];
|
||||
if (!string.IsNullOrWhiteSpace(proxyUrl))
|
||||
{
|
||||
builder.Services.AddHttpClient().ConfigureHttpClientDefaults(b =>
|
||||
b.ConfigurePrimaryHttpMessageHandler(() => new HttpClientHandler
|
||||
{
|
||||
Proxy = new WebProxy(proxyUrl),
|
||||
UseProxy = true
|
||||
}));
|
||||
}
|
||||
else
|
||||
{
|
||||
builder.Services.AddHttpClient();
|
||||
}
|
||||
|
||||
var dataDir = Path.Combine(AppContext.BaseDirectory, "data");
|
||||
Directory.CreateDirectory(dataDir);
|
||||
|
||||
+2
-1
@@ -18,5 +18,6 @@
|
||||
"GeminiApiKey": "",
|
||||
"GitHubToken": "",
|
||||
"SerperApiKey": "",
|
||||
"ScanIntervalHours": 0
|
||||
"ScanIntervalHours": 0,
|
||||
"ProxyUrl": ""
|
||||
}
|
||||
Reference in new issue
Block a user