Whoa boy rust is a problem child

This commit is contained in:
bel
2020-05-02 14:02:00 -06:00
parent f12fa74c86
commit cd841f38eb
18 changed files with 1005 additions and 8 deletions

View File

@@ -1,7 +1,10 @@
#! /bin/bash
if ! ps aux | grep -v grep | grep homeserver; then
homeserver -c config.yaml &
cp synapse-test.key /tmp/
cp synapse-test-log.yaml /tmp/
homeserver -c config.yaml &> /tmp/synapse-test.log &
disown
fi
# pick a username
@@ -9,7 +12,7 @@ username="$(cat /proc/sys/kernel/random/uuid)"
# register
out="$(
curl -sS http://192.168.0.86:39487/_matrix/client/r0/register \
curl -sS http://localhost:39487/_matrix/client/r0/register \
-X POST \
-H 'content-type: application/json' \
-d "$(
@@ -31,7 +34,7 @@ home_server="$(echo "$out" | jq -r .home_server)"
room="$(cat /proc/sys/kernel/random/uuid)"
out="$(
curl -sS http://192.168.0.86:39487/_matrix/client/r0/createRoom\
curl -sS http://localhost:39487/_matrix/client/r0/createRoom\
-X POST \
-H 'content-type: application/json' \
-H 'Authorization: Bearer '"$access_token" \
@@ -46,7 +49,7 @@ room_id="$(echo "$out" | jq -r .room_id)"
# join a room by name
# curl -XPOST -d '{}' "https://localhost:8448/_matrix/client/r0/join/%21asfLdzLnOdGRkdPZWu:localhost?access_token=YOUR_ACCESS_TOKEN"
curl -sS "http://192.168.0.86:39487/_matrix/client/r0/join/$room_id" \
curl -sS "http://localhost:39487/_matrix/client/r0/join/$room_id" \
-X POST \
-H 'Authorization: Bearer '"$access_token" \
-d '{}'
@@ -58,7 +61,7 @@ txid="$(cat /proc/sys/kernel/random/uuid)"
message="hello wurl"
out="$(
curl -sS "http://192.168.0.86:39487/_matrix/client/r0/rooms/$room_id/send/m.room.message/$txid" \
curl -sS "http://localhost:39487/_matrix/client/r0/rooms/$room_id/send/m.room.message/$txid" \
-X PUT \
-H 'content-type: application/json' \
-H 'Authorization: Bearer '"$access_token" \
@@ -74,7 +77,7 @@ printf "%s\n" "$out"
# get recent messages
# curl --globoff -XGET 'https://localhost:8448/_matrix/client/r0/sync?filter={"room":{"timeline":{"limit":1}}}&access_token=YOUR_ACCESS_TOKEN'
out="$(
curl -sS "http://192.168.0.86:39487/_matrix/client/r0/sync" \
curl -sS "http://localhost:39487/_matrix/client/r0/sync" \
-X GET \
-H 'content-type: application/json' \
-H 'Authorization: Bearer '"$access_token" \
@@ -89,7 +92,7 @@ txid="$(cat /proc/sys/kernel/random/uuid)"
message="hello wurl2"
out="$(
curl -sS "http://192.168.0.86:39487/_matrix/client/r0/rooms/$room_id/send/m.room.message/$txid" \
curl -sS "http://localhost:39487/_matrix/client/r0/rooms/$room_id/send/m.room.message/$txid" \
-X PUT \
-H 'content-type: application/json' \
-H 'Authorization: Bearer '"$access_token" \
@@ -104,7 +107,7 @@ printf "%s\n" "$out"
# get second recent messages
# curl --globoff -XGET 'https://localhost:8448/_matrix/client/r0/sync?filter={"room":{"timeline":{"limit":1}}}&access_token=YOUR_ACCESS_TOKEN'
curl -sS "http://192.168.0.86:39487/_matrix/client/r0/sync?since=$since" \
curl -sS "http://localhost:39487/_matrix/client/r0/sync?since=$since" \
-X GET \
-H 'content-type: application/json' \
-H 'Authorization: Bearer '"$access_token" \