Edit history from formerRepresentations
Pleroma and Akkoma send a post's earlier versions with it. A post PrivaPub first meets after its edits now has its history, and an edit that carries them brings the versions missed in between; each is read as the post itself is. The Akkoma scenario checks a post fetched after two edits by an account no persona follows. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LsXgEaXee4GCU1hwYgPJXw
This commit is contained in:
1 parent
02928caac1
commit
679463eb3f
12 files changed
+288
-24
No files matched your search
@@ -17,13 +17,19 @@ akkoma_up() {
|
||||
done
|
||||
podman exec pasture-akkoma /opt/akkoma/bin/pleroma_ctl user new akuser akuser@akkoma.test --password Akkoma-Pasture-Pass-1 \
|
||||
--name akuser --admin --assume-yes >/dev/null 2>&1 || true
|
||||
akkoma_token akuser > "$here/.state/akkoma.token" || true
|
||||
echo "akkoma: https://akkoma.test:6443"
|
||||
}
|
||||
|
||||
# akkoma_token <user>: an access token for one of the pasture's users (its password), through a new app and the password
|
||||
# grant
|
||||
akkoma_token() {
|
||||
local app cid cs
|
||||
app=$(site akkoma.test -s -X POST https://akkoma.test:6443/api/v1/apps -d 'client_name=pasture&redirect_uris=urn:ietf:wg:oauth:2.0:oob&scopes=read write follow push admin')
|
||||
cid=$(echo "$app" | python3 -c "import sys,json; print(json.load(sys.stdin)['client_id'])" 2>/dev/null)
|
||||
cs=$(echo "$app" | python3 -c "import sys,json; print(json.load(sys.stdin)['client_secret'])" 2>/dev/null)
|
||||
site akkoma.test -s -X POST https://akkoma.test:6443/oauth/token --data-urlencode grant_type=password --data-urlencode username=akuser \
|
||||
site akkoma.test -s -X POST https://akkoma.test:6443/oauth/token --data-urlencode grant_type=password --data-urlencode "username=$1" \
|
||||
--data-urlencode password=Akkoma-Pasture-Pass-1 --data-urlencode "client_id=$cid" --data-urlencode "client_secret=$cs" \
|
||||
--data-urlencode 'scope=read write follow push admin' \
|
||||
| python3 -c "import sys,json; print(json.load(sys.stdin)['access_token'])" > "$here/.state/akkoma.token" 2>/dev/null || true
|
||||
echo "akkoma: https://akkoma.test:6443"
|
||||
| python3 -c "import sys,json; print(json.load(sys.stdin)['access_token'])" 2>/dev/null
|
||||
}
|
||||
@@ -1,8 +1,10 @@
|
||||
# Akkoma 3.20: discovery, follows, posts, CW, replies both ways, likes and boosts with their undos, emoji reactions
|
||||
# both ways, DMs, polls, quotes both ways, edits with their history, deletes, media with alt text, the published time
|
||||
# kept, blocks, statistics. Akkoma speaks the Mastodon API, with reactions under /api/v1/pleroma.
|
||||
# both ways, DMs, polls, quotes both ways, edits with their history (a post met after its edits too), deletes, media
|
||||
# with alt text, the published time kept, blocks, statistics. Akkoma speaks the Mastodon API, with reactions under
|
||||
# /api/v1/pleroma.
|
||||
AK=https://akkoma.test:6443
|
||||
acurl() { curl -sk --resolve akkoma.test:6443:127.0.0.1 "$@"; }
|
||||
. "$here/peers/akkoma.sh"
|
||||
KT=$(cat "$here/.state/akkoma.token" 2>/dev/null)
|
||||
KH="Authorization: Bearer $KT"
|
||||
# what Akkoma holds of an account, newest first; and the one status whose uri is given
|
||||
@@ -122,6 +124,19 @@ curl -s -o /dev/null -X PUT -H "$PH" "$P/api/v1/statuses/$p_post_id" -d 'status=
|
||||
until_true 30 'acurl -H "$KH" "$AK/api/v1/statuses/$p_post_on_a" | grep -q "edited"' && ok "alice_akkoma's edit reaches Akkoma" || ko "edit not applied on Akkoma"
|
||||
acurl -o /dev/null -X PUT -H "$KH" "$AK/api/v1/statuses/$a_post_id" -d 'status=Hello PrivaPub from Akkoma, edited'
|
||||
until_true 30 '[ "$(curl -s -H "$PH" "$P/api/v1/statuses/$a_post_on_p/history" | j "print(len(d))")" = "2" ]' && ok "akuser's edit reaches PrivaPub with its history" || ko "Akkoma's edit not applied on PrivaPub"
|
||||
# a post PrivaPub first meets after two edits, by an Akkoma account no persona follows, comes with its earlier versions
|
||||
# (formerRepresentations)
|
||||
podman exec pasture-akkoma /opt/akkoma/bin/pleroma_ctl user new akwriter akwriter@akkoma.test --password Akkoma-Pasture-Pass-1 \
|
||||
--name akwriter --assume-yes >/dev/null 2>&1 || true
|
||||
WH="Authorization: Bearer $(akkoma_token akwriter)"
|
||||
written=$(date +%s)
|
||||
w_post=$(acurl -X POST -H "$WH" "$AK/api/v1/statuses" -d "status=written thrice $written&visibility=public" | j "print(d['id'])")
|
||||
acurl -o /dev/null -X PUT -H "$WH" "$AK/api/v1/statuses/$w_post" -d "status=written thrice $written, again"
|
||||
acurl -o /dev/null -X PUT -H "$WH" "$AK/api/v1/statuses/$w_post" -d "status=written thrice $written, at last"
|
||||
w_uri=$(acurl -H "$WH" "$AK/api/v1/statuses/$w_post" | j "print(d['uri'])")
|
||||
w_on_p=$(curl -s -G -H "$PH" "$P/api/v2/search" --data-urlencode "q=$w_uri" -d resolve=true -d type=statuses | j "print(d['statuses'][0]['id'])")
|
||||
[ "$(curl -s -H "$PH" "$P/api/v1/statuses/$w_on_p/history" | j "print([e['content'].split('$written')[-1].strip(' ,</p>') for e in d])")" = "['', 'again', 'at last']" ] \
|
||||
&& ok "a post met after its edits has its history from Akkoma" || ko "a post met after its edits lacks its history ($(curl -s -H "$PH" "$P/api/v1/statuses/$w_on_p/history" | head -c 300))"
|
||||
cw_on_a=$(a_status_by_uri "$alice_on_a" "$cw_uri" | j "print(d['id'])")
|
||||
cw_id=$(curl -s -H "$PH" "$P/api/v1/accounts/$alice_self/statuses" | j "print(next(s['id'] for s in d if s['uri']=='$cw_uri'))")
|
||||
curl -s -o /dev/null -X DELETE -H "$PH" "$P/api/v1/statuses/$cw_id"
|
||||
|
||||
Reference in new issue
Block a user