71 lines
3.1 KiB
Bash
71 lines
3.1 KiB
Bash
#!/bin/bash
|
|
# ============================================================
|
|
# SEERR: первый вход администратора (нужен serverType = 2)
|
|
# ============================================================
|
|
set -uo pipefail
|
|
S=http://192.168.1.121:5055/api/v1
|
|
JAR=/tmp/seerr.jar
|
|
rm -f "$JAR"
|
|
PW=$(cat /root/.jellyfin-akadmin-password)
|
|
|
|
echo "=== 1. ВХОД ==="
|
|
CODE=$(curl -s -o /tmp/s2.out -c "$JAR" -w '%{http_code}' --max-time 30 -X POST -H 'Content-Type: application/json' \
|
|
-d "{\"username\":\"akadmin\",\"password\":\"$PW\",\"serverType\":2}" "$S/auth/jellyfin")
|
|
echo " ответ: HTTP $CODE"
|
|
head -c 300 /tmp/s2.out | sed 's/^/ /'
|
|
echo
|
|
echo " cookie: $(grep -c connect.sid "$JAR" 2>/dev/null)"
|
|
|
|
echo
|
|
echo "=== 2. КТО Я ==="
|
|
curl -s --max-time 15 -b "$JAR" "$S/auth/me" 2>/dev/null | python3 -c "
|
|
import json,sys
|
|
d=json.load(sys.stdin)
|
|
print(' имя:', d.get('displayName'), '| админ:', d.get('permissions') == 2 or d.get('permissions'))
|
|
" 2>&1 | head -3
|
|
|
|
echo
|
|
echo "=== 3. ИНИЦИАЛИЗАЦИЯ ==="
|
|
CODE=$(curl -s -o /tmp/s3.out -b "$JAR" -w '%{http_code}' --max-time 25 -X POST -H 'Content-Type: application/json' \
|
|
-d '{"applicationTitle":"Buryan Hub","applicationUrl":"https://ombi.buryans.ru"}' "$S/settings/initialize")
|
|
echo " ответ: HTTP $CODE $(head -c 100 /tmp/s3.out | tr -d '\n')"
|
|
|
|
echo
|
|
echo "=== 4. SONARR ==="
|
|
CODE=$(curl -s -o /tmp/s4.out -b "$JAR" -w '%{http_code}' --max-time 25 -X POST -H 'Content-Type: application/json' -d '{
|
|
"name":"Buryan Hub","hostname":"192.168.1.117","port":8989,"useSsl":false,"urlBase":"",
|
|
"apiKey":"'$(cat /root/.sonarr-key)'","activeProfileId":1,"activeProfileName":"Any",
|
|
"activeDirectory":"/tv","activeLanguageProfileId":1,"activeTags":[],"is4k":false,
|
|
"isDefault":true,"syncEnabled":true,"preventSearch":false}' "$S/settings/sonarr")
|
|
echo " ответ: HTTP $CODE $(head -c 160 /tmp/s4.out | tr -d '\n')"
|
|
|
|
echo
|
|
echo "=== 5. RADARR ==="
|
|
CODE=$(curl -s -o /tmp/s5.out -b "$JAR" -w '%{http_code}' --max-time 25 -X POST -H 'Content-Type: application/json' -d '{
|
|
"name":"Buryan Hub","hostname":"192.168.1.118","port":7878,"useSsl":false,"urlBase":"",
|
|
"apiKey":"'$(cat /root/.radarr-key)'","activeProfileId":1,"activeProfileName":"Any",
|
|
"activeDirectory":"/movies","activeLanguageProfileId":1,"activeTags":[],"is4k":false,
|
|
"isDefault":true,"syncEnabled":true,"preventSearch":false}' "$S/settings/radarr")
|
|
echo " ответ: HTTP $CODE $(head -c 160 /tmp/s5.out | tr -d '\n')"
|
|
|
|
echo
|
|
echo "=== 6. ИТОГ ==="
|
|
curl -s --max-time 15 "$S/settings/public" 2>/dev/null | python3 -c "
|
|
import json,sys
|
|
d=json.load(sys.stdin)
|
|
print(' initialized:', d.get('initialized'), '| заголовок:', d.get('applicationTitle'))
|
|
"
|
|
for e in sonarr radarr; do
|
|
printf ' %-8s ' "$e"
|
|
curl -s --max-time 15 -b "$JAR" "$S/settings/$e" 2>/dev/null \
|
|
| python3 -c "
|
|
import json,sys
|
|
try:
|
|
d=json.load(sys.stdin)
|
|
o=(d.get('options') or [{}])[0]
|
|
print('серверов:', len(d.get('options') or []), '|', o.get('hostname'), o.get('port'), '| профиль:', o.get('activeProfileName'))
|
|
except Exception:
|
|
print('нет ответа')
|
|
" 2>/dev/null
|
|
done
|