From 28bc857788b0007c00d7911eb96154d550da6a81 Mon Sep 17 00:00:00 2001 From: ua1zbe Date: Wed, 23 Sep 2026 09:22:09 +0300 Subject: [PATCH] Add RuStore broadcast push script (secrets gitignored) --- .gitignore | 3 ++- tools/push.sh | 23 +++++++++++++++++++++++ 2 files changed, 25 insertions(+), 1 deletion(-) create mode 100755 tools/push.sh diff --git a/.gitignore b/.gitignore index ffec2f6..074226d 100644 --- a/.gitignore +++ b/.gitignore @@ -11,4 +11,5 @@ captures/ *.apk *.aab keystore.properties -*.jks \ No newline at end of file +*.jks +tools/.push.secrets \ No newline at end of file diff --git a/tools/push.sh b/tools/push.sh new file mode 100755 index 0000000..1a0f9a6 --- /dev/null +++ b/tools/push.sh @@ -0,0 +1,23 @@ +#!/usr/bin/env bash +# Рассылка пуша всем подписчикам топика "aprsmap" (RuStore Push). +# Использование: ./push.sh "Заголовок" "Текст" +# project_id и service token читаются из tools/.push.secrets (в git не хранится). +set -euo pipefail +DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" +[ -f "$DIR/.push.secrets" ] && . "$DIR/.push.secrets" + +SERVICE_TOKEN="${SERVICE_TOKEN:-${SSP:-}}" +PROJECT_ID="${PROJECT_ID:-}" + +[ -n "$SERVICE_TOKEN" ] || { echo "SERVICE_TOKEN is not set" >&2; exit 1; } +[ -n "$PROJECT_ID" ] || { echo "PROJECT_ID is not set" >&2; exit 1; } + +title="${1:?usage: push.sh <body>}" +body="${2:-}" + +curl -s -X POST \ + "https://vkpns-topics.rustore.ru/v1/projects/${PROJECT_ID}/topics/aprsmap/publish" \ + -H "Authorization: Bearer ${SERVICE_TOKEN}" \ + -H "Content-Type: application/json" \ + -d "{\"message\":{\"notification\":{\"title\":\"${title}\",\"body\":\"${body}\"}}}" +echo \ No newline at end of file