From ede52192251f7a803dc621349aa7308e98a920a9 Mon Sep 17 00:00:00 2001 From: Colin Reeder Date: Tue, 30 May 2023 00:41:20 -0600 Subject: [PATCH] Initial commit --- handle.sh | 5 +++++ register.sh | 19 +++++++++++++++++++ 2 files changed, 24 insertions(+) create mode 100755 handle.sh create mode 100755 register.sh diff --git a/handle.sh b/handle.sh new file mode 100755 index 0000000..f19363a --- /dev/null +++ b/handle.sh @@ -0,0 +1,5 @@ +#!/bin/bash + +body="$(tee)" +echo "$body" +notify-send "something!" diff --git a/register.sh b/register.sh new file mode 100755 index 0000000..e94964f --- /dev/null +++ b/register.sh @@ -0,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"}' -- 2.45.2