Update livestream config

This commit is contained in:
Daniel Supernault 2022-06-01 00:13:44 -06:00
parent 5206f21f59
commit 00770c6002
No known key found for this signature in database
GPG key ID: 0DEF1C662C9033F7
3 changed files with 28 additions and 6 deletions

View file

@ -217,4 +217,20 @@ class LiveStreamController extends Controller
return;
}
public function getConfig(Request $request)
{
abort_if(!config('livestreaming.enabled'), 400);
abort_if(!$request->user(), 403);
$res = [
'enabled' => config('livestreaming.enabled'),
'broadcast' => [
'sources' => config('livestreaming.broadcast.sources'),
'limits' => config('livestreaming.broadcast.limits')
],
];
return response()->json($res, 200, [], JSON_UNESCAPED_SLASHES);
}
}

View file

@ -10,14 +10,19 @@ return [
],
'broadcast' => [
'max_duration' => env('HLS_LIVE_BROADCAST_MAX_DURATION', 60),
'max_active' => env('HLS_LIVE_BROADCAST_MAX_ACTIVE', 10),
'max_duration' => (int) env('HLS_LIVE_BROADCAST_MAX_DURATION', 60),
'max_active' => (int) env('HLS_LIVE_BROADCAST_MAX_ACTIVE', 10),
'limits' => [
'enabled' => env('HLS_LIVE_BROADCAST_LIMITS', true),
'min_follower_count' => env('HLS_LIVE_BROADCAST_LIMITS_MIN_FOLLOWERS', 100),
'min_account_age' => env('HLS_LIVE_BROADCAST_LIMITS_MIN_ACCOUNT_AGE', 14),
'admins_only' => env('HLS_LIVE_BROADCAST_LIMITS_ADMINS_ONLY', true)
'enabled' => (bool) env('HLS_LIVE_BROADCAST_LIMITS', true),
'min_follower_count' => (int) env('HLS_LIVE_BROADCAST_LIMITS_MIN_FOLLOWERS', 100),
'min_account_age' => (int) env('HLS_LIVE_BROADCAST_LIMITS_MIN_ACCOUNT_AGE', 14),
'admins_only' => (bool) env('HLS_LIVE_BROADCAST_LIMITS_ADMINS_ONLY', true)
],
'sources' => [
'app' => (bool) env('HLS_LIVE_BROADCAST_SOURCE_APP', false),
'web' => (bool) env('HLS_LIVE_BROADCAST_SOURCE_WEB', false)
]
],

View file

@ -105,5 +105,6 @@ Route::group(['prefix' => 'api'], function() use($middleware) {
Route::get('chat/latest', 'LiveStreamController@getLatestChat')->middleware($middleware);
Route::post('chat/message', 'LiveStreamController@addChatComment')->middleware($middleware);
Route::post('chat/delete', 'LiveStreamController@deleteChatComment')->middleware($middleware);
Route::get('config', 'LiveStreamController@getConfig')->middleware($middleware);
});
});