Owncast joins the pasture with federation turned on through its admin API; scenarios/owncast.sh has alice follow the stream, receive its admin's message, like and boost it (both show in Owncast's admin), and unfollow: 13 checks, with no change to PrivaPub. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LsXgEaXee4GCU1hwYgPJXw
40 lines
3.0 KiB
Bash
40 lines
3.0 KiB
Bash
# Owncast 0.3.0: alice follows the stream; a message its admin sends reaches her home; her like and boost show in its
|
|
# admin's list of fediverse actions; the unfollow; statistics. Owncast's one actor follows nobody and takes no replies.
|
|
# Driven through its admin API.
|
|
OC=https://owncast.test:6443
|
|
oc() { site owncast.test -s -u admin:abc123 "$@"; }
|
|
p_home_has() { curl -s -H "$PH" "$P/api/v1/timelines/home?limit=40" | j "print(next((s['id'] for s in d if '$1' in (s['content'] or '')), ''))"; }
|
|
# oc_actions <type>: how many fediverse actions of that type its admin lists from alice
|
|
oc_actions() { oc "$OC/api/admin/federation/actions?limit=100" | j "r = d.get('results', d) if isinstance(d, dict) else d; print(sum(1 for a in r if a.get('type') == '$1' and 'alice_owncast' in (a.get('actorIRI') or '')))"; }
|
|
|
|
echo "owncast"
|
|
[ "$(oc "$OC/api/admin/serverconfig" | j "print(d['federation']['enabled'])")" = "True" ] && ok "Owncast federates" || { ko "Owncast's federation is off"; return 1; }
|
|
PT=$(privapub_token alice_owncast)
|
|
PH="Authorization: Bearer $PT"
|
|
[ -n "$PT" ] && ok "PrivaPub token for alice_owncast" || { ko "PrivaPub token for alice_owncast"; return 1; }
|
|
run=$(date +%s)
|
|
|
|
echo " following the stream"
|
|
oc_on_p=$(curl -s -H "$PH" "$P/api/v2/search?q=owncast@owncast.test&resolve=true&type=accounts" | j "print(d['accounts'][0]['id'])")
|
|
[ -n "$oc_on_p" ] && ok "PrivaPub resolves the stream's actor" || ko "PrivaPub cannot resolve the stream's actor"
|
|
curl -s -o /dev/null -X POST -H "$PH" "$P/api/v1/accounts/$oc_on_p/follow"
|
|
until_true 45 '[ "$(curl -s -H "$PH" "$P/api/v1/accounts/relationships?id[]=$oc_on_p" | j "print(d[0][\"following\"])")" = "True" ]' \
|
|
&& ok "alice follows the stream (Accept arrived)" || ko "the stream's Accept never arrived"
|
|
until_true 30 'oc "$OC/api/admin/followers" | grep -q alice_owncast' && ok "and is among its followers" || ko "Owncast does not list alice"
|
|
|
|
echo " posts"
|
|
oc -o /dev/null -X POST "$OC/api/admin/federation/send" -H 'Content-Type: application/json' -d "{\"value\":\"an Owncast message $run\"}"
|
|
until_true 45 '[ -n "$(p_home_has "an Owncast message $run")" ]' && ok "the stream's message reaches alice's home" || ko "the stream's message never reached alice"
|
|
on_p=$(p_home_has "an Owncast message $run")
|
|
curl -s -o /dev/null -X POST -H "$PH" "$P/api/v1/statuses/$on_p/favourite"
|
|
until_true 45 '[ "$(oc_actions FEDIVERSE_ENGAGEMENT_LIKE)" -ge 1 ]' && ok "alice's like shows in its admin" || ko "Owncast never saw alice's like ($(oc_actions FEDIVERSE_ENGAGEMENT_LIKE))"
|
|
curl -s -o /dev/null -X POST -H "$PH" "$P/api/v1/statuses/$on_p/reblog"
|
|
until_true 45 '[ "$(oc_actions FEDIVERSE_ENGAGEMENT_REPOST)" -ge 1 ]' && ok "alice's boost shows in its admin" || ko "Owncast never saw alice's boost"
|
|
|
|
echo " unfollow"
|
|
curl -s -o /dev/null -X POST -H "$PH" "$P/api/v1/accounts/$oc_on_p/unfollow"
|
|
until_true 45 '! oc "$OC/api/admin/followers" | grep -q alice_owncast' && ok "alice's unfollow reaches the stream" || ko "Owncast still lists alice"
|
|
|
|
echo " statistics"
|
|
stats_check owncast.test owncast
|