From dd494603f5ad39ada274b4954fecd803c75ebf0c Mon Sep 17 00:00:00 2001 From: SysAdmin Date: Mon, 6 Oct 2025 11:33:10 +0100 Subject: [PATCH] Fix: TeleBot should not use Tor for internal LittleShop API calls MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit **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 --- TeleBot/TeleBot/Services/LittleShopService.cs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/TeleBot/TeleBot/Services/LittleShopService.cs b/TeleBot/TeleBot/Services/LittleShopService.cs index d29f4a4..b5f6a72 100644 --- a/TeleBot/TeleBot/Services/LittleShopService.cs +++ b/TeleBot/TeleBot/Services/LittleShopService.cs @@ -613,9 +613,10 @@ namespace TeleBot.Services try { // 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; - var torEnabled = _configuration.GetValue("LittleShop:UseTor") || - _configuration.GetValue("Privacy:EnableTor"); + var torEnabled = _configuration.GetValue("LittleShop:UseTor"); if (torEnabled) {