Files
Jellyfin_Request_tvandmovies/scripts/uninstall-web-loader.sh
T
Michael SloanandCursor bf6cd4540f 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>
2026-08-02 16:31:26 -04:00

54 lines
1.4 KiB
Bash

#!/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"