Skip to content

Commit 392990a

Browse files
author
John Rogers
committed
OMEAPI UPDATES
1 parent 1dde183 commit 392990a

File tree

10 files changed

+63
-31
lines changed

10 files changed

+63
-31
lines changed

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ ColourStream is a self-hosted livestreaming review platform designed for colouri
1111

1212
- **⚡️ Ultra-Low Latency**: Experience less than 5 frames of latency for real-time collaboration
1313
- **🔐 Modern Authentication**: Secure passwordless authentication using WebAuthn/passkeys
14-
- **🎭 Multi-Room Support**: Host multiple review sessions simultaneously with separate rooms - this is currently functional but the automatic OBS control will not run.
14+
- **🎭 Multi-Room Support**: Host multiple review sessions simultaneously with separate rooms - this is currently functional but the automatic OBS control will only control one room. manual stream key copy and paste is still availible
1515
- **🔄 OBS Integration**: Stream directly from OBS or other RTMP/SRT sources
1616
- **💬 Built-in Video Conferencing**: Real-time communication via Mirotalk's WebRTC capabilities
1717
- **🛡️ Secure by Design**: End-to-end security for your sensitive content, Colourstream folllows Industry Best practices and uses a full SSL pipeline to ensure your review remains safe,

backend/.env.template

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,16 @@
11
# Backend-specific environment variables
22
PORT=5001
33
DATABASE_URL=postgresql://colourstream:your_secure_password_here@colourstream-postgres:5432/colourstream
4-
OVENMEDIA_API_URL=http://origin:8081
5-
OVENMEDIA_API_TOKEN=your_ovenmedia_api_token_here
4+
OME_API_URL=http://origin:8081
5+
OME_API_ACCESS_TOKEN=your_ovenmedia_api_token_here
66
OBS_WS_HOST=localhost
77
OBS_WS_PORT=4455
88
JWT_SECRET=your_jwt_secret_here
99
WEBAUTHN_RP_NAME=ColourStream
1010
WEBAUTHN_RP_ID=live.colourstream.example.com
1111
WEBAUTHN_RP_ICON=https://live.colourstream.example.com/favicon.ico
1212
ADMIN_PASSWORD=your_secure_admin_password_here
13+
ADMIN_AUTH_SECRET=your_admin_auth_secret_here
1314

1415
# OpenID Connect Configuration (optional)
1516
OIDC_ENABLED=false

backend/dist/services/omenService.js

