Skip to content

Commit 75f9686

Browse files
committed
Merge dev: Fix GitHub issue #626 - 2FA verification bug in recovery key generation and version display improvements
2 parents 8844318 + 55db36d commit 75f9686

File tree

21 files changed

+678
-294
lines changed

21 files changed

+678
-294
lines changed

frontend/static/js/apps.js

Lines changed: 34 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -254,6 +254,22 @@ const appsModule = {
254254
SettingsForms.updateDurationDisplay();
255255
}
256256

257+
// Explicitly ensure connection status checking is set up for all supported apps
258+
const supportedApps = ['radarr', 'sonarr', 'lidarr', 'readarr', 'whisparr', 'eros'];
259+
if (supportedApps.includes(app) && typeof SettingsForms.setupInstanceManagement === 'function') {
260+
// Find the instances container and set up connection status checking
261+
const instancesContainer = formElement.querySelector('.instances-container');
262+
if (instancesContainer) {
263+
const instanceCount = appSettings.instances ? appSettings.instances.length : 0;
264+
console.log(`[Apps] Setting up connection status checking for ${app} with ${instanceCount} instances`);
265+
SettingsForms.setupInstanceManagement(instancesContainer.parentElement, app, instanceCount);
266+
} else {
267+
console.warn(`[Apps] No instances container found for ${app}, connection status checking may not work`);
268+
}
269+
} else {
270+
console.log(`[Apps] Skipping connection status setup for ${app} (supported: ${supportedApps.includes(app)}, function available: ${typeof SettingsForms.setupInstanceManagement})`);
271+
}
272+
257273
// Store original form values after form is generated
258274
this.storeOriginalFormValues(appPanel);
259275

@@ -281,18 +297,18 @@ const appsModule = {
281297
console.log(`Adding form change listeners to form with app type: ${form.getAttribute('data-app-type')}`);
282298

283299
// Function to handle form element changes
284-
const handleChange = () => {
300+
const handleChange = (event) => {
285301
// Skip if test connection suppression is active
286-
if (window._suppressUnsavedChangesDialog === true) {
287-
console.log('Change detection suppressed due to test connection');
302+
if (window._suppressUnsavedChangesDialog === true || window._appsSuppressChangeDetection === true) {
303+
console.log(`[Apps] Change detection suppressed due to test connection or status updates (element: ${event?.target?.id || 'unknown'})`);
288304
return;
289305
}
290306

291307
if (this.hasFormChanges(form)) {
292-
console.log('Form changed, enabling save button');
308+
console.log(`[Apps] Form changed, enabling save button (triggered by: ${event?.target?.id || 'unknown'})`);
293309
this.markAppsAsChanged();
294310
} else {
295-
console.log('No actual changes, save button remains disabled');
311+
console.log(`[Apps] No actual changes, save button remains disabled (event from: ${event?.target?.id || 'unknown'})`);
296312
}
297313
};
298314

@@ -353,6 +369,10 @@ const appsModule = {
353369
)) {
354370
isTestRelated = true;
355371
}
372+
// Also check for status elements by ID pattern
373+
if (node.id && node.id.includes('-status-')) {
374+
isTestRelated = true;
375+
}
356376
}
357377
});
358378

@@ -366,6 +386,10 @@ const appsModule = {
366386
)) {
367387
isTestRelated = true;
368388
}
389+
// Also check for status elements by ID pattern
390+
if (node.id && node.id.includes('-status-')) {
391+
isTestRelated = true;
392+
}
369393
}
370394
});
371395

@@ -378,17 +402,17 @@ const appsModule = {
378402

379403
if (shouldUpdate) {
380404
// Skip if test connection suppression is active
381-
if (window._suppressUnsavedChangesDialog === true) {
382-
console.log('MutationObserver suppressed due to test connection');
405+
if (window._suppressUnsavedChangesDialog === true || window._appsSuppressChangeDetection === true) {
406+
console.log(`[Apps] MutationObserver suppressed due to test connection or status updates (flags: _suppressUnsavedChangesDialog=${window._suppressUnsavedChangesDialog}, _appsSuppressChangeDetection=${window._appsSuppressChangeDetection})`);
383407
return;
384408
}
385409

386-
console.log('Instances container changed - checking for form changes');
410+
console.log('[Apps] Instances container changed - checking for form changes');
387411
if (this.hasFormChanges(form)) {
388-
console.log('Form changed, enabling save button');
412+
console.log('[Apps] Form changed via MutationObserver, enabling save button');
389413
this.markAppsAsChanged();
390414
} else {
391-
console.log('No actual changes, save button remains disabled');
415+
console.log('[Apps] No actual changes via MutationObserver, save button remains disabled');
392416
}
393417
}
394418
});

frontend/static/js/new-main.js

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2450,13 +2450,25 @@ let huntarrUI = {
24502450
const versionElement = document.getElementById('version-value');
24512451
if (versionElement) {
24522452
versionElement.textContent = version.trim();
2453+
versionElement.style.display = 'inline'; // Show the element
2454+
}
2455+
2456+
// Store in localStorage for topbar access
2457+
try {
2458+
const versionInfo = localStorage.getItem('huntarr-version-info') || '{}';
2459+
const parsedInfo = JSON.parse(versionInfo);
2460+
parsedInfo.currentVersion = version.trim();
2461+
localStorage.setItem('huntarr-version-info', JSON.stringify(parsedInfo));
2462+
} catch (e) {
2463+
console.error('Error saving current version to localStorage:', e);
24532464
}
24542465
})
24552466
.catch(error => {
24562467
console.error('Error loading current version:', error);
24572468
const versionElement = document.getElementById('version-value');
24582469
if (versionElement) {
24592470
versionElement.textContent = 'Error';
2471+
versionElement.style.display = 'inline'; // Show the element even on error
24602472
}
24612473
});
24622474
},
@@ -2479,16 +2491,29 @@ let huntarrUI = {
24792491
const latestVersionElement = document.getElementById('latest-version-value');
24802492
if (latestVersionElement && data && data.tag_name) {
24812493
// Remove potential 'v' prefix for consistency if needed, or keep it
2482-
latestVersionElement.textContent = data.tag_name;
2494+
latestVersionElement.textContent = data.tag_name;
2495+
latestVersionElement.style.display = 'inline'; // Show the element
2496+
2497+
// Store in localStorage for topbar access
2498+
try {
2499+
const versionInfo = localStorage.getItem('huntarr-version-info') || '{}';
2500+
const parsedInfo = JSON.parse(versionInfo);
2501+
parsedInfo.latestVersion = data.tag_name;
2502+
localStorage.setItem('huntarr-version-info', JSON.stringify(parsedInfo));
2503+
} catch (e) {
2504+
console.error('Error saving latest version to localStorage:', e);
2505+
}
24832506
} else if (latestVersionElement) {
24842507
latestVersionElement.textContent = 'N/A';
2508+
latestVersionElement.style.display = 'inline'; // Show the element
24852509
}
24862510
})
24872511
.catch(error => {
24882512
console.error('Error loading latest version from GitHub:', error);
24892513
const latestVersionElement = document.getElementById('latest-version-value');
24902514
if (latestVersionElement) {
24912515
latestVersionElement.textContent = error.message === 'Rate limited' ? 'Rate Limited' : 'Error';
2516+
latestVersionElement.style.display = 'inline'; // Show the element even on error
24922517
}
24932518
});
24942519
},

0 commit comments

Comments
 (0)