feat: Add Paarrot API server with endpoints for controlling app features
All checks were successful
Build / increment-version (push) Successful in 6s
Build / build-windows (push) Successful in 3m14s
Build / build-linux (push) Successful in 4m58s
Build / create-release (push) Successful in 16s

- Implemented API server using Express, including endpoints for health check, status, mute, deafen, channel management, and message sending.
- Added middleware for CORS and JSON body parsing.
- Created test scripts (Node.js and Bash) for API endpoint verification.
- Documented API usage and integration in new API documentation files.
- Updated package.json to include necessary dependencies (express, cors, body-parser).
This commit is contained in:
litruv
2026-02-21 21:40:41 +11:00
parent b9e8fec8d4
commit 4e782409ee
10 changed files with 1945 additions and 22 deletions

53
test-api.sh Executable file
View File

@@ -0,0 +1,53 @@
#!/bin/bash
# Paarrot API Quick Test Script
#
# Simple curl commands to test the API endpoints
# Make sure Paarrot is running before using these commands
API_BASE="http://127.0.0.1:33384"
echo "🚀 Paarrot API Quick Test"
echo ""
# Health check
echo "📡 Health Check:"
curl -s "$API_BASE/health" | jq '.' || curl -s "$API_BASE/health"
echo ""
echo ""
# Get status
echo "📊 Get Status:"
curl -s "$API_BASE/status" | jq '.' || curl -s "$API_BASE/status"
echo ""
echo ""
# Toggle mute
echo "🎤 Toggle Mute:"
curl -s -X POST "$API_BASE/mute/toggle" | jq '.' || curl -s -X POST "$API_BASE/mute/toggle"
echo ""
echo ""
# Toggle deafen
echo "🔇 Toggle Deafen:"
curl -s -X POST "$API_BASE/deafen/toggle" | jq '.' || curl -s -X POST "$API_BASE/deafen/toggle"
echo ""
echo ""
# Get channels
echo "📋 Get Channels:"
curl -s "$API_BASE/channels" | jq '.' || curl -s "$API_BASE/channels"
echo ""
echo ""
# Get current room
echo "🏠 Get Current Room:"
curl -s "$API_BASE/room/current" | jq '.' || curl -s "$API_BASE/room/current"
echo ""
echo ""
echo "✨ Done!"
echo ""
echo "💡 Tips:"
echo " - Use 'jq' for pretty JSON output (install with: sudo apt install jq)"
echo " - Check API.md for full documentation"
echo " - Test message sending: curl -X POST $API_BASE/message/current -H 'Content-Type: application/json' -d '{\"message\": \"Hello!\"}'"