~vpzom/shoved-matrix

ede52192251f7a803dc621349aa7308e98a920a9 — Colin Reeder 8 months ago
Initial commit
2 files changed, 24 insertions(+), 0 deletions(-)

A handle.sh
A register.sh
A  => handle.sh +5 -0
@@ 1,5 @@
#!/bin/bash

body="$(tee)"
echo "$body"
notify-send "something!"

A  => register.sh +19 -0
@@ 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"}'