105 lines
2.0 KiB
Markdown
105 lines
2.0 KiB
Markdown
# MixItUp integration
|
|
|
|
## Triggerendpoint
|
|
|
|
Primært endpoint:
|
|
|
|
```http
|
|
POST /api/v1/triggers/{slug}
|
|
Authorization: Bearer <mixitup-token>
|
|
Content-Type: application/json
|
|
```
|
|
|
|
Eksempel med `raid`:
|
|
|
|
```http
|
|
POST /api/v1/triggers/raid
|
|
Host: tuxdmx.local:8000
|
|
Authorization: Bearer REPLACE_WITH_TOKEN
|
|
Content-Type: application/json
|
|
```
|
|
|
|
```json
|
|
{
|
|
"eventType": "raid",
|
|
"username": "streamviewer42",
|
|
"displayName": "StreamViewer42",
|
|
"amount": 120,
|
|
"eventId": "raid-evt-20260712-001",
|
|
"platform": "twitch",
|
|
"metadata": {
|
|
"source": "mixitup",
|
|
"notes": "Raid test i simulator"
|
|
}
|
|
}
|
|
```
|
|
|
|
Forventet svar:
|
|
|
|
```json
|
|
{
|
|
"accepted": true,
|
|
"queue_depth": 1
|
|
}
|
|
```
|
|
|
|
HTTP-status:
|
|
|
|
```text
|
|
202 Accepted
|
|
```
|
|
|
|
## Simple endpoints
|
|
|
|
- `POST /api/v1/scenes/{sceneSlug}/activate`
|
|
- `POST /api/v1/effects/{effectSlug}/trigger`
|
|
- `POST /api/v1/dmx/blackout`
|
|
- `POST /api/v1/bpm/tap`
|
|
|
|
## Headers
|
|
|
|
- `Authorization: Bearer <token>`
|
|
- `Content-Type: application/json`
|
|
|
|
Token må aldrig sendes i querystring.
|
|
|
|
## MixItUp Web Request Action
|
|
|
|
1. Vælg `POST`.
|
|
2. Brug URL `http://<tuxdmx-host>:8000/api/v1/triggers/<slug>`.
|
|
3. Tilføj header `Authorization` med `Bearer <token>`.
|
|
4. Tilføj header `Content-Type` med `application/json`.
|
|
5. Indsæt JSON-body.
|
|
|
|
## Eksempel-body med MixItUp special identifiers
|
|
|
|
```json
|
|
{
|
|
"eventType": "raid",
|
|
"username": "$username",
|
|
"displayName": "$displayname",
|
|
"amount": "$raidviewercount",
|
|
"eventId": "$eventid",
|
|
"platform": "twitch",
|
|
"metadata": {
|
|
"eventName": "$eventname"
|
|
}
|
|
}
|
|
```
|
|
|
|
## Test i simulator-mode
|
|
|
|
```bash
|
|
curl -i -X POST http://127.0.0.1:8000/api/v1/triggers/raid \
|
|
-H "Authorization: Bearer test-token" \
|
|
-H "Content-Type: application/json" \
|
|
-d '{"eventType":"raid","displayName":"AuditTest","amount":42,"eventId":"raid-audit-1","platform":"twitch","metadata":{}}'
|
|
```
|
|
|
|
## Sikkerhed
|
|
|
|
- Roter token ved mistanke om læk.
|
|
- Brug IP-allowlist eller reverse proxy, hvis endpointet eksponeres uden for isoleret LAN.
|
|
- Rate limiting og duplicate/idempotency skal håndhæves server-side.
|
|
|