From d0fac711fb27e242f73d5edfa16b7046b56df9f4 Mon Sep 17 00:00:00 2001 From: mic Date: Sun, 4 Jan 2026 17:43:39 +0100 Subject: [PATCH] getConnectionType improved. see #604 --- js/mzta-utils.js | 19 ++++++------------- 1 file changed, 6 insertions(+), 13 deletions(-) diff --git a/js/mzta-utils.js b/js/mzta-utils.js index b182ad99..67ce0823 100644 --- a/js/mzta-utils.js +++ b/js/mzta-utils.js @@ -627,25 +627,18 @@ export function isAPIKeyValue(id){ return id.endsWith('_api_key'); } -export function getConnectionType(prefsOrType, prompt, prefixOrSpecific = null) { +export function getConnectionType(prefs, prompt, prefix = null) { let defaultType = ''; let specificType = ''; - if (typeof prefsOrType === 'object' && prefsOrType !== null) { - // New signature: (prefs, prompt, prefix) - defaultType = prefsOrType.connection_type; - if (typeof prefixOrSpecific === 'string' && prefixOrSpecific) { - const prefix = prefixOrSpecific; - const useSpecific = getDynamicSettingValue(prefsOrType, prefix, 'use_specific_integration'); + if (prefs !== null) { + defaultType = prefs.connection_type; + if (typeof prefix === 'string' && prefix) { + const useSpecific = getDynamicSettingValue(prefs, prefix, 'use_specific_integration'); if (useSpecific) { - specificType = getDynamicSettingValue(prefsOrType, prefix, 'connection_type'); + specificType = getDynamicSettingValue(prefs, prefix, 'connection_type'); } } - } else { - // Old signature / Direct usage: (connection_type_string, prompt, [specific_type_string]) - if (typeof prefixOrSpecific === 'string') { - specificType = prefixOrSpecific; - } } if (specificType && specificType !== '') return specificType;