feat(push): smart push queueing with page-visibility fast path and app-ping/pong fallback
This commit is contained in:
+2
-15
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user