+12-2
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,19 @@ const axios_1 = __importStar(require("axios"));
3838
const logger_1 = require("../utils/logger");
3939
class OvenMediaEngineService {
4040
constructor() {
41-
this.baseURL = process.env.OVENMEDIA_API_URL || 'http://origin:8081';
42-
this.accessToken = process.env.OVENMEDIA_API_TOKEN || '0fc62ea62790ad7c';
41+
this.baseURL = process.env.OME_API_URL || 'http://origin:8081';
42+
this.accessToken = process.env.OME_API_ACCESS_TOKEN || '0fc62ea62790ad7c';
43+
4344
logger_1.logger.info(`Initialized OvenMediaEngine Service with URL: ${this.baseURL}`);
45+
logger_1.logger.info(`Using API access token: ${this.accessToken ? '********' : 'default token'}`);
46+
47+
if (!this.baseURL) {
48+
logger_1.logger.error('OvenMediaEngine API URL is not configured! Set OME_API_URL environment variable.');
49+
}
50+
51+
if (!this.accessToken) {
52+
logger_1.logger.error('OvenMediaEngine API access token is not configured! Set OME_API_ACCESS_TOKEN environment variable.');
53+
}
4454
}
4555
validateParameters(...params) {
4656
const invalidParams = params.filter(param => !param || typeof param !== 'string');

docs/api-flow-table.md

+5-8
Original file line numberDiff line numberDiff line change
@@ -37,16 +37,13 @@ Accept: application/json
3737

3838
## Environment Variables
3939

40-
### Frontend
41-
```env
42-
VITE_API_URL=https://live.colourstream.johnrogerscolour.co.uk/api
4340
```
41+
# Backend Environment
42+
OME_API_URL=http://origin:8081
43+
OME_API_ACCESS_TOKEN=0fc62ea62790ad7c
4444
45-
### Backend
46-
```env
47-
OVENMEDIA_API_URL=http://origin:8081
48-
OVENMEDIA_API_TOKEN=0fc62ea62790ad7c
49-
JWT_SECRET=your-super-secret-jwt-key
45+
# Frontend Environment
46+
VITE_API_URL=https://live.colourstream.johnrogerscolour.co.uk/api
5047
```
5148

5249
## Notes

docs/omen-api-flow.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -99,8 +99,8 @@ TRAEFIK_ACME_EMAIL=your-email@example.com
9999
VITE_API_URL=https://live.colourstream.johnrogerscolour.co.uk/api
100100
101101
# Backend Configuration
102-
OVENMEDIA_API_URL=http://origin:8081
103-
OVENMEDIA_API_TOKEN=0fc62ea62790ad7c
102+
OME_API_URL=http://origin:8081
103+
OME_API_ACCESS_TOKEN=0fc62ea62790ad7c
104104
```
105105

106106
## Data Flow Example

docs/token-flow.md

+8-11
Original file line numberDiff line numberDiff line change
@@ -72,28 +72,25 @@ This document describes the token authentication flow between different componen
7272
| Expiration: 24 hours
7373

7474
2. **Backend to OvenMediaEngine:**
75-
- Uses Basic Authentication
76-
- Token from environment variable: `OVENMEDIA_API_TOKEN`
77-
- Format: `Basic <base64_encoded_token>`
75+
- Backend passes API requests to OvenMediaEngine with Basic Auth
76+
- Token from environment variable: `OME_API_ACCESS_TOKEN`
77+
- Encoded as Base64 in the Authorization header
7878

7979
### OvenMediaEngine Authentication
80-
- Expects Basic Authentication
81-
- Validates against configured access token
82-
- Returns 401 if token is invalid or missing
80+
- Configured to accept Basic Auth with a token
81+
- No sensitive tokens exposed to frontend
82+
- All API calls proxied through backend
8383

8484
## Environment Configuration
8585

8686
```env
8787
# Backend Environment Variables
8888
JWT_SECRET=your-super-secret-jwt-key-change-this-in-production
89-
OVENMEDIA_API_URL=http://origin:8081
90-
OVENMEDIA_API_TOKEN=0fc62ea62790ad7c
89+
OME_API_URL=http://origin:8081
90+
OME_API_ACCESS_TOKEN=0fc62ea62790ad7c
9191
9292
# Frontend Environment Variables
9393
VITE_API_URL=https://live.colourstream.johnrogerscolour.co.uk/api
94-
95-
# OvenMediaEngine Environment Variables
96-
OME_API_ACCESS_TOKEN=0fc62ea62790ad7c
9794
```
9895

9996
## Security Notes

frontend/src/components/OvenMediaConfig/README.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -118,9 +118,9 @@ const streamStats = await api.getStreamStats('default', 'app', 'stream');
118118

119119
```typescript
120120
// Frontend
121-
VITE_API_URL=https://your-domain.com/api // Points to your backend API
121+
VITE_API_URL=https://your-api-endpoint.com
122122

123123
// Backend (internal only)
124-
OVENMEDIA_API_URL=http://origin:8081 // Never expose to frontend
125-
OVENMEDIA_API_TOKEN=your-secret-token // Never expose to frontend
124+
OME_API_URL=http://origin:8081 // Never expose to frontend
125+
OME_API_ACCESS_TOKEN=your-secret-token // Never expose to frontend
126126
```

global.env.template

+4
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,10 @@ WEBAUTHN_ORIGIN=https://live.colourstream.example.com
2020
# API Configuration
2121
BASE_PATH=/api
2222

23+
# OvenMediaEngine Configuration
24+
OME_LIVE_DOMAIN=live.colourstream.example.com
25+
OME_VIDEO_DOMAIN=video.colourstream.example.com
26+
OME_API_ACCESS_TOKEN=your_ome_api_token_here
2327

2428
# MiroTalk Configuration
2529
HOST_PROTECTED=true

setup-ghcr.sh

+3-1
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ VIDEO_DOMAIN=video.colourstream.${domain_name}
142142
FRONTEND_URL=https://live.colourstream.${domain_name}
143143
BASE_PATH=/api
144144
OME_API_ACCESS_TOKEN=${ome_api_token}
145-
OME_API_URL=https://live.colourstream.${domain_name}:8081/v1/
145+
OME_API_URL=http://origin:8081
146146
EOL
147147
chmod 600 backend/.env
148148
echo "✅ Created backend/.env"
@@ -210,6 +210,8 @@ sed -i.bak "s/628db0ebd5d8c8fc4f539e7192fa6ff1/${db_password}/g" docker-compose.
210210
sed -i.bak "s/015a8afab726389330e5002945d9d27a7de31bc813/${jwt_key}/g" docker-compose.yml
211211
sed -i.bak "s/a4097b976531c94f5e4cf9d2676751c7/${admin_auth_secret}/g" docker-compose.yml
212212
sed -i.bak "s/0fc62ea62790ad7c/${ome_api_token}/g" docker-compose.yml
213+
sed -i.bak "s/41b20d4a33dcca381396b5b83053ef2f/${ome_api_token}/g" docker-compose.yml
214+
sed -i.bak "s/OME_API_ACCESS_TOKEN: \"[a-f0-9]*\"/OME_API_ACCESS_TOKEN: \"${ome_api_token}\"/g" docker-compose.yml
213215
sed -i.bak "s/turnserver123/${turn_password}/g" docker-compose.yml
214216
rm docker-compose.yml.bak
215217
echo "✅ Updated docker-compose.yml"

setup-template.sh

+22-1
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,22 @@ if [ -f "backend/.env.template" ]; then
169169
sed_inplace "s/OME_API_ACCESS_TOKEN=.*/OME_API_ACCESS_TOKEN=$ome_api_token/g" backend/.env
170170
fi
171171

172+
# Ensure OME_API_URL is properly set
173+
if ! grep -q "OME_API_URL" backend/.env; then
174+
echo "OME_API_URL=http://origin:8081" >> backend/.env
175+
else
176+
sed_inplace "s|OME_API_URL=.*|OME_API_URL=http://origin:8081|g" backend/.env
177+
fi
178+
179+
# Remove any old variable names to prevent confusion
180+
if grep -q "OVENMEDIA_API_URL" backend/.env; then
181+
sed_inplace "/OVENMEDIA_API_URL/d" backend/.env
182+
fi
183+
184+
if grep -q "OVENMEDIA_API_TOKEN" backend/.env; then
185+
sed_inplace "/OVENMEDIA_API_TOKEN/d" backend/.env
186+
fi
187+
172188
echo "✅ Created backend/.env"
173189
else
174190
echo "❌ backend/.env.template not found"
@@ -214,8 +230,13 @@ if [ -f "docker-compose.yml" ]; then
214230
# Update ADMIN_AUTH_SECRET in docker-compose.yml
215231
sed_inplace "s/ADMIN_AUTH_SECRET: [a-f0-9]*/ADMIN_AUTH_SECRET: $admin_auth_secret/g" docker-compose.yml
216232

217-
# Update OvenMediaEngine API Token
233+
# Update OvenMediaEngine API Token - handle both possible variable names
218234
sed_inplace "s/OME_API_ACCESS_TOKEN: \"[a-f0-9]*\"/OME_API_ACCESS_TOKEN: \"$ome_api_token\"/g" docker-compose.yml
235+
sed_inplace "s/OVENMEDIA_API_TOKEN: \"[a-f0-9]*\"/OME_API_ACCESS_TOKEN: \"$ome_api_token\"/g" docker-compose.yml
236+
237+
# Update any hardcoded tokens that might be in the file
238+
sed_inplace "s/0fc62ea62790ad7c/$ome_api_token/g" docker-compose.yml
239+
sed_inplace "s/41b20d4a33dcca381396b5b83053ef2f/$ome_api_token/g" docker-compose.yml
219240

220241
# Update TURN Server Credential
221242
sed_inplace "s/TURN_SERVER_CREDENTIAL: \"[^\"]*\"/TURN_SERVER_CREDENTIAL: \"$turn_password\"/g" docker-compose.yml

0 commit comments

Comments
 (0)