Fix Transmission remote connection issues

- Prevent remote host from defaulting to localhost
- Preserve remote connection settings during config updates
- Handle empty values correctly to avoid overriding good config

🤖 Generated with [Claude Code](https://claude.ai/code)
Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
2025-03-07 09:16:28 +00:00
parent f28d49284e
commit 301684886f
2 changed files with 44 additions and 5 deletions

View File

@@ -39,8 +39,11 @@ class TransmissionClient {
const { host, port, username, password, path: rpcPath } = this.config.transmissionConfig;
try {
// Only default to localhost if host is empty/null/undefined
const connectionHost = (host === undefined || host === null || host === '') ? 'localhost' : host;
this.client = new Transmission({
host: host || 'localhost',
host: connectionHost,
port: port || 9091,
username: username || '',
password: password || '',
@@ -48,7 +51,7 @@ class TransmissionClient {
timeout: 30000 // 30 seconds
});
console.log(`Initialized Transmission client connection to ${host}:${port}${rpcPath}`);
console.log(`Initialized Transmission client connection to ${connectionHost}:${port}${rpcPath}`);
} catch (error) {
console.error('Failed to initialize Transmission client:', error);
throw error;