7eb2b445cb
- Major query performance boost: replaced correlated subqueries with DistinctBy() in BaseItemRepository, added episode deduplication index, and increased default command timeout to 120s. - Fixed LibraryMonitor shutdown race: added disposal checks and exception handling in FileRefresher to prevent ObjectDisposedException. - Added PowerShell and SQL utilities for fixing Linux paths in config files and database; new scripts for WebDir and path migration. - Auto-fix for WebDir in startup.json on load; new helper scripts and docs. - Added automated weekly DB performance monitoring scripts and reporting. - Expanded documentation and README for all fixes, scripts, and migration steps. - Updated SQL scripts for index creation and diagnostics; improved output handling. - Updated db-config defaults and added new diagnostic/report files.
3.6 KiB
3.6 KiB
Fix: startup.json Still Has Wrong WebDir
Problem
After fixing the code, startup.json is still created with:
"WebDir": "C:/ProgramData/jellyfin/wwwroot"
Instead of:
"WebDir": "wwwroot"
Root Cause
The fix in StartupHelpers.cs (line 141) only affects newly created files. If startup.json already exists in one of these locations, it won't be recreated:
- Current directory:
D:\Projects\pgsql-jellyfin\startup.json - Application directory:
bin\Debug\net11.0\startup.json - Config directory:
bin\Debug\net11.0\config\startup.json
Solutions
Solution 1: Delete Existing startup.json (Quickest)
Delete the existing startup.json file and let Jellyfin recreate it with correct values:
# Find and delete startup.json files
Remove-Item -Path ".\startup.json" -ErrorAction SilentlyContinue
Remove-Item -Path ".\bin\Debug\net11.0\startup.json" -ErrorAction SilentlyContinue
Remove-Item -Path ".\bin\Debug\net11.0\config\startup.json" -ErrorAction SilentlyContinue
Remove-Item -Path ".\bin\Release\net11.0\startup.json" -ErrorAction SilentlyContinue
Remove-Item -Path ".\bin\Release\net11.0\config\startup.json" -ErrorAction SilentlyContinue
Write-Host "Deleted existing startup.json files. Run Jellyfin to recreate with correct paths."
Solution 2: Edit Existing startup.json Manually
- Find the file:
startup.json - Open in a text editor
- Change:
To:
"WebDir": "C:/ProgramData/jellyfin/wwwroot""WebDir": "wwwroot" - Save
Solution 3: PowerShell Script to Fix All Instances
# Fix WebDir in all startup.json files
$files = Get-ChildItem -Path . -Recurse -Filter "startup.json" -ErrorAction SilentlyContinue
foreach ($file in $files) {
Write-Host "Checking: $($file.FullName)"
$content = Get-Content $file.FullName -Raw
# Check if it has the wrong path
if ($content -match '"WebDir":\s*"C:/ProgramData/jellyfin/wwwroot"') {
Write-Host " -> Found incorrect WebDir, fixing..." -ForegroundColor Yellow
# Backup
Copy-Item $file.FullName "$($file.FullName).backup"
# Fix it
$newContent = $content -replace '"WebDir":\s*"C:/ProgramData/jellyfin/wwwroot"', '"WebDir": "wwwroot"'
Set-Content -Path $file.FullName -Value $newContent
Write-Host " -> Fixed! (Backup created)" -ForegroundColor Green
} else {
Write-Host " -> Already correct" -ForegroundColor Green
}
}
Write-Host ""
Write-Host "Done! Rebuild and run Jellyfin." -ForegroundColor Cyan
Solution 4: Add Code to Auto-Fix on Startup (Most Robust)
Add code to automatically update incorrect paths when loading the config file. This ensures old config files are fixed automatically.
I can implement this in StartupHelpers.cs if you want.
Verification
After applying a fix, check your startup.json:
Get-Content startup.json | Select-String "WebDir"
Should show:
"WebDir": "wwwroot"
Not:
"WebDir": "C:/ProgramData/jellyfin/wwwroot"
Why This Matters
Using relative path "wwwroot" instead of absolute path:
- ✅ Makes installation portable
- ✅ Works regardless of where Jellyfin is installed
- ✅ Matches the template file
startup.json.windows - ✅ Consistent with other platforms
Next Steps
- Choose a solution above (I recommend Solution 1 - delete and recreate)
- Rebuild the project
- Run Jellyfin
- Verify the new
startup.jsonhas"WebDir": "wwwroot"
Would you like me to implement Solution 4 (auto-fix code) to prevent this issue in the future?