@@ 1,19 @@
+#!/bin/bash
+
+register_cmd="$1"
+execpath="$2"
+homeserver="$3"
+token="$4"
+
+result=$("$register_cmd" "$execpath" | jq .result)
+
+endpoint=$(echo "$result" | jq .endpoint)
+p256dh=$(echo "$result" | jq .keys.p256dh)
+auth=$(echo "$result" | jq .keys.auth)
+
+echo "endpoint = $endpoint"
+echo "p256dh = $p256dh"
+echo "auth = $auth"
+
+curl -H "Authorization: Bearer $token" -H "Content-Type: application/json" "$homeserver"/_matrix/client/v3/pushers/set -d \
+ '{"app_id": "click.vpzom.shoved-matrix", "data": {"format": "event_id_only", "url": "https://push.chat.vpzom.click/_matrix/push/v1/notify", "endpoint": '"$endpoint"', "auth": '"$auth"'}, "kind": "http", "pushkey": '"$p256dh"', "app_display_name": "shoved-matrix", "device_display_name": '"$(hostname | jq -R)"', "lang": "en"}'