- Fix repair bugs

- Minor html/js bugs from new template
- Other minor issues
This commit is contained in:
Mukhtar Akere
2025-07-13 06:30:02 +01:00
parent 604402250e
commit afe577bf2f
13 changed files with 54 additions and 62 deletions

View File

@@ -534,17 +534,21 @@ func (r *Repair) checkMountUp(media []arr.Content) error {
if len(files) == 0 {
return fmt.Errorf("no files found in media %s", firstMedia.Title)
}
firstFile := files[0]
symlinkPath := getSymlinkTarget(firstFile.Path)
if symlinkPath == "" {
return fmt.Errorf("no symlink target found for %s", firstFile.Path)
}
r.logger.Debug().Msgf("Checking symlink parent directory for %s", symlinkPath)
parentSymlink := filepath.Dir(filepath.Dir(symlinkPath)) // /mnt/zurg/torrents/movie/movie.mkv -> /mnt/zurg/torrents
if _, err := os.Stat(parentSymlink); os.IsNotExist(err) {
return fmt.Errorf("parent directory %s not accessible for %s", parentSymlink, firstFile.Path)
for _, file := range files {
if _, err := os.Stat(file.Path); os.IsNotExist(err) {
// If the file does not exist, we can't check the symlink target
r.logger.Debug().Msgf("File %s does not exist, skipping repair", file.Path)
return fmt.Errorf("file %s does not exist, skipping repair", file.Path)
}
// Get the symlink target
symlinkPath := getSymlinkTarget(file.Path)
if symlinkPath != "" {
r.logger.Trace().Msgf("Found symlink target for %s: %s", file.Path, symlinkPath)
if _, err := os.Stat(symlinkPath); os.IsNotExist(err) {
r.logger.Debug().Msgf("Symlink target %s does not exist, skipping repair", symlinkPath)
return fmt.Errorf("symlink target %s does not exist for %s. skipping repair", symlinkPath, file.Path)
}
}
}
return nil
}

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -388,7 +388,7 @@ class ConfigManager {
</label>
<input type="number" class="input input-bordered webdav-field"
name="debrid[${index}].workers" id="debrid[${index}].workers"
placeholder="50" value="50">
placeholder="50">
<div class="label">
<span class="label-text-alt">Number of concurrent workers</span>
</div>
@@ -1201,9 +1201,4 @@ class ConfigManager {
}
}
}
}
// Initialize when DOM is ready
document.addEventListener('DOMContentLoaded', () => {
window.configManager = new ConfigManager();
});
}

View File

@@ -556,9 +556,4 @@ class TorrentDashboard {
};
return text ? text.replace(/[&<>"']/g, (m) => map[m]) : '';
}
}
// Initialize dashboard when DOM is ready
document.addEventListener('DOMContentLoaded', () => {
window.dashboard = new TorrentDashboard();
});
}

View File

@@ -1,7 +1,7 @@
// Download page functionality
class DownloadManager {
constructor() {
this.downloadFolder = '{{ .DownloadFolder }}' || '';
constructor(downloadFolder) {
this.downloadFolder = downloadFolder;
this.refs = {
downloadForm: document.getElementById('downloadForm'),
magnetURI: document.getElementById('magnetURI'),
@@ -242,9 +242,4 @@ class DownloadManager {
window.decypharrUtils.createToast('Please drop .torrent files only', 'warning');
}
}
}
// Initialize download manager when DOM is ready
document.addEventListener('DOMContentLoaded', () => {
window.downloadManager = new DownloadManager();
});
}

View File

@@ -130,11 +130,6 @@ class RepairManager {
const arr = this.refs.arrSelect.value;
const mediaIdsValue = this.refs.mediaIds.value.trim();
if (!arr) {
window.decypharrUtils.createToast('Please select an Arr instance', 'warning');
return;
}
const mediaIds = mediaIdsValue ?
mediaIdsValue.split(',').map(id => id.trim()).filter(Boolean) :
[];
@@ -1105,15 +1100,4 @@ const RepairUtils = {
default: return 0;
}
}
};
// Initialize repair manager when DOM is ready
document.addEventListener('DOMContentLoaded', () => {
window.repairManager = new RepairManager();
window.RepairUtils = RepairUtils;
});
// Export for ES6 modules if needed
if (typeof module !== 'undefined' && module.exports) {
module.exports = { RepairManager, RepairUtils };
}
};

View File

@@ -350,6 +350,7 @@
<script>
// Tab Navigation Handler
document.addEventListener('DOMContentLoaded', function() {
window.configManager = new ConfigManager();
const tabButtons = document.querySelectorAll('.tab-button');
const tabContents = document.querySelectorAll('.tab-content');

View File

@@ -138,4 +138,10 @@
</div>
</div>
</div>
<script>
document.addEventListener('DOMContentLoaded', () => {
let downloadFolder = "{{ .DownloadFolder }}" || '';
window.downloadManager = new DownloadManager(downloadFolder);
});
</script>
{{ end }}

View File

@@ -134,4 +134,10 @@
<i class="bi bi-trash"></i>Delete Torrent
</a></li>
</ul>
<script>
document.addEventListener('DOMContentLoaded', () => {
window.dashboard = new TorrentDashboard();
});
</script>
{{ end }}

View File

@@ -17,7 +17,7 @@
<i class="bi bi-collection mr-2 text-secondary"></i>Arr Instance
</span>
</label>
<select class="select select-bordered" id="arrSelect" required>
<select class="select select-bordered" id="arrSelect">
<option value="">Select an Arr instance</option>
</select>
<div class="label">
@@ -171,14 +171,6 @@
<h3 class="font-bold text-2xl">
<i class="bi bi-info-circle mr-2 text-primary"></i>Job Details
</h3>
<div class="flex gap-2">
<button type="button" class="btn btn-primary btn-sm hidden" id="processJobBtn">
<i class="bi bi-play-fill mr-1"></i>Process
</button>
<button type="button" class="btn btn-warning btn-sm hidden" id="stopJobBtn">
<i class="bi bi-stop-fill mr-1"></i>Stop
</button>
</div>
</div>
<div class="space-y-6">
@@ -322,7 +314,21 @@
<div class="flex-1">
<small class="text-base-content/60" id="modalFooterStats">-</small>
</div>
<div class="flex gap-2">
<button type="button" class="btn btn-primary btn-sm hidden" id="processJobBtn">
<i class="bi bi-play-fill mr-1"></i>Process
</button>
<button type="button" class="btn btn-warning btn-sm hidden" id="stopJobBtn">
<i class="bi bi-stop-fill mr-1"></i>Stop
</button>
</div>
</div>
</div>
</dialog>
<script>
document.addEventListener('DOMContentLoaded', () => {
window.repairManager = new RepairManager();
window.RepairUtils = RepairUtils;
});
</script>
{{ end }}