Militant API wiki

Demarrage rapide

Pages annexes, exemples et details techniques dans une mise en page plus lisible.

1. Installer l'API

mkdir -p militant-api-install
cd militant-api-install
curl -fsSLO https://gitlab.com/militant1/api-installer/-/raw/main/militant-api
chmod +x militant-api
./militant-api

2. Verifier que l'API repond

curl http://localhost:9082/v1/index.php

3. Creer un token

curl -X POST http://localhost:9082/v1/auth.php \
  -H "Content-Type: application/json" \
  -d '{"username":"ton_username","password":"ton_password"}'

4. Utiliser un endpoint

curl http://localhost:9082/v1/posts.php \
  -H "Authorization: Bearer TON_TOKEN"

LiveKit (optionnel)

Configurer LIVEKIT_URL, LIVEKIT_API_KEY, LIVEKIT_API_SECRET (env ou config/livekit.local.php via /admin/livekit.php). Tester un token :

curl -X POST "http://localhost:9082/v1/lives.php?path=token" \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer TON_TOKEN" \
  -d '{"roomName":"test","identity":"user-1","name":"Test","canPublish":false}'

L’UI /admin/livekit.php (saisie des secrets LiveKit) est réservée aux techniciens : même règle que Millitant (users.is_admin = 1, onglet Techniciens dans admin.php).

TURN / WebRTC (optionnel mais recommande en 4G/5G)

Configurer WEBRTC_TURN_URLS, WEBRTC_TURN_AUTH_SECRET, WEBRTC_TURN_TTL, WEBRTC_TURN_REALM (env ou config/turn.local.php via /admin/turn.php).

/v1/settings.php renvoie ensuite stun_servers, turn_servers et webrtc_ice_servers. Si WEBRTC_TURN_AUTH_SECRET est present, l’API genere des credentials TURN temporaires HMAC compatibles coturn use-auth-secret.

5. Mise a jour

./militant-api update

6. Desinstallation

./militant-api uninstall

Plus de details : README.md et DOCKER.md