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:
@@ -468,9 +468,45 @@ app.post('/api/config', authenticateJWT, async (req, res) => {
|
||||
// Merge the new config with the existing one
|
||||
const newConfig = { ...config, ...req.body };
|
||||
|
||||
// Keep passwords if they're not provided
|
||||
if (newConfig.transmissionConfig && !newConfig.transmissionConfig.password && config.transmissionConfig) {
|
||||
newConfig.transmissionConfig.password = config.transmissionConfig.password;
|
||||
// Preserve existing Transmission configuration values when not explicitly provided
|
||||
if (newConfig.transmissionConfig && config.transmissionConfig) {
|
||||
// First create a copy of the existing configuration
|
||||
const preservedTransConfig = { ...config.transmissionConfig };
|
||||
|
||||
// Only update values that are explicitly provided and not empty
|
||||
if (!req.body.transmissionConfig?.host) {
|
||||
newConfig.transmissionConfig.host = preservedTransConfig.host;
|
||||
}
|
||||
|
||||
if (!req.body.transmissionConfig?.port) {
|
||||
newConfig.transmissionConfig.port = preservedTransConfig.port;
|
||||
}
|
||||
|
||||
if (!req.body.transmissionConfig?.path) {
|
||||
newConfig.transmissionConfig.path = preservedTransConfig.path;
|
||||
}
|
||||
|
||||
if (!req.body.transmissionConfig?.username) {
|
||||
newConfig.transmissionConfig.username = preservedTransConfig.username;
|
||||
}
|
||||
|
||||
// Always preserve password if not provided
|
||||
if (!newConfig.transmissionConfig.password) {
|
||||
newConfig.transmissionConfig.password = preservedTransConfig.password;
|
||||
}
|
||||
}
|
||||
|
||||
// Preserve remote configuration settings if not explicitly provided
|
||||
if (newConfig.remoteConfig && config.remoteConfig) {
|
||||
// Make sure isRemote setting is preserved if not explicitly set
|
||||
if (req.body.remoteConfig?.isRemote === undefined) {
|
||||
newConfig.remoteConfig.isRemote = config.remoteConfig.isRemote;
|
||||
}
|
||||
|
||||
// Preserve directory mappings if not provided
|
||||
if (!req.body.remoteConfig?.directoryMapping && config.remoteConfig.directoryMapping) {
|
||||
newConfig.remoteConfig.directoryMapping = { ...config.remoteConfig.directoryMapping };
|
||||
}
|
||||
}
|
||||
|
||||
// Keep user passwords
|
||||
|
||||
Reference in New Issue
Block a user