git.cweiske.de
/
playVideoOnDreamboxProxy.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Add CORS header for firefox extension
[playVideoOnDreamboxProxy.git]
/
www
/
play.php
diff --git
a/www/play.php
b/www/play.php
index 36f3e6c56e7009e02144f488b9d675f943d28eb3..d96764d3a8b7487c2ae99c58be9865dc407fbb00 100644
(file)
--- a/
www/play.php
+++ b/
www/play.php
@@
-1,6
+1,6
@@
<?php
$youtubedlPath = '/usr/bin/youtube-dl';
<?php
$youtubedlPath = '/usr/bin/youtube-dl';
-$dreambox
Host = '
dreambox';
+$dreambox
Url = 'http://
dreambox';
require_once __DIR__ . '/functions.php';
$cfgFile = __DIR__ . '/../data/config.php';
require_once __DIR__ . '/functions.php';
$cfgFile = __DIR__ . '/../data/config.php';
@@
-8,6
+8,16
@@
if (file_exists($cfgFile)) {
include $cfgFile;
}
include $cfgFile;
}
+//for the firefox extension
+header('Access-Control-Allow-Origin: *');
+
+if (isset($_SERVER['REQUEST_METHOD']) && $_SERVER['REQUEST_METHOD'] == 'GET') {
+ require __DIR__ . '/form.php';
+ exit();
+}
+
+set_error_handler('errorHandlerStore');
+
$pageUrl = getPageUrl();
$json = getYoutubeDlJson($pageUrl, $youtubedlPath);
$videoUrl = extractVideoUrlFromJson($json);
$pageUrl = getPageUrl();
$json = getYoutubeDlJson($pageUrl, $youtubedlPath);
$videoUrl = extractVideoUrlFromJson($json);
@@
-16,7
+26,7
@@
if (php_sapi_name() == 'cli') {
} else {
header('Video-URL: ' . $videoUrl);
}
} else {
header('Video-URL: ' . $videoUrl);
}
-playVideoOnDreambox($videoUrl, $dreambox
Host
);
+playVideoOnDreambox($videoUrl, $dreambox
Url
);
function errorInput($msg)
function errorInput($msg)