Fix: TeleBot should not use Tor for internal LittleShop API calls

**Problem**:
- GetAvailableCurrenciesAsync() was routing internal API calls through Tor
- Caused SOCKS connection failures: "SOCKS server failed to connect"
- Internal Docker network calls don't need Tor privacy layer

**Root Cause**:
- Line 617-618 used OR logic: LittleShop:UseTor OR Privacy:EnableTor
- Production config: LittleShop__UseTor=false, Privacy__EnableTor=true
- OR condition meant Tor was enabled for all API calls

**Solution**:
- Only check LittleShop:UseTor (explicitly for API calls)
- Privacy:EnableTor now only affects external Telegram API calls
- Internal calls (http://littleshop:5000) bypass Tor completely

**Benefits**:
- No more SOCKS connection errors
- Faster internal API responses (no Tor overhead)
- Tor still protects external Telegram communications

**File**: TeleBot/TeleBot/Services/LittleShopService.cs:619

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
SysAdmin 2025-10-06 11:33:10 +01:00
parent 9206067e9c
commit dd494603f5

View File

@ -613,9 +613,10 @@ namespace TeleBot.Services
try try
{ {
// Create HttpClient with TOR support if enabled // Create HttpClient with TOR support if enabled
// Note: Only use Tor for LittleShop API if explicitly enabled via LittleShop:UseTor
// Privacy:EnableTor should only affect external Telegram API calls, not internal Docker network calls
HttpClient httpClient; HttpClient httpClient;
var torEnabled = _configuration.GetValue<bool>("LittleShop:UseTor") || var torEnabled = _configuration.GetValue<bool>("LittleShop:UseTor");
_configuration.GetValue<bool>("Privacy:EnableTor");
if (torEnabled) if (torEnabled)
{ {