a little cleaning
This commit is contained in:
parent
39200808a1
commit
02861744f5
Binary file not shown.
Binary file not shown.
BIN
www/boris/astrocrowdbunker.png
Normal file
BIN
www/boris/astrocrowdbunker.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 25 KiB |
5
www/boris/cat.php
Normal file
5
www/boris/cat.php
Normal file
@ -0,0 +1,5 @@
|
||||
<?php
|
||||
|
||||
exec('cat ./{me,swarm}/.*/astroport/kodi/vstream/YASTRXBIAN | sort | uniq | tail -n +2', $files);
|
||||
|
||||
echo '<pre>'; print_r($files); echo '</pre>';
|
20
www/boris/conf.php
Normal file
20
www/boris/conf.php
Normal file
@ -0,0 +1,20 @@
|
||||
<?php
|
||||
|
||||
define('HOST', '127.0.0.1:8181');
|
||||
|
||||
/*
|
||||
|
||||
Youtube Thumbnails
|
||||
|
||||
maxresdefault Full resolution image matching the uploaded. This image will not always exist.
|
||||
sddefault 640x480
|
||||
hqdefault 480x360 Large Preview
|
||||
mqdefault 320x180 Large Preview
|
||||
default 120x 90 Large Preview
|
||||
0 480x360 Large Preview
|
||||
1 120x 90 First small thumbnail
|
||||
2 120x 90 Second small thumbnail
|
||||
3 120x 90 Third small thumbnail
|
||||
*/
|
||||
|
||||
define('YOUTUBE_THUMB', 'https://i.ytimg.com/vi/%s/mqdefault.jpg');
|
104
www/boris/crowdbunker.css
Normal file
104
www/boris/crowdbunker.css
Normal file
@ -0,0 +1,104 @@
|
||||
:root {
|
||||
|
||||
--pink: hsl(338.5, 72.8%, 36.1%);
|
||||
--canard: hsl(200.8, 100%, 9.6%);
|
||||
}
|
||||
|
||||
body {
|
||||
|
||||
background: #121212;
|
||||
color: white;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
font-family: Roboto,sans-serif;
|
||||
}
|
||||
|
||||
header {
|
||||
|
||||
background: var(--canard);
|
||||
overflow: hidden;
|
||||
margin-bottom: 2rem;
|
||||
|
||||
}
|
||||
|
||||
header * {
|
||||
|
||||
font-size: 1.5rem;
|
||||
padding: 0.5rem;
|
||||
margin: 0;
|
||||
color: var(--pink);
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
header span {
|
||||
|
||||
color: white;
|
||||
}
|
||||
|
||||
|
||||
main {
|
||||
|
||||
width: 80%;
|
||||
margin: auto;
|
||||
}
|
||||
|
||||
#videosList {
|
||||
|
||||
display: grid;
|
||||
grid-gap: 1rem 1rem;
|
||||
grid-auto-flow: row;
|
||||
grid-template-columns: 322px 322px 322px;
|
||||
|
||||
list-style: none;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
#videosList li {
|
||||
|
||||
background: var(--canard);
|
||||
border-color: var(--pink);
|
||||
border-radius: 0.25rem;
|
||||
border-width: 1px;
|
||||
border-style: solid;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
#videosList .video-title {
|
||||
|
||||
padding: 0.5rem 1rem;
|
||||
}
|
||||
|
||||
.video-title,
|
||||
.video-title a,
|
||||
.video-title a:visited {
|
||||
|
||||
color: white;
|
||||
font-weight: bold;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
article {
|
||||
|
||||
border-radius: 0.25rem;
|
||||
background: hsl(200.8, 100%, 9.6%);
|
||||
width: 58.3%;
|
||||
margin: auto;
|
||||
overflow: hidden;
|
||||
|
||||
}
|
||||
|
||||
article video {
|
||||
|
||||
width: 100%;
|
||||
max-height: 50vh;
|
||||
background: black;
|
||||
}
|
||||
|
||||
article .video-title {
|
||||
|
||||
font-weight: bold;
|
||||
padding: 1rem 1rem;
|
||||
font-size: 1.25rem;
|
||||
margin: 0;
|
||||
}
|
66
www/boris/functions.php
Normal file
66
www/boris/functions.php
Normal file
@ -0,0 +1,66 @@
|
||||
<?php
|
||||
|
||||
function getCollectionType ($filename) {
|
||||
|
||||
switch (substr($filename, 0, 1)) {
|
||||
|
||||
case 'F': return 'Films';
|
||||
|
||||
case 'Y': return 'Youtube';
|
||||
}
|
||||
}
|
||||
|
||||
function pingFile ($url) {
|
||||
|
||||
$ch = curl_init($url);
|
||||
curl_setopt($ch, CURLOPT_TIMEOUT, 3);
|
||||
//curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 3);
|
||||
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
||||
$data = curl_exec($ch);
|
||||
$httpcode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
|
||||
curl_close($ch);
|
||||
|
||||
return ($httpcode>=200 && $httpcode<300);
|
||||
}
|
||||
|
||||
function guessTypeFromFilename ($filename) {
|
||||
|
||||
$ext = substr($filename, (strrpos($filename, '.') + 1));
|
||||
|
||||
switch ($ext) {
|
||||
|
||||
case 'mkv':
|
||||
$type = 'video/mkv';
|
||||
break;
|
||||
|
||||
case 'flv':
|
||||
$type = 'video/flv';
|
||||
break;
|
||||
|
||||
case 'avi':
|
||||
$type = 'video/x-msvideo';
|
||||
break;
|
||||
|
||||
case 'webm':
|
||||
$type = 'video/webm';
|
||||
break;
|
||||
|
||||
case 'mkv':
|
||||
$type = 'video/x-matroska';
|
||||
break;
|
||||
|
||||
case '3gp':
|
||||
$type = 'video/3gp';
|
||||
break;
|
||||
|
||||
case 'ogv':
|
||||
$type = 'video/ogv';
|
||||
break;
|
||||
|
||||
default:
|
||||
$type = 'video/mp4';
|
||||
break;
|
||||
}
|
||||
|
||||
return $type;
|
||||
}
|
3
www/boris/get_youtube_videos.sh
Executable file
3
www/boris/get_youtube_videos.sh
Executable file
@ -0,0 +1,3 @@
|
||||
#!/bin/bash
|
||||
|
||||
cat ./{me,swarm}/.*/astroport/kodi/vstream/YASTRXBIAN | sort | uniq | tail -n +2
|
2
www/boris/index.php
Normal file
2
www/boris/index.php
Normal file
@ -0,0 +1,2 @@
|
||||
<?php
|
||||
header('Location: youtube.php');
|
71
www/boris/install.sh
Executable file
71
www/boris/install.sh
Executable file
@ -0,0 +1,71 @@
|
||||
#!/bin/bash
|
||||
########################################################################
|
||||
# Author: boris
|
||||
# Version: 0.1
|
||||
# License: AGPL-3.0 (https://choosealicense.com/licenses/agpl-3.0/)
|
||||
########################################################################
|
||||
MY_PATH="`dirname \"$0\"`" # relative
|
||||
MY_PATH="`( cd \"$MY_PATH\" && pwd )`" # absolutized and normalized
|
||||
ME="${0##*/}"
|
||||
YOU=$(ps auxf --sort=+utime | grep -w ipfs | grep -v -E 'color=auto|grep' | tail -n 1 | cut -d " " -f 1) && [[ ! $YOU ]] && echo "ipfs NOT RUNNING. EXIT" && exit 1
|
||||
G1PUB=$(cat ~/.zen/secret.dunikey | grep 'pub:' | cut -d ' ' -f 2) && [[ ! $G1PUB ]] && echo "ERREUR G1PUB. EXIT" && exit 1
|
||||
IPFSNODEID=$(ipfs id -f='<id>\n')
|
||||
|
||||
[[ $(which apache2) ]] && echo "Apache est installé. Le plugin nécessite nginx. EXIT" && exit 1
|
||||
[[ $(netstat -tan | grep ':10111 ') ]] && echo "Serveur web existant sur port 10111. Installation manuelle recommandée... EXIT" && exit 1
|
||||
|
||||
########################################################################
|
||||
## INSTALL nginx + php + mariadb + ...
|
||||
sudo apt-get update -y
|
||||
sudo apt-get install mariadb-server nginx python3-certbot-nginx certbot ssl-cert php-imap php-cli php-curl php-sqlite3 php-gd php-json php-xml php-mbstring php-gettext php-mysql php-fpm -y
|
||||
|
||||
#######################################################################
|
||||
## CREATE symlinks for ~/.zen/www/swarm & me
|
||||
mkdir -p ~/.zen/www/boris && cd ~/.zen/www/boris
|
||||
ln -s ../ipfs_swarm swarm
|
||||
ln -s ../ipfs me
|
||||
|
||||
########################################################################
|
||||
## ACTIVATE sites-available/astroport
|
||||
cd /etc/nginx/sites-enabled
|
||||
sudo ln -s ../sites-available/astroport astroport
|
||||
|
||||
########################################################################
|
||||
## CREATE site config file
|
||||
printf "
|
||||
server {
|
||||
listen 10111 default_server;
|
||||
listen [::]:10111 default_server;
|
||||
|
||||
root " | sudo tee /etc/nginx/sites-available/astroport
|
||||
|
||||
printf ~/.zen/www/boris | sudo tee -a /etc/nginx/sites-available/astroport
|
||||
|
||||
printf ";
|
||||
|
||||
# Add index.php to the list if you are using PHP
|
||||
index index.html index.htm index.nginx-debian.html;
|
||||
|
||||
server_name _;
|
||||
|
||||
location / {
|
||||
# First attempt to serve request as file, then
|
||||
# as directory, then fall back to displaying a 404.
|
||||
try_files \$uri \$uri/ =404;
|
||||
}
|
||||
|
||||
|
||||
index index.php;
|
||||
|
||||
# pass PHP scripts to FastCGI server
|
||||
|
||||
location ~ \.php$ {
|
||||
include snippets/fastcgi-php.conf;
|
||||
|
||||
# With php-fpm (or other unix sockets):
|
||||
fastcgi_pass unix:/var/run/php/php-fpm.sock;
|
||||
# With php-cgi (or other tcp sockets):
|
||||
#fastcgi_pass 127.0.0.1:9000;
|
||||
}
|
||||
}
|
||||
" | sudo tee -a /etc/nginx/sites-available/astroport
|
70
www/boris/swarm_files.php
Normal file
70
www/boris/swarm_files.php
Normal file
@ -0,0 +1,70 @@
|
||||
<?php
|
||||
require_once('conf.php');
|
||||
require_once('functions.php');
|
||||
|
||||
|
||||
|
||||
$dir = scandir("swarm", SCANDIR_SORT_DESCENDING) or die('fail');
|
||||
array_pop($dir); // .
|
||||
array_pop($dir); // ..
|
||||
|
||||
$swarm = array();
|
||||
|
||||
foreach ($dir as $d) {
|
||||
|
||||
$fst = substr($d, 0, 1);
|
||||
|
||||
if ($fst == '.') {
|
||||
|
||||
$swarm[] = $d;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
foreach ($swarm as $peer) {
|
||||
|
||||
$peerName = file_get_contents('swarm/' . $peer . '/G1SSB/_g1.astroport_title');
|
||||
|
||||
echo '<h2>'. $peerName . ' ['. substr($peer, 0, 5) . '…' . substr($peer, -4) . ']</h2>';
|
||||
|
||||
$files = scandir('swarm/' . $peer . '/astroport/kodi/vstream');
|
||||
|
||||
foreach ($files as $f) {
|
||||
|
||||
echo '<h3>' . getCollectionType($f) . '</h3>';
|
||||
|
||||
$collection = file_get_contents('swarm/' . $peer . '/astroport/kodi/vstream/' . $f);
|
||||
$collection = trim($collection);
|
||||
|
||||
$videos = explode("\n", $collection);
|
||||
$videos = array_reverse($videos);
|
||||
array_pop($videos);
|
||||
|
||||
echo '<ul>';
|
||||
|
||||
foreach ($videos as $v) {
|
||||
|
||||
list($a, $b, $c, $videoName, $e, $g, $h, $m, $videoURI) = explode(";", $v);
|
||||
|
||||
|
||||
$videoURL = 'http://'. HOST. $videoURI;
|
||||
$mimeType = guessTypeFromFilename($videoURL);
|
||||
|
||||
if ($mimeType == 'video/mp4') {
|
||||
|
||||
echo '<li>';
|
||||
echo '
|
||||
<a href="'. $videoURL . '">' . $videoName . '</a><br />
|
||||
('. $mimeType . ')<br />
|
||||
|
||||
<video controls width="320" height="240" preload="none">
|
||||
<source src="'. $videoURL .'" type="'. $mimeType .'">
|
||||
<a href="'. $videoURL . '">' . $videoName . '</a>
|
||||
</video>';
|
||||
|
||||
echo '</li>';
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
80
www/boris/youtube.php
Normal file
80
www/boris/youtube.php
Normal file
@ -0,0 +1,80 @@
|
||||
<?php
|
||||
require_once('conf.php');
|
||||
require_once('functions.php');
|
||||
|
||||
|
||||
$videosList = array();
|
||||
|
||||
exec("/bin/bash -c './get_youtube_videos.sh'", $videos);
|
||||
$videos = array_reverse($videos);
|
||||
|
||||
foreach ($videos as $v) {
|
||||
|
||||
list($a, $youtubeID, $c, $videoName, $e, $src, $h, $quality, $videoURI) = explode(";", $v);
|
||||
|
||||
|
||||
$videoURL = 'http://'. HOST. $videoURI;
|
||||
$mimeType = guessTypeFromFilename($videoURI);
|
||||
|
||||
|
||||
if ($mimeType == 'video/mp4') {
|
||||
|
||||
$videosList[] = [
|
||||
'mime' => $mimeType,
|
||||
'url' => $videoURL,
|
||||
'uri' => $videoURI,
|
||||
'name' => $videoName,
|
||||
'youtubeID' => $youtubeID
|
||||
];
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
?><!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>AstroCrowdBuster</title>
|
||||
<link rel="stylesheet" href="crowdbunker.css" type="text/css" />
|
||||
<link rel="icon" type="image/png" href="/astrocrowdbunker.png" />
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<header>
|
||||
<h1>
|
||||
<a href="youtube.php"><span>Astroport</span> × <span>Crowdbunker</span></a>
|
||||
</h1>
|
||||
</header>
|
||||
|
||||
<main>
|
||||
<?php
|
||||
echo '<ul id="videosList">';
|
||||
|
||||
foreach ($videosList as $video) {
|
||||
|
||||
echo '<li>';
|
||||
|
||||
$href = 'youtube_watch.php?uri='. $video['uri'] . '&name='. urlencode($video['name']) .'&mime='. $video['mime'];
|
||||
|
||||
echo '
|
||||
|
||||
<a href="'. $href .'">
|
||||
<img src="'. sprintf(YOUTUBE_THUMB, $video['youtubeID']) . '" alt="'. $video['name'] . '" />
|
||||
</a>
|
||||
|
||||
<p class="video-title">
|
||||
<a href="'. $href .'">
|
||||
' . $video['name'] . '
|
||||
</a>
|
||||
</p>';
|
||||
|
||||
echo '</li>';
|
||||
}
|
||||
|
||||
echo '</ul>';
|
||||
?>
|
||||
</main>
|
||||
|
||||
|
||||
</body>
|
||||
</html>
|
43
www/boris/youtube_watch.php
Normal file
43
www/boris/youtube_watch.php
Normal file
@ -0,0 +1,43 @@
|
||||
<?php
|
||||
require_once('functions.php');
|
||||
require_once('conf.php');
|
||||
|
||||
$videoURL = 'http://'. HOST. htmlentities($_GET['uri']);
|
||||
$videoName = htmlentities(urldecode($_GET['name']));
|
||||
$videoMIME = htmlentities($_GET['mime']);
|
||||
|
||||
?><!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>AstroCrowdBuster</title>
|
||||
<link rel="stylesheet" href="crowdbunker.css" type="text/css" />
|
||||
<link rel="icon" type="image/png" href="/astrocrowdbunker.png" />
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<header>
|
||||
<h6>
|
||||
<a href="youtube.php"><span>Astroport</span> × <span>Crowdbunker</span></a>
|
||||
</h6>
|
||||
</header>
|
||||
|
||||
<main>
|
||||
<?php
|
||||
echo '
|
||||
<article>
|
||||
<video autoplay="autoplay" controls>
|
||||
<source src="'. $videoURL .'" type="'. $videoMIME .'">
|
||||
<a href="'. $videoURL . '">' . $videoName . '</a>
|
||||
</video>
|
||||
|
||||
<h1 class="video-title">
|
||||
' . $videoName . '
|
||||
</h1>
|
||||
</article>';
|
||||
?>
|
||||
</main>
|
||||
|
||||
|
||||
|
||||
</body>
|
||||
</html>
|
0
www/multitube/index.php
Normal file
0
www/multitube/index.php
Normal file
@ -1,3 +1,9 @@
|
||||
DEPRECATED - TO REMOVE
|
||||
|
||||
Maintenant les fichiers index sont accessibles par la passerelle IPFS
|
||||
|
||||
---
|
||||
|
||||
Ce répertoire contient les INDEX des liens de streaming utilisés par le plugin Vstream, site "ASTROPORT"
|
||||
|
||||
Il est rendu accessible au travers de nginx http://localhost:10021/ tel que configuré dans ~/.kodi/addons/plugin.video.vstream/resources/sites/astroport.py
|
||||
|
Loading…
Reference in New Issue
Block a user