Add RuStore broadcast push script (secrets gitignored)

This commit is contained in:
ua1zbe
2026-09-23 09:22:09 +03:00
parent d52382ca5b
commit 28bc857788
2 changed files with 25 additions and 1 deletions

3
.gitignore vendored
View File

@@ -11,4 +11,5 @@ captures/
*.apk
*.aab
keystore.properties
*.jks
*.jks
tools/.push.secrets

23
tools/push.sh Executable file
View File

@@ -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 <title> <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