astroport-webui/youtube_watch.php

35 lines
860 B
PHP

<?php
require_once('functions.php');
require_once('conf/conf.php');
function astroport_urlencode ($str) {
$str = str_replace('%', '%25', $str);
$str = str_replace('#', '%23', $str);
return $str;
}
$videoURI = urldecode($_GET['uri']);
list($a, $ipfsPath, $videoIPFS_ID, $videoFileName) = explode('/', $videoURI);
$videoURL = 'http://'. HOST. '/' . urlencode($ipfsPath) . '/' . urlencode($videoIPFS_ID) . '/' . astroport_urlencode($videoFileName);
$videoName = htmlspecialchars(urldecode($_GET['name']));
$videoMIME = htmlspecialchars($_GET['mime']);
include('inc/header.php');
echo '
<article>
<video autoplay="autoplay" controls>
<source src="'. $videoURL .'" type="'. $videoMIME .'">
</video>
<h1 class="video-title">
' . $videoName . '
</h1>
<p>
<a href="'. $videoURL . '">Télécharger</a>
</p>
</article>';
include('inc/footer.php');