refactor: overhaul NFO settings UI and backend

- Rework nfo-settings page with improved styling and layout
- Update edit-modal and context-menu with enhanced functionality
- Refactor NFO API endpoints and models
- Remove deprecated test_nfo_diagnostics_repair.py
- Clean up tasks.md documentation
This commit is contained in:
2026-06-20 20:32:46 +02:00
parent 7a1b2e565e
commit a8e54876e3
11 changed files with 2107 additions and 1708 deletions

View File

@@ -71,6 +71,10 @@ AniWorld.ContextMenu = (function() {
<i class="fa-solid fa-pen-to-square"></i>
<span>Edit Metadata</span>
</div>
<div class="context-menu-item" data-action="nfo-diagnostics">
<i class="fa-solid fa-file-circle-check"></i>
<span>NFO Diagnostics</span>
</div>
`;
document.body.appendChild(menuElement);
@@ -102,6 +106,13 @@ AniWorld.ContextMenu = (function() {
AniWorld.EditModal.open(currentSeriesKey);
}
});
// NFO Diagnostics - opens the full NFO settings page
menuElement.querySelector('[data-action="nfo-diagnostics"]').addEventListener('click', function() {
hide();
// Navigate to NFO settings page with this series selected
window.location.href = '/settings/nfo?key=' + encodeURIComponent(currentSeriesKey);
});
}
/**

View File

@@ -36,12 +36,13 @@ AniWorld.EditModal = (function() {
hideKeyWarning();
try {
// Try to find series data from the local series list first
let seriesData = findSeriesData(seriesKey);
// Always fetch fresh data from API for edit modal to ensure accuracy
// This is more reliable than local cache which may be stale or missing
let seriesData = await fetchSeriesDetails(seriesKey);
// If not found locally, fetch from API
// Fallback: try local data if API fails
if (!seriesData) {
seriesData = await fetchSeriesDetails(seriesKey);
seriesData = findSeriesData(seriesKey);
}
originalData = {
@@ -384,6 +385,7 @@ AniWorld.EditModal = (function() {
function renderDiagnostics(data) {
const badge = document.getElementById('nfo-status-badge');
const tagsList = document.getElementById('nfo-missing-tags');
const pathDisplay = document.getElementById('nfo-path-display');
if (badge) {
if (!data.has_nfo) {
@@ -398,6 +400,19 @@ AniWorld.EditModal = (function() {
}
}
// Show NFO path if available
if (pathDisplay) {
if (data.nfo_path) {
// Extract just the relative path from the full path
const parts = data.nfo_path.split('/');
const relativePath = parts.slice(-3).join('/'); // folder/tvshow.nfo
pathDisplay.textContent = relativePath;
pathDisplay.title = data.nfo_path;
} else {
pathDisplay.textContent = '';
}
}
if (tagsList) {
if (data.missing_tags.length === 0) {
tagsList.innerHTML = '<p class="nfo-all-good">All required tags present</p>';

File diff suppressed because it is too large Load Diff