feat(repo): add request plugin with jellyfin catalog manifest
Ship the plugin sources, release zip, and SeerrFin-style manifest.json so Jellyfin can install from the Gitea raw repository URL. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
1 parent
3a1960d860
commit
bf6cd4540f
30 files changed
+3096
No files matched your search
@@ -0,0 +1,53 @@
|
||||
param(
|
||||
[string]$IndexPath = ""
|
||||
)
|
||||
|
||||
$ErrorActionPreference = "Stop"
|
||||
|
||||
$loaderSrc = "/Requests/Assets/nav-loader.js"
|
||||
$markerStart = "<!-- jellyfin-plugin-request-nav-start -->"
|
||||
$markerEnd = "<!-- jellyfin-plugin-request-nav-end -->"
|
||||
|
||||
if (-not $IndexPath) {
|
||||
$candidates = @(
|
||||
(Join-Path $env:LOCALAPPDATA "jellyfin\jellyfin-web\index.html"),
|
||||
"C:\Program Files\Jellyfin\Server\jellyfin-web\index.html",
|
||||
"C:\ProgramData\Jellyfin\Server\jellyfin-web\index.html"
|
||||
)
|
||||
foreach ($candidate in $candidates) {
|
||||
if (Test-Path $candidate) {
|
||||
$IndexPath = $candidate
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (-not $IndexPath -or -not (Test-Path $IndexPath)) {
|
||||
Write-Error "Could not find jellyfin-web index.html. Pass -IndexPath explicitly."
|
||||
}
|
||||
|
||||
$html = Get-Content -Raw -Path $IndexPath
|
||||
if ($html -like "*$loaderSrc*") {
|
||||
Write-Host "Request web loader is already installed in $IndexPath"
|
||||
exit 0
|
||||
}
|
||||
|
||||
$backupPath = "$IndexPath.bak.request.$(Get-Date -Format 'yyyyMMddHHmmss')"
|
||||
Copy-Item -Path $IndexPath -Destination $backupPath
|
||||
|
||||
$block = @"
|
||||
$markerStart
|
||||
<script src="$loaderSrc" defer></script>
|
||||
$markerEnd
|
||||
"@
|
||||
|
||||
if ($html -match '(?i)</body>') {
|
||||
$updated = [regex]::Replace($html, '(?i)</body>', ($block + "`r`n</body>"), 1)
|
||||
} else {
|
||||
$updated = $html + "`r`n" + $block + "`r`n"
|
||||
}
|
||||
|
||||
Set-Content -Path $IndexPath -Value $updated -NoNewline
|
||||
Write-Host "Installed Request web loader in $IndexPath"
|
||||
Write-Host "Backup saved to $backupPath"
|
||||
Write-Host "Restart Jellyfin, then hard refresh the browser."
|
||||
@@ -0,0 +1,75 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
loader_src="/Requests/Assets/nav-loader.js"
|
||||
marker_start="<!-- jellyfin-plugin-request-nav-start -->"
|
||||
marker_end="<!-- jellyfin-plugin-request-nav-end -->"
|
||||
|
||||
usage() {
|
||||
cat <<EOF
|
||||
Usage: sudo bash scripts/install-web-loader.sh [path-to-index.html]
|
||||
|
||||
Injects the Request nav loader into jellyfin-web index.html.
|
||||
EOF
|
||||
}
|
||||
|
||||
index_path="${1:-}"
|
||||
if [ -z "$index_path" ]; then
|
||||
for candidate in \
|
||||
/usr/share/jellyfin/web/index.html \
|
||||
/usr/lib/jellyfin/bin/jellyfin-web/index.html \
|
||||
/config/jellyfin-web/index.html
|
||||
do
|
||||
if [ -f "$candidate" ]; then
|
||||
index_path="$candidate"
|
||||
break
|
||||
fi
|
||||
done
|
||||
fi
|
||||
|
||||
if [ -z "$index_path" ] || [ ! -f "$index_path" ]; then
|
||||
echo "Could not find jellyfin-web index.html." >&2
|
||||
usage
|
||||
echo "Pass the path explicitly, for example:" >&2
|
||||
echo " sudo bash scripts/install-web-loader.sh /usr/share/jellyfin/web/index.html" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ ! -w "$index_path" ]; then
|
||||
echo "Cannot write to $index_path. Run this script with sudo or fix permissions." >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if grep -Fq "$loader_src" "$index_path"; then
|
||||
echo "Request web loader is already installed in $index_path"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
backup_path="${index_path}.bak.request.$(date -u +%Y%m%d%H%M%S)"
|
||||
cp -p "$index_path" "$backup_path"
|
||||
|
||||
tmp_path="$(mktemp)"
|
||||
block="${marker_start}
|
||||
<script src=\"${loader_src}\" defer></script>
|
||||
${marker_end}"
|
||||
|
||||
awk -v block="$block" '
|
||||
BEGIN { inserted = 0 }
|
||||
/<\/body>/ && inserted == 0 {
|
||||
print block
|
||||
inserted = 1
|
||||
}
|
||||
{ print }
|
||||
END {
|
||||
if (inserted == 0) {
|
||||
print block
|
||||
}
|
||||
}
|
||||
' "$index_path" > "$tmp_path"
|
||||
|
||||
cat "$tmp_path" > "$index_path"
|
||||
rm -f "$tmp_path"
|
||||
|
||||
echo "Installed Request web loader in $index_path"
|
||||
echo "Backup saved to $backup_path"
|
||||
echo "Restart Jellyfin, then hard refresh the browser."
|
||||
@@ -0,0 +1,93 @@
|
||||
param(
|
||||
[string]$Version = "1.0.0.0",
|
||||
[string]$TargetAbi = "10.11.0.0",
|
||||
[string]$RepoRawBase = "https://git.masengr.com/Michael-A-Sloan/Jellyfin_Request_tvandmovies/raw/branch/main"
|
||||
)
|
||||
|
||||
$ErrorActionPreference = "Stop"
|
||||
$root = Split-Path -Parent $PSScriptRoot
|
||||
Set-Location $root
|
||||
|
||||
$guid = "11c08950-c4bb-484d-89ff-205b3724416b"
|
||||
$pluginName = "Request"
|
||||
$zipFileName = "Jellyfin.Plugin.Request_10.11.0.zip"
|
||||
$releaseDir = Join-Path $root "release"
|
||||
$stageDir = Join-Path $releaseDir "stage"
|
||||
$dllPath = Join-Path $root "Jellyfin.Plugin.Request\bin\Release\net9.0\Jellyfin.Plugin.Request.dll"
|
||||
$zipPath = Join-Path $releaseDir $zipFileName
|
||||
$manifestPath = Join-Path $root "manifest.json"
|
||||
$timestamp = (Get-Date).ToUniversalTime().ToString("yyyy-MM-ddTHH:mm:ss.fffffffZ")
|
||||
$changelog = "Initial release: local request queue, TMDB search, Request nav tab"
|
||||
|
||||
Write-Host "Building plugin..."
|
||||
dotnet build (Join-Path $root "Jellyfin.Plugin.Request.sln") -c Release
|
||||
if (-not (Test-Path $dllPath)) {
|
||||
throw "DLL not found at $dllPath"
|
||||
}
|
||||
|
||||
New-Item -ItemType Directory -Force -Path $releaseDir | Out-Null
|
||||
if (Test-Path $stageDir) {
|
||||
Remove-Item $stageDir -Recurse -Force
|
||||
}
|
||||
New-Item -ItemType Directory -Force -Path $stageDir | Out-Null
|
||||
|
||||
$meta = [ordered]@{
|
||||
guid = $guid
|
||||
name = $pluginName
|
||||
description = "Adds a Request tab to Jellyfin Web so users can search TMDB and submit movie and TV requests into a local queue for administrators to review."
|
||||
overview = "Request movies and TV shows from a local admin review queue"
|
||||
owner = "Michael-A-Sloan"
|
||||
category = "General"
|
||||
version = $Version
|
||||
changelog = $changelog
|
||||
targetAbi = $TargetAbi
|
||||
framework = "net9.0"
|
||||
timestamp = $timestamp
|
||||
}
|
||||
$metaJson = $meta | ConvertTo-Json -Depth 5
|
||||
[System.IO.File]::WriteAllText((Join-Path $stageDir "meta.json"), $metaJson)
|
||||
Copy-Item $dllPath -Destination (Join-Path $stageDir "Jellyfin.Plugin.Request.dll")
|
||||
|
||||
$tempZip = Join-Path $releaseDir ("tmp_" + [guid]::NewGuid().ToString("N") + ".zip")
|
||||
Compress-Archive -Path (Join-Path $stageDir "*") -DestinationPath $tempZip -Force
|
||||
Remove-Item $stageDir -Recurse -Force
|
||||
|
||||
if (Test-Path $zipPath) {
|
||||
Remove-Item $zipPath -Force -ErrorAction SilentlyContinue
|
||||
Start-Sleep -Milliseconds 200
|
||||
}
|
||||
Move-Item -Path $tempZip -Destination $zipPath -Force
|
||||
|
||||
$checksum = (Get-FileHash -Path $zipPath -Algorithm MD5).Hash.ToUpperInvariant()
|
||||
$sourceUrl = "$RepoRawBase/release/$zipFileName"
|
||||
|
||||
$versionObj = [ordered]@{
|
||||
version = $Version
|
||||
changelog = $changelog
|
||||
targetAbi = $TargetAbi
|
||||
sourceUrl = $sourceUrl
|
||||
checksum = $checksum
|
||||
timestamp = $timestamp
|
||||
dependencies = @()
|
||||
}
|
||||
$plugin = [ordered]@{
|
||||
guid = $guid
|
||||
name = $pluginName
|
||||
description = "Adds a Request tab to Jellyfin Web so users can search TMDB and submit movie and TV requests into a local queue for administrators to review."
|
||||
overview = "Request movies and TV shows from a local admin review queue"
|
||||
owner = "Michael-A-Sloan"
|
||||
category = "General"
|
||||
repositoryUrl = "https://git.masengr.com/Michael-A-Sloan/Jellyfin_Request_tvandmovies"
|
||||
versions = @($versionObj)
|
||||
}
|
||||
|
||||
# Jellyfin requires a JSON array root.
|
||||
$pluginJson = ($plugin | ConvertTo-Json -Depth 8)
|
||||
$manifestJson = "[" + [Environment]::NewLine + $pluginJson + [Environment]::NewLine + "]"
|
||||
[System.IO.File]::WriteAllText($manifestPath, $manifestJson)
|
||||
|
||||
Write-Host "Packaged: $zipPath"
|
||||
Write-Host "Checksum: $checksum"
|
||||
Write-Host "Manifest: $manifestPath"
|
||||
Write-Host "Jellyfin repository URL:"
|
||||
Write-Host " $RepoRawBase/manifest.json"
|
||||
@@ -0,0 +1,44 @@
|
||||
param(
|
||||
[string]$IndexPath = ""
|
||||
)
|
||||
|
||||
$ErrorActionPreference = "Stop"
|
||||
|
||||
$loaderSrc = "/Requests/Assets/nav-loader.js"
|
||||
$markerStart = "<!-- jellyfin-plugin-request-nav-start -->"
|
||||
$markerEnd = "<!-- jellyfin-plugin-request-nav-end -->"
|
||||
|
||||
if (-not $IndexPath) {
|
||||
$candidates = @(
|
||||
(Join-Path $env:LOCALAPPDATA "jellyfin\jellyfin-web\index.html"),
|
||||
"C:\Program Files\Jellyfin\Server\jellyfin-web\index.html",
|
||||
"C:\ProgramData\Jellyfin\Server\jellyfin-web\index.html"
|
||||
)
|
||||
foreach ($candidate in $candidates) {
|
||||
if (Test-Path $candidate) {
|
||||
$IndexPath = $candidate
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (-not $IndexPath -or -not (Test-Path $IndexPath)) {
|
||||
Write-Error "Could not find jellyfin-web index.html. Pass -IndexPath explicitly."
|
||||
}
|
||||
|
||||
$html = Get-Content -Raw -Path $IndexPath
|
||||
if (($html -notlike "*$loaderSrc*") -and ($html -notlike "*$markerStart*")) {
|
||||
Write-Host "Request web loader is not installed in $IndexPath"
|
||||
exit 0
|
||||
}
|
||||
|
||||
$backupPath = "$IndexPath.bak.request.uninstall.$(Get-Date -Format 'yyyyMMddHHmmss')"
|
||||
Copy-Item -Path $IndexPath -Destination $backupPath
|
||||
|
||||
$pattern = "(?s)\s*$([regex]::Escape($markerStart)).*?$([regex]::Escape($markerEnd))\s*"
|
||||
$updated = [regex]::Replace($html, $pattern, "`r`n")
|
||||
$updated = [regex]::Replace($updated, "(?im)^\s*<script[^>]*nav-loader\.js[^>]*>\s*</script>\s*`r?`n?", "")
|
||||
|
||||
Set-Content -Path $IndexPath -Value $updated -NoNewline
|
||||
Write-Host "Removed Request web loader from $IndexPath"
|
||||
Write-Host "Backup saved to $backupPath"
|
||||
@@ -0,0 +1,53 @@
|
||||
#!/usr/bin/env bash
|
||||
set -euo pipefail
|
||||
|
||||
loader_src="/Requests/Assets/nav-loader.js"
|
||||
marker_start="<!-- jellyfin-plugin-request-nav-start -->"
|
||||
marker_end="<!-- jellyfin-plugin-request-nav-end -->"
|
||||
|
||||
index_path="${1:-}"
|
||||
if [ -z "$index_path" ]; then
|
||||
for candidate in \
|
||||
/usr/share/jellyfin/web/index.html \
|
||||
/usr/lib/jellyfin/bin/jellyfin-web/index.html \
|
||||
/config/jellyfin-web/index.html
|
||||
do
|
||||
if [ -f "$candidate" ]; then
|
||||
index_path="$candidate"
|
||||
break
|
||||
fi
|
||||
done
|
||||
fi
|
||||
|
||||
if [ -z "$index_path" ] || [ ! -f "$index_path" ]; then
|
||||
echo "Could not find jellyfin-web index.html." >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ ! -w "$index_path" ]; then
|
||||
echo "Cannot write to $index_path. Run this script with sudo or fix permissions." >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if ! grep -Fq "$loader_src" "$index_path" && ! grep -Fq "$marker_start" "$index_path"; then
|
||||
echo "Request web loader is not installed in $index_path"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
backup_path="${index_path}.bak.request.uninstall.$(date -u +%Y%m%d%H%M%S)"
|
||||
cp -p "$index_path" "$backup_path"
|
||||
|
||||
tmp_path="$(mktemp)"
|
||||
awk -v start="$marker_start" -v end="$marker_end" -v src="$loader_src" '
|
||||
$0 ~ start { skip = 1; next }
|
||||
skip && $0 ~ end { skip = 0; next }
|
||||
skip { next }
|
||||
index($0, src) { next }
|
||||
{ print }
|
||||
' "$index_path" > "$tmp_path"
|
||||
|
||||
cat "$tmp_path" > "$index_path"
|
||||
rm -f "$tmp_path"
|
||||
|
||||
echo "Removed Request web loader from $index_path"
|
||||
echo "Backup saved to $backup_path"
|
||||
Reference in new issue
Block a user