feat(push): smart push queueing with page-visibility fast path and app-ping/pong fallback

This commit is contained in:
2026-06-04 22:10:48 -04:00
parent fc0527e9e7
commit 4e6dfb4726
16 changed files with 192 additions and 60 deletions
+2 -15
View File
@@ -249,22 +249,9 @@ ensure_server() {
ensure_server
# Authenticate with the ClawTap server API
get_auth_token() {
local BODY
BODY=$(printf '%s' "$CLAWTAP_PASSWORD" | python3 -c 'import sys,json; print(json.dumps({"password": sys.stdin.read()}))' 2>/dev/null)
curl -sk -X POST "${PROTOCOL}://localhost:${PORT}/api/auth/login" \
-H "Content-Type: application/json" \
-d "$BODY" 2>/dev/null | \
python3 -c 'import sys,json; print(json.load(sys.stdin).get("token",""))' 2>/dev/null
}
# Localhost requests are trusted by the server — no token needed
require_auth() {
AUTH_TOKEN=$(get_auth_token)
if [ -z "$AUTH_TOKEN" ]; then
echo "Error: Failed to authenticate with ClawTap server"
exit 1
fi
AUTH_TOKEN=""
}
# No args → just start server, print URLs, exit