Skip to content

Commit

Permalink
Update
Browse files Browse the repository at this point in the history
  • Loading branch information
Daniel Neto committed Oct 25, 2024
1 parent 59310bf commit af4383a
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions plugin/Live/authorizeKeyAccess.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ function getTmpFilePath($key)

// Define a regular expression to capture the key and token parts
$pattern = '#/live/([^/]+)/[0-9]+\.key\?token=([^&]+)#i';

$token = '';
// Match the pattern with the URI
if (preg_match($pattern, $uri, $matches)) {
// $matches[1] contains the key
Expand Down Expand Up @@ -93,11 +93,8 @@ function getTmpFilePath($key)
require_once dirname(__FILE__) . '/../../videos/configuration.php';
AVideoPlugin::loadPluginIfEnabled('VideoHLS');
if (class_exists('VideoHLS')) {
if (!empty($token)) {
// Example logic: verify based on IP, user agent, or requested key
if (VideoHLS::verifyToken($token)) {
$authorized = true;
}
if (VideoHLS::verifyToken($token)) {
$authorized = true;
}
if (!$authorized) {
http_response_code(403);
Expand Down

0 comments on commit af4383a

Please sign in to comment.