From 74e478fedac12d5dcc18f51e8b9bb9a40d45219e Mon Sep 17 00:00:00 2001 From: Boris Date: Sat, 18 Sep 2021 23:57:50 +0200 Subject: [PATCH] =?UTF-8?q?ENH:=20titres=20r=C3=A9cup=C3=A9r=C3=A9s=20depu?= =?UTF-8?q?is=20le=20json?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- www/boris/ajouter_video_youtube.sh | 90 +++++ www/boris/conf.php | 6 + www/boris/functions.php | 69 ++++ www/boris/get_ipfs_node_id.sh | 5 + www/boris/get_youtube_videos.sh | 6 + www/boris/inc/footer.php | 13 + www/boris/inc/header.php | 63 +++ www/boris/php-ipfs-api/LICENSE | 10 + www/boris/php-ipfs-api/README.md | 113 ++++++ www/boris/php-ipfs-api/composer.json | 25 ++ www/boris/php-ipfs-api/composer.lock | 21 + www/boris/php-ipfs-api/src/IPFS.php | 129 ++++++ www/boris/php-ipfs-api/vendor/autoload.php | 7 + .../php-ipfs-api/vendor/composer/ClassLoader.php | 445 +++++++++++++++++++++ www/boris/php-ipfs-api/vendor/composer/LICENSE | 19 + .../vendor/composer/autoload_classmap.php | 9 + .../vendor/composer/autoload_namespaces.php | 9 + .../php-ipfs-api/vendor/composer/autoload_psr4.php | 10 + .../php-ipfs-api/vendor/composer/autoload_real.php | 55 +++ .../vendor/composer/autoload_static.php | 31 ++ .../php-ipfs-api/vendor/composer/installed.json | 1 + www/boris/styles/astroport/decoration.css | 73 ++++ www/boris/styles/astroport/layout.css | 1 + www/boris/styles/astroport/style.css | 119 +----- www/boris/styles/crowdbunker/decoration.css | 102 +++++ www/boris/styles/crowdbunker/layout.css | 1 + www/boris/styles/crowdbunker/style.css | 106 +---- www/boris/styles/default/layout.css | 131 ++++++ www/boris/youtube.php | 81 ++-- www/boris/youtube_add_video_aux.php | 22 + 30 files changed, 1511 insertions(+), 261 deletions(-) create mode 100755 www/boris/ajouter_video_youtube.sh create mode 100755 www/boris/get_ipfs_node_id.sh create mode 100755 www/boris/get_youtube_videos.sh create mode 100644 www/boris/inc/footer.php create mode 100644 www/boris/inc/header.php create mode 100644 www/boris/php-ipfs-api/LICENSE create mode 100644 www/boris/php-ipfs-api/README.md create mode 100644 www/boris/php-ipfs-api/composer.json create mode 100644 www/boris/php-ipfs-api/composer.lock create mode 100644 www/boris/php-ipfs-api/src/IPFS.php create mode 100644 www/boris/php-ipfs-api/vendor/autoload.php create mode 100644 www/boris/php-ipfs-api/vendor/composer/ClassLoader.php create mode 100644 www/boris/php-ipfs-api/vendor/composer/LICENSE create mode 100644 www/boris/php-ipfs-api/vendor/composer/autoload_classmap.php create mode 100644 www/boris/php-ipfs-api/vendor/composer/autoload_namespaces.php create mode 100644 www/boris/php-ipfs-api/vendor/composer/autoload_psr4.php create mode 100644 www/boris/php-ipfs-api/vendor/composer/autoload_real.php create mode 100644 www/boris/php-ipfs-api/vendor/composer/autoload_static.php create mode 100644 www/boris/php-ipfs-api/vendor/composer/installed.json create mode 100644 www/boris/styles/astroport/decoration.css create mode 120000 www/boris/styles/astroport/layout.css create mode 100644 www/boris/styles/crowdbunker/decoration.css create mode 120000 www/boris/styles/crowdbunker/layout.css create mode 100644 www/boris/styles/default/layout.css create mode 100644 www/boris/youtube_add_video_aux.php diff --git a/www/boris/ajouter_video_youtube.sh b/www/boris/ajouter_video_youtube.sh new file mode 100755 index 0000000..0351278 --- /dev/null +++ b/www/boris/ajouter_video_youtube.sh @@ -0,0 +1,90 @@ +#!/bin/bash +######################################################################## +# Author: Fred (support@qo-op.com) +# Version: 0.1 +# License: AGPL-3.0 (https://choosealicense.com/licenses/agpl-3.0/) +######################################################################## +# SCRIPT INTERACTIF POUR AJOUTER UN FICHIER à ASTROPORT/KODI +# +# 1. CAT: film, serie, anime +# 2. TMDB: ID de la fiche sur https://www.themoviedb.org/ +# 3. TITLE: Titre de la vidéo +# 4. YEAR: Année de la vidéo +# 5. RES: Résolution 1080p, 4K, SD, 720, HD +# 6. SAISON: Pour les séries et animes, c'est le numéro de saison. +# Pour un film, le champ SAISON est utilisé pour renseigner la Saga +# 7. GENRES: Action, Aventure, Fantastique, Animation, etc (choix multiple). +# 8. GROUPES: Permet de regrouper des films. (choix multiple) +# +# https://github.com/Kodi-vStream/venom-xbmc-addons/wiki/Voir-et-partager-sa-biblioth%C3%A8que-priv%C3%A9e#d%C3%A9clarer-des-films +######################################################################## +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 +HOME=/home/$YOU +######################################################################## +MY_PATH="`dirname \"$0\"`" # relative +MY_PATH="`( cd \"$MY_PATH\" && pwd )`" # absolutized and normalized +ME="${0##*/}" +######################################################################## + + +######################################################################## +IPFSNODEID=$(ipfs id -f='\n') +[[ -f ~/.zen/ipfs/.$IPFSNODEID/G1SSB/_g1.gchange_title ]] && XZUID=$(cat ~/.zen/ipfs/.$IPFSNODEID/G1SSB/_g1.gchange_title) || XZUID=$(cat /etc/hostname) + + +######################################################################## +# CASE ## YOUTUBE +######################################################################## + +#YTURL=$(zenity --entry --width 300 --title "Lien ou identifiant à copier" --text "Indiquez le lien (URL) ou l'ID de la vidéo" --entry-text="") +YTURL=$1 +[[ $YTURL == "" ]] && exit 1 + +# Create TEMP directory to copy $YID_$TITLE.$FILE_EXT +YTEMP="/tmp/$(date -u +%s%N | cut -b1-13)" +mkdir -p ${YTEMP} + +# youtube-dl $YTURL +echo "VIDEO $YTURL" +/usr/local/bin/youtube-dl -f '[height=720]/best' \ +--write-info-json --write-annotations \ +--no-mtime -o "${YTEMP}/%(id)s_%(title)s.%(ext)s" $YTURL + +# Get filename, extract ID, make destination dir and move copy. +YFILE=$(ls -t ${YTEMP} | head -n 1) +FILE_NAME="$(basename "${YFILE}")" +FILE_EXT="${FILE_NAME##*.}" + +YID=$(echo "${FILE_NAME}" | cut -d "_" -f 1) +YNAME=$(echo "${FILE_NAME}" | cut -d "_" -f 2-) +TMDB="${YID}" + +FILE_PATH="$HOME/astroport/youtube/$YID" +echo "Creating directory $FILE_PATH" +mkdir -p -v --mode=775 $FILE_PATH || echo "Directory creation failed :-(" +echo "Moving files there..." +mv -f ${YTEMP}/* ${FILE_PATH}/ + +## CORRECT PARAMETERS to Make Kodi compatible YASTRXBIAN FILE +TITLE="${YNAME%.*}" +GENRES="[Youtube]" +GROUPES="_IPNSKEY_" +FILE_RES=$(ffprobe -v error -select_streams v:0 -show_entries stream=width,height -of csv=s=x:p=0 "${FILE_PATH}/${FILE_NAME}" | cut -d "x" -f 2) +RES=${FILE_RES%?}0p + +## CREATE "~/astroport/${CAT}/${TMDB}/ajouter_video.txt" (with film CAT !!!) +URLENCODE_FILE_NAME=$(echo ${FILE_NAME} | jq -Rr @uri) +echo "film;${TMDB};${YEAR};${TITLE};${SAISON};${GENRES};${GROUPES};${RES};/ipfs/_IPFSREPFILEID_/$URLENCODE_FILE_NAME" > ~/astroport/youtube/${TMDB}/ajouter_video.txt +# _IPFSREPFILEID_ is replaced later + +rm -Rf ${YTEMP} + + +######################################################################## +# ADD $FILE to IPFS / ASTROPORT / KODI +######################################################################## +./new_youtube_video_in_astroport.sh "$HOME/astroport/youtube/${TMDB}/" "${FILE_NAME}" > /tmp/youtube_${TMDB}.log 2>&1 +######################################################################## +######################################################################## + +exit 0 diff --git a/www/boris/conf.php b/www/boris/conf.php index db48ed2..85ccb54 100644 --- a/www/boris/conf.php +++ b/www/boris/conf.php @@ -3,6 +3,12 @@ define('STATION_NAME', exec('cat ../../../ipfs/.12D*/_xbian.zuid')); define('HOST', 'astroport'); define('THEME', 'astroport'); +define('SITENAME', 'Astroport "' . STATION_NAME . '"'); + +define('IPFS_API_PORT', 5001); +define('IPFS_HOST', '127.0.0.1'); + +define('TAGLINE', 'Bienvenue chez vous'); /* diff --git a/www/boris/functions.php b/www/boris/functions.php index 578aa54..0265331 100644 --- a/www/boris/functions.php +++ b/www/boris/functions.php @@ -64,3 +64,72 @@ function guessTypeFromFilename ($filename) { return $type; } + +function astroport_urlencode ($str) { + + $str = str_replace('%', '%25', $str); + $str = str_replace('#', '%23', $str); + $str = str_replace('\'', '%27', $str); + $str = str_replace('"', '%22', $str); + + return $str; +} + +function quickfix_getYoutubeIdFromIpfsFileName ($name) { + + return substr($name, 0, 11); + +} + +function quickfix_getVideoNameFromIpfsFileName ($name) { + + //$name = substr($name, 12); + $name = substr($name, 0, strrpos($name, '.')); + + return $name; +} + +function formatDuration ($seconds) { + + $h = floor($seconds / 3600); + $h_r = $seconds % 3600; + $m = floor($h_r / 60); + $s = $h_r % 60; + + if ($h != 0) { + + return sprintf("%s:%s:%s", $h, str_pad($m, 2, '0', STR_PAD_LEFT), str_pad($s, 2, '0', STR_PAD_LEFT)); + + } else { + + return sprintf("%s:%s", $m, str_pad($s, 2, '0', STR_PAD_LEFT)); + + } +} + +function getVideoJson ($ipnsHash) { + + exec("/bin/bash -c './get_ipfs_node_id.sh'", $output); + // echo '
'; var_dump($output); echo '
'; + $ipfsNodeId = $output[0]; + + $indexHTML = file_get_contents('http://' . HOST . '/ipns/' . $ipnsHash . '/index.html'); + + // $indexHTML = file_get_contents('http://' . HOST . '/ipns/' . $ipfsNodeId . '/.' . $ipfsNodeId . '/KEY/'); + + + + $re = '!/ipns/[^/]+/([^/]+)/!isU'; + + preg_match($re, $indexHTML, $matches); + + $ipnsHiddenHash = $matches[1]; + + $indexHTML = file_get_contents('http://' . HOST . '/ipns/' . $ipnsHash . '/' . $ipnsHiddenHash . '/video.json'); + + if (isset($indexHTML)) { + + return json_decode($indexHTML); + } + +} diff --git a/www/boris/get_ipfs_node_id.sh b/www/boris/get_ipfs_node_id.sh new file mode 100755 index 0000000..184cae0 --- /dev/null +++ b/www/boris/get_ipfs_node_id.sh @@ -0,0 +1,5 @@ +#!/bin/bash + +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 +IPFSNODEID=$(ipfs --timeout=20s id -f='\n') +echo -n $IPFSNODEID diff --git a/www/boris/get_youtube_videos.sh b/www/boris/get_youtube_videos.sh new file mode 100755 index 0000000..b129d9d --- /dev/null +++ b/www/boris/get_youtube_videos.sh @@ -0,0 +1,6 @@ +#!/bin/bash + +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 + + +cat /home/$YOU/.zen/ipfs*/.*/astroport/kodi/vstream/YASTRXBIAN | sort | uniq | tail -n +2 diff --git a/www/boris/inc/footer.php b/www/boris/inc/footer.php new file mode 100644 index 0000000..12c04fe --- /dev/null +++ b/www/boris/inc/footer.php @@ -0,0 +1,13 @@ + + + + + + diff --git a/www/boris/inc/header.php b/www/boris/inc/header.php new file mode 100644 index 0000000..e232883 --- /dev/null +++ b/www/boris/inc/header.php @@ -0,0 +1,63 @@ + + + + Astroport "<?php echo STATION_NAME; ?> + + + + + +
+ + + <> + Astroport "" + > + +

+ +

+ +
+ + Votre vidéo est en cours de téléchargement…

+ + + '; + + $placeholder = htmlspecialchars($_POST['youtube_url']); + } + ?> + + + + +
+
+ +
diff --git a/www/boris/php-ipfs-api/LICENSE b/www/boris/php-ipfs-api/LICENSE new file mode 100644 index 0000000..18578fe --- /dev/null +++ b/www/boris/php-ipfs-api/LICENSE @@ -0,0 +1,10 @@ +The MIT License (MIT) + +Copyright (c) 2015-2016 Vincent Cloutier +Copyright (c) 2016 S3r3nity Technologies + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/www/boris/php-ipfs-api/README.md b/www/boris/php-ipfs-api/README.md new file mode 100644 index 0000000..3a3186f --- /dev/null +++ b/www/boris/php-ipfs-api/README.md @@ -0,0 +1,113 @@ +IPFS API wrapper library in PHP +====================================== + +![](https://ipfs.io/ipfs/QmQJ68PFMDdAsgCZvA1UVzzn18asVcf7HVvCDgpjiSCAse) + +> A client library for the IPFS API. + +Good news everyone! [S3r3nity](http://www.s3r3nity.com/) is sponsoring the development of this library. +They will be using it inside one of their (unannounced) projects and its maintainer is hired +to implement all the missing api calls (including the new file api) before the end of September 2016. + +**Warning:** Changes will be made from user's suggestions and this warning will be removed when everything is stable. +First stable release is scheduled for the end of September 2016. + +# Usage + +## Installing + +This library requires the cURL module: + +```bash +$ sudo apt-get install php5-curl +$ composer require cloutier/php-ipfs-api +$ composer install +``` + +```PHP +use Cloutier\PhpIpfsApi\IPFS; + +// connect to ipfs daemon API server +$ipfs = new IPFS("localhost", "8080", "5001"); // leaving out the arguments will default to these values +``` + + + +## API + + +#### add + +Adds content to IPFS. + +**Usage** +```PHP +$hash = $ipfs->add("Hello world"); +``` + + + +#### cat + +Retrieves the contents of a single hash. + +**Usage** +```PHP +$ipfs->cat($hash); +``` + +#### ls +Gets the node structure of a hash. + +**Usage** +```PHP +$obj = $ipfs->ls($hash); + +foreach ($obj as $e) { + echo $e['Hash']; + echo $e['Size']; + echo $e['Name']; +} +``` + + +#### Object size + +Returns object size. + +**Usage** +```PHP +$size = $ipfs->size($hash); +``` + +#### Pin + +Pin or unpin a hash. + +**Usage** +```PHP +$ipfs->pinAdd($hash); +$ipfs->pinRm($hash); +``` + +#### Pin + +Get information about your ipfs node. + +**Usage** +```PHP +print_r($ipfs->id()); +``` + +# License + +The MIT License (MIT) + +Copyright (c) 2015-2016 Vincent Cloutier +Copyright (c) 2016 S3r3nity Technologies + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/www/boris/php-ipfs-api/composer.json b/www/boris/php-ipfs-api/composer.json new file mode 100644 index 0000000..0dc7a60 --- /dev/null +++ b/www/boris/php-ipfs-api/composer.json @@ -0,0 +1,25 @@ +{ + "name": "cloutier/php-ipfs-api", + "type": "library", + "description": "A client library for the IPFS API", + "keywords": ["ipfs"], + "homepage": "https://github.com/cloutier/php-ipfs-api", + "license": "MIT", + "authors": [ + { + "name": "Vincent Cloutier", + "email": "vincent@cloutier.co", + "homepage": "http://vincent.cloutier.co", + "role": "Developer" + } + ], + "require": { + "php": ">=5.3.0", + "ext-curl": "*" + }, + "autoload": { + "psr-4": { + "Cloutier\\PhpIpfsApi\\": "src/" + } + } +} diff --git a/www/boris/php-ipfs-api/composer.lock b/www/boris/php-ipfs-api/composer.lock new file mode 100644 index 0000000..281b477 --- /dev/null +++ b/www/boris/php-ipfs-api/composer.lock @@ -0,0 +1,21 @@ +{ + "_readme": [ + "This file locks the dependencies of your project to a known state", + "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", + "This file is @generated automatically" + ], + "content-hash": "1128371a4702e5be4d07d705b7c25765", + "packages": [], + "packages-dev": [], + "aliases": [], + "minimum-stability": "stable", + "stability-flags": [], + "prefer-stable": false, + "prefer-lowest": false, + "platform": { + "php": ">=5.3.0", + "ext-curl": "*" + }, + "platform-dev": [], + "plugin-api-version": "1.1.0" +} diff --git a/www/boris/php-ipfs-api/src/IPFS.php b/www/boris/php-ipfs-api/src/IPFS.php new file mode 100644 index 0000000..4282f36 --- /dev/null +++ b/www/boris/php-ipfs-api/src/IPFS.php @@ -0,0 +1,129 @@ +gatewayIP = $ip; + $this->gatewayPort = $port; + $this->gatewayApiPort = $apiPort; + } + + public function cat ($hash) { + $ip = $this->gatewayIP; + $port = $this->gatewayPort; + return $this->curl("http://$ip:$port/ipfs/$hash"); + + } + + public function add ($content) { + $ip = $this->gatewayIP; + $port = $this->gatewayApiPort; + + $req = $this->curl("http://$ip:$port/api/v0/add?stream-channels=true", $content); + $req = json_decode($req, TRUE); + + return $req['Hash']; + } + + public function ls ($hash) { + $ip = $this->gatewayIP; + $port = $this->gatewayApiPort; + + $response = $this->curl("http://$ip:$port/api/v0/ls/$hash"); + + $data = json_decode($response, TRUE); + + return $data['Objects'][0]['Links']; + } + + public function size ($hash) { + $ip = $this->gatewayIP; + $port = $this->gatewayApiPort; + + $response = $this->curl("http://$ip:$port/api/v0/object/stat/$hash"); + $data = json_decode($response, TRUE); + + return $data['CumulativeSize']; + } + + public function pinAdd ($hash) { + + $ip = $this->gatewayIP; + $port = $this->gatewayApiPort; + + $response = $this->curl("http://$ip:$port/api/v0/pin/add/$hash"); + $data = json_decode($response, TRUE); + + return $data; + } + + public function pinRm ($hash) { + + $ip = $this->gatewayIP; + $port = $this->gatewayApiPort; + + $response = $this->curl("http://$ip:$port/api/v0/pin/rm/$hash"); + $data = json_decode($response, TRUE); + + return $data; + } + + public function version () { + + $ip = $this->gatewayIP; + $port = $this->gatewayApiPort; + + $response = $this->curl("http://$ip:$port/api/v0/version"); + $data = json_decode($response, TRUE); + + return $data['Version']; + } + + public function id () { + + $ip = $this->gatewayIP; + $port = $this->gatewayApiPort; + + $response = $this->curl("http://$ip:$port/api/v0/id"); + $data = json_decode($response, TRUE); + + return $data; + } + + private function curl ($url, $data = "") { + $ch = curl_init(); + + curl_setopt($ch, CURLOPT_URL, $url); + curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1); + curl_setopt($ch, CURLOPT_TIMEOUT, 5); + curl_setopt($ch, CURLOPT_HEADER, 0); + curl_setopt($ch, CURLOPT_BINARYTRANSFER,1); + + if ($data != "") { + curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: multipart/form-data; boundary=a831rwxi1a3gzaorw1w2z49dlsor')); + curl_setopt($ch, CURLOPT_POST, 1); + curl_setopt($ch, CURLOPT_POSTFIELDS, "--a831rwxi1a3gzaorw1w2z49dlsor\r\nContent-Type: application/octet-stream\r\nContent-Disposition: file; \r\n\r\n" . $data . "\r\n--a831rwxi1a3gzaorw1w2z49dlsor"); + } + + $output = curl_exec($ch); + + if ($output == FALSE) { + //todo: when ipfs doesn't answer + } + curl_close($ch); + + + return $output; + } +} + + diff --git a/www/boris/php-ipfs-api/vendor/autoload.php b/www/boris/php-ipfs-api/vendor/autoload.php new file mode 100644 index 0000000..1246220 --- /dev/null +++ b/www/boris/php-ipfs-api/vendor/autoload.php @@ -0,0 +1,7 @@ + + * Jordi Boggiano + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Composer\Autoload; + +/** + * ClassLoader implements a PSR-0, PSR-4 and classmap class loader. + * + * $loader = new \Composer\Autoload\ClassLoader(); + * + * // register classes with namespaces + * $loader->add('Symfony\Component', __DIR__.'/component'); + * $loader->add('Symfony', __DIR__.'/framework'); + * + * // activate the autoloader + * $loader->register(); + * + * // to enable searching the include path (eg. for PEAR packages) + * $loader->setUseIncludePath(true); + * + * In this example, if you try to use a class in the Symfony\Component + * namespace or one of its children (Symfony\Component\Console for instance), + * the autoloader will first look for the class under the component/ + * directory, and it will then fallback to the framework/ directory if not + * found before giving up. + * + * This class is loosely based on the Symfony UniversalClassLoader. + * + * @author Fabien Potencier + * @author Jordi Boggiano + * @see http://www.php-fig.org/psr/psr-0/ + * @see http://www.php-fig.org/psr/psr-4/ + */ +class ClassLoader +{ + // PSR-4 + private $prefixLengthsPsr4 = array(); + private $prefixDirsPsr4 = array(); + private $fallbackDirsPsr4 = array(); + + // PSR-0 + private $prefixesPsr0 = array(); + private $fallbackDirsPsr0 = array(); + + private $useIncludePath = false; + private $classMap = array(); + private $classMapAuthoritative = false; + private $missingClasses = array(); + private $apcuPrefix; + + public function getPrefixes() + { + if (!empty($this->prefixesPsr0)) { + return call_user_func_array('array_merge', $this->prefixesPsr0); + } + + return array(); + } + + public function getPrefixesPsr4() + { + return $this->prefixDirsPsr4; + } + + public function getFallbackDirs() + { + return $this->fallbackDirsPsr0; + } + + public function getFallbackDirsPsr4() + { + return $this->fallbackDirsPsr4; + } + + public function getClassMap() + { + return $this->classMap; + } + + /** + * @param array $classMap Class to filename map + */ + public function addClassMap(array $classMap) + { + if ($this->classMap) { + $this->classMap = array_merge($this->classMap, $classMap); + } else { + $this->classMap = $classMap; + } + } + + /** + * Registers a set of PSR-0 directories for a given prefix, either + * appending or prepending to the ones previously set for this prefix. + * + * @param string $prefix The prefix + * @param array|string $paths The PSR-0 root directories + * @param bool $prepend Whether to prepend the directories + */ + public function add($prefix, $paths, $prepend = false) + { + if (!$prefix) { + if ($prepend) { + $this->fallbackDirsPsr0 = array_merge( + (array) $paths, + $this->fallbackDirsPsr0 + ); + } else { + $this->fallbackDirsPsr0 = array_merge( + $this->fallbackDirsPsr0, + (array) $paths + ); + } + + return; + } + + $first = $prefix[0]; + if (!isset($this->prefixesPsr0[$first][$prefix])) { + $this->prefixesPsr0[$first][$prefix] = (array) $paths; + + return; + } + if ($prepend) { + $this->prefixesPsr0[$first][$prefix] = array_merge( + (array) $paths, + $this->prefixesPsr0[$first][$prefix] + ); + } else { + $this->prefixesPsr0[$first][$prefix] = array_merge( + $this->prefixesPsr0[$first][$prefix], + (array) $paths + ); + } + } + + /** + * Registers a set of PSR-4 directories for a given namespace, either + * appending or prepending to the ones previously set for this namespace. + * + * @param string $prefix The prefix/namespace, with trailing '\\' + * @param array|string $paths The PSR-4 base directories + * @param bool $prepend Whether to prepend the directories + * + * @throws \InvalidArgumentException + */ + public function addPsr4($prefix, $paths, $prepend = false) + { + if (!$prefix) { + // Register directories for the root namespace. + if ($prepend) { + $this->fallbackDirsPsr4 = array_merge( + (array) $paths, + $this->fallbackDirsPsr4 + ); + } else { + $this->fallbackDirsPsr4 = array_merge( + $this->fallbackDirsPsr4, + (array) $paths + ); + } + } elseif (!isset($this->prefixDirsPsr4[$prefix])) { + // Register directories for a new namespace. + $length = strlen($prefix); + if ('\\' !== $prefix[$length - 1]) { + throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator."); + } + $this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length; + $this->prefixDirsPsr4[$prefix] = (array) $paths; + } elseif ($prepend) { + // Prepend directories for an already registered namespace. + $this->prefixDirsPsr4[$prefix] = array_merge( + (array) $paths, + $this->prefixDirsPsr4[$prefix] + ); + } else { + // Append directories for an already registered namespace. + $this->prefixDirsPsr4[$prefix] = array_merge( + $this->prefixDirsPsr4[$prefix], + (array) $paths + ); + } + } + + /** + * Registers a set of PSR-0 directories for a given prefix, + * replacing any others previously set for this prefix. + * + * @param string $prefix The prefix + * @param array|string $paths The PSR-0 base directories + */ + public function set($prefix, $paths) + { + if (!$prefix) { + $this->fallbackDirsPsr0 = (array) $paths; + } else { + $this->prefixesPsr0[$prefix[0]][$prefix] = (array) $paths; + } + } + + /** + * Registers a set of PSR-4 directories for a given namespace, + * replacing any others previously set for this namespace. + * + * @param string $prefix The prefix/namespace, with trailing '\\' + * @param array|string $paths The PSR-4 base directories + * + * @throws \InvalidArgumentException + */ + public function setPsr4($prefix, $paths) + { + if (!$prefix) { + $this->fallbackDirsPsr4 = (array) $paths; + } else { + $length = strlen($prefix); + if ('\\' !== $prefix[$length - 1]) { + throw new \InvalidArgumentException("A non-empty PSR-4 prefix must end with a namespace separator."); + } + $this->prefixLengthsPsr4[$prefix[0]][$prefix] = $length; + $this->prefixDirsPsr4[$prefix] = (array) $paths; + } + } + + /** + * Turns on searching the include path for class files. + * + * @param bool $useIncludePath + */ + public function setUseIncludePath($useIncludePath) + { + $this->useIncludePath = $useIncludePath; + } + + /** + * Can be used to check if the autoloader uses the include path to check + * for classes. + * + * @return bool + */ + public function getUseIncludePath() + { + return $this->useIncludePath; + } + + /** + * Turns off searching the prefix and fallback directories for classes + * that have not been registered with the class map. + * + * @param bool $classMapAuthoritative + */ + public function setClassMapAuthoritative($classMapAuthoritative) + { + $this->classMapAuthoritative = $classMapAuthoritative; + } + + /** + * Should class lookup fail if not found in the current class map? + * + * @return bool + */ + public function isClassMapAuthoritative() + { + return $this->classMapAuthoritative; + } + + /** + * APCu prefix to use to cache found/not-found classes, if the extension is enabled. + * + * @param string|null $apcuPrefix + */ + public function setApcuPrefix($apcuPrefix) + { + $this->apcuPrefix = function_exists('apcu_fetch') && filter_var(ini_get('apc.enabled'), FILTER_VALIDATE_BOOLEAN) ? $apcuPrefix : null; + } + + /** + * The APCu prefix in use, or null if APCu caching is not enabled. + * + * @return string|null + */ + public function getApcuPrefix() + { + return $this->apcuPrefix; + } + + /** + * Registers this instance as an autoloader. + * + * @param bool $prepend Whether to prepend the autoloader or not + */ + public function register($prepend = false) + { + spl_autoload_register(array($this, 'loadClass'), true, $prepend); + } + + /** + * Unregisters this instance as an autoloader. + */ + public function unregister() + { + spl_autoload_unregister(array($this, 'loadClass')); + } + + /** + * Loads the given class or interface. + * + * @param string $class The name of the class + * @return bool|null True if loaded, null otherwise + */ + public function loadClass($class) + { + if ($file = $this->findFile($class)) { + includeFile($file); + + return true; + } + } + + /** + * Finds the path to the file where the class is defined. + * + * @param string $class The name of the class + * + * @return string|false The path if found, false otherwise + */ + public function findFile($class) + { + // class map lookup + if (isset($this->classMap[$class])) { + return $this->classMap[$class]; + } + if ($this->classMapAuthoritative || isset($this->missingClasses[$class])) { + return false; + } + if (null !== $this->apcuPrefix) { + $file = apcu_fetch($this->apcuPrefix.$class, $hit); + if ($hit) { + return $file; + } + } + + $file = $this->findFileWithExtension($class, '.php'); + + // Search for Hack files if we are running on HHVM + if (false === $file && defined('HHVM_VERSION')) { + $file = $this->findFileWithExtension($class, '.hh'); + } + + if (null !== $this->apcuPrefix) { + apcu_add($this->apcuPrefix.$class, $file); + } + + if (false === $file) { + // Remember that this class does not exist. + $this->missingClasses[$class] = true; + } + + return $file; + } + + private function findFileWithExtension($class, $ext) + { + // PSR-4 lookup + $logicalPathPsr4 = strtr($class, '\\', DIRECTORY_SEPARATOR) . $ext; + + $first = $class[0]; + if (isset($this->prefixLengthsPsr4[$first])) { + $subPath = $class; + while (false !== $lastPos = strrpos($subPath, '\\')) { + $subPath = substr($subPath, 0, $lastPos); + $search = $subPath . '\\'; + if (isset($this->prefixDirsPsr4[$search])) { + $pathEnd = DIRECTORY_SEPARATOR . substr($logicalPathPsr4, $lastPos + 1); + foreach ($this->prefixDirsPsr4[$search] as $dir) { + if (file_exists($file = $dir . $pathEnd)) { + return $file; + } + } + } + } + } + + // PSR-4 fallback dirs + foreach ($this->fallbackDirsPsr4 as $dir) { + if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr4)) { + return $file; + } + } + + // PSR-0 lookup + if (false !== $pos = strrpos($class, '\\')) { + // namespaced class name + $logicalPathPsr0 = substr($logicalPathPsr4, 0, $pos + 1) + . strtr(substr($logicalPathPsr4, $pos + 1), '_', DIRECTORY_SEPARATOR); + } else { + // PEAR-like class name + $logicalPathPsr0 = strtr($class, '_', DIRECTORY_SEPARATOR) . $ext; + } + + if (isset($this->prefixesPsr0[$first])) { + foreach ($this->prefixesPsr0[$first] as $prefix => $dirs) { + if (0 === strpos($class, $prefix)) { + foreach ($dirs as $dir) { + if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) { + return $file; + } + } + } + } + } + + // PSR-0 fallback dirs + foreach ($this->fallbackDirsPsr0 as $dir) { + if (file_exists($file = $dir . DIRECTORY_SEPARATOR . $logicalPathPsr0)) { + return $file; + } + } + + // PSR-0 include paths. + if ($this->useIncludePath && $file = stream_resolve_include_path($logicalPathPsr0)) { + return $file; + } + + return false; + } +} + +/** + * Scope isolated include. + * + * Prevents access to $this/self from included files. + */ +function includeFile($file) +{ + include $file; +} diff --git a/www/boris/php-ipfs-api/vendor/composer/LICENSE b/www/boris/php-ipfs-api/vendor/composer/LICENSE new file mode 100644 index 0000000..62ecfd8 --- /dev/null +++ b/www/boris/php-ipfs-api/vendor/composer/LICENSE @@ -0,0 +1,19 @@ +Copyright (c) Nils Adermann, Jordi Boggiano + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is furnished +to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/www/boris/php-ipfs-api/vendor/composer/autoload_classmap.php b/www/boris/php-ipfs-api/vendor/composer/autoload_classmap.php new file mode 100644 index 0000000..7a91153 --- /dev/null +++ b/www/boris/php-ipfs-api/vendor/composer/autoload_classmap.php @@ -0,0 +1,9 @@ + array($baseDir . '/src'), +); diff --git a/www/boris/php-ipfs-api/vendor/composer/autoload_real.php b/www/boris/php-ipfs-api/vendor/composer/autoload_real.php new file mode 100644 index 0000000..53aad38 --- /dev/null +++ b/www/boris/php-ipfs-api/vendor/composer/autoload_real.php @@ -0,0 +1,55 @@ += 50600 && !defined('HHVM_VERSION') && (!function_exists('zend_loader_file_encoded') || !zend_loader_file_encoded()); + if ($useStaticLoader) { + require_once __DIR__ . '/autoload_static.php'; + + call_user_func(\Composer\Autoload\ComposerStaticInitfb20af428fb50fc34b2be451caca0aba::getInitializer($loader)); + } else { + $map = require __DIR__ . '/autoload_namespaces.php'; + foreach ($map as $namespace => $path) { + $loader->set($namespace, $path); + } + + $map = require __DIR__ . '/autoload_psr4.php'; + foreach ($map as $namespace => $path) { + $loader->setPsr4($namespace, $path); + } + + $classMap = require __DIR__ . '/autoload_classmap.php'; + if ($classMap) { + $loader->addClassMap($classMap); + } + } + + $loader->register(true); + + return $loader; + } +} diff --git a/www/boris/php-ipfs-api/vendor/composer/autoload_static.php b/www/boris/php-ipfs-api/vendor/composer/autoload_static.php new file mode 100644 index 0000000..df1d68a --- /dev/null +++ b/www/boris/php-ipfs-api/vendor/composer/autoload_static.php @@ -0,0 +1,31 @@ + + array ( + 'Cloutier\\PhpIpfsApi\\' => 20, + ), + ); + + public static $prefixDirsPsr4 = array ( + 'Cloutier\\PhpIpfsApi\\' => + array ( + 0 => __DIR__ . '/../..' . '/src', + ), + ); + + public static function getInitializer(ClassLoader $loader) + { + return \Closure::bind(function () use ($loader) { + $loader->prefixLengthsPsr4 = ComposerStaticInitfb20af428fb50fc34b2be451caca0aba::$prefixLengthsPsr4; + $loader->prefixDirsPsr4 = ComposerStaticInitfb20af428fb50fc34b2be451caca0aba::$prefixDirsPsr4; + + }, null, ClassLoader::class); + } +} diff --git a/www/boris/php-ipfs-api/vendor/composer/installed.json b/www/boris/php-ipfs-api/vendor/composer/installed.json new file mode 100644 index 0000000..fe51488 --- /dev/null +++ b/www/boris/php-ipfs-api/vendor/composer/installed.json @@ -0,0 +1 @@ +[] diff --git a/www/boris/styles/astroport/decoration.css b/www/boris/styles/astroport/decoration.css new file mode 100644 index 0000000..b51a66f --- /dev/null +++ b/www/boris/styles/astroport/decoration.css @@ -0,0 +1,73 @@ +:root { + + --rouge: hsl(0, 98.8%, 33.5%); + --noir-fonce: hsl(0, 30%, 2.1%); + --noir-moyen: hsl(0, 15%, 3.1%); + --noir-clair: hsl(0, 5%, 7.1%); +} + + +body { + + background: var(--noir-fonce); + color: white; + font-family: Roboto,sans-serif; +} + +header { + + background: var(--noir-clair); +} + + +header * { + + color: var(--rouge); + text-decoration: none; +} + +header span { + + color: white; +} + +#videosList li { + + background: var(--noir-clair); + border-color: var(--rouge); + border-style: solid; +} + +.video-title, +.video-title a, +.video-title a:visited { + + color: white; + font-weight: bold; + text-decoration: none; +} + +article { + + background: var(--noir-clair); +} + +article video { + + background: black; +} + + +article .video-title { + + font-weight: bold; +} + +#successMsg { + + opacity: 0; + transition: opacity 1s; +} + + + diff --git a/www/boris/styles/astroport/layout.css b/www/boris/styles/astroport/layout.css new file mode 120000 index 0000000..e2d914f --- /dev/null +++ b/www/boris/styles/astroport/layout.css @@ -0,0 +1 @@ +../default/layout.css \ No newline at end of file diff --git a/www/boris/styles/astroport/style.css b/www/boris/styles/astroport/style.css index 5eaf361..ec19169 100644 --- a/www/boris/styles/astroport/style.css +++ b/www/boris/styles/astroport/style.css @@ -1,117 +1,2 @@ -:root { - - --rouge: hsl(0, 98.8%, 33.5%); - --noir-fonce: hsl(0, 30%, 2.1%); - --noir-moyen: hsl(0, 15%, 3.1%); - --noir-clair: hsl(0, 5%, 7.1%); -} - -body { - - background: var(--noir-fonce); - color: white; - margin: 0; - padding: 0; - font-family: Roboto,sans-serif; -} - -header { - - background: var(--noir-clair); - overflow: hidden; - margin-bottom: 2rem; - -} - -header * { - - font-size: 1.5rem; - padding: 0.5rem; - margin: 0; - color: var(--rouge); - 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(--noir-clair); - border-color: var(--rouge); - 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: var(--noir-clair); - 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; -} - -footer { - - display: none; -} - -#successMsg { - - opacity: 0; - transition: opacity 1s; -} +@import "./layout.css"; +@import "./decoration.css"; diff --git a/www/boris/styles/crowdbunker/decoration.css b/www/boris/styles/crowdbunker/decoration.css new file mode 100644 index 0000000..9b5a31e --- /dev/null +++ b/www/boris/styles/crowdbunker/decoration.css @@ -0,0 +1,102 @@ +:root { + + --pink: hsl(338.5, 72.8%, 36.1%); + --light-pink: hsl(338.5, 72.8%, 56.1%); + --canard: hsl(200.8, 100%, 9.6%); +} + +body { + + background: #121212; + color: white; + font-family: Roboto,sans-serif; +} + +header { + + background: var(--canard); +} + +header a, +header a:visited { + + color: white; + text-decoration: none; +} + +header a:active { + + outline: 0; +} + +header > .sitetitle span { + + border-bottom-style: solid; + border-bottom-color: var(--pink); +} + +header .usp { + + color: white; +} + +header .usp strong { + + color: var(--light-pink); +} + + +#videosList li { + + background: var(--canard); + border-color: var(--pink); + border-style: solid; +} + +.video-title, +.video-title a, +.video-title a:visited { + + color: white; + font-weight: bold; + text-decoration: none; +} + +article { + + background: var(--canard); +} + + +article video { + + background: black; +} + +article .video-title { + + font-weight: bold; +} + + + +form.add-video input[type="text"] { + + border-style: solid; + border-color: transparent; +} + +form.add-video input[type="text"]:focus { + + border-color: var(--pink); + outline: 0; +} + +form.add-video input[type="submit"] { + + background: var(--pink); + border-color: var(--pink); + border-style: solid; + color: white; + font-weight: bold; +} diff --git a/www/boris/styles/crowdbunker/layout.css b/www/boris/styles/crowdbunker/layout.css new file mode 120000 index 0000000..e2d914f --- /dev/null +++ b/www/boris/styles/crowdbunker/layout.css @@ -0,0 +1 @@ +../default/layout.css \ No newline at end of file diff --git a/www/boris/styles/crowdbunker/style.css b/www/boris/styles/crowdbunker/style.css index 4e66be6..ec19169 100644 --- a/www/boris/styles/crowdbunker/style.css +++ b/www/boris/styles/crowdbunker/style.css @@ -1,104 +1,2 @@ -: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: var(--canard); - 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; -} +@import "./layout.css"; +@import "./decoration.css"; diff --git a/www/boris/styles/default/layout.css b/www/boris/styles/default/layout.css new file mode 100644 index 0000000..8337363 --- /dev/null +++ b/www/boris/styles/default/layout.css @@ -0,0 +1,131 @@ + +body { + + margin: 0; + padding: 0; +} + +header { + + overflow: hidden; + padding: 1rem 0.666rem 1.333rem; + margin-bottom: 2rem; + +} + +header > * { + + font-size: 1.5rem; + margin: 0; + padding: 0; +} + +header > .sitetitle { + + margin-bottom: 0.25rem; +} + +header > .sitetitle span { + + border-bottom-style: solid; + border-bottom-color: var(--pink); +} + +header .usp { + + font-size: 0.95rem; +} + +main { + + width: 95%; + 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; + justify-content: center; +} + +#videosList li { + + border-radius: 0.25rem; + border-width: 1px; + overflow: hidden; +} + +#videosList .video-title { + + padding: 0.5rem 1rem; +} + +article { + + border-radius: 0.25rem; + width: 58.3%; + margin: auto; + overflow: hidden; + +} + +article video { + + width: 100%; + max-height: calc(100vh - 14rem); +} + +article .video-title { + + padding: 1rem 1rem; + font-size: 1.25rem; + margin: 0; +} + +form.add-video { + + position: absolute; + top: 0.50rem; + right: 0.50rem; +} + + +form.add-video input { + + height: 2rem; + padding: 0.25rem 0.5rem; + box-sizing: border-box; + border-width: 0.125rem; + border-radius: 0.5rem; + +} + +form label { + + display: none; + +} + +form label input { + + width: 50%; +} + +form.add-video .confirmation { + + margin: 0.5rem 0; + font-size: 0.85rem; + text-align: center; +} + +footer { + + display: none; +} diff --git a/www/boris/youtube.php b/www/boris/youtube.php index 375d0cc..95fc63b 100644 --- a/www/boris/youtube.php +++ b/www/boris/youtube.php @@ -2,30 +2,48 @@ require_once('conf.php'); require_once('functions.php'); +// require('php-ipfs-api/vendor/autoload.php'); +// use Cloutier\PhpIpfsApi\IPFS; +// $ipfs = new IPFS("astroport", "8181", IPFS_API_PORT); +// echo 'IPFS id : ' . $ipfs->id() . '
'; + $videosList = array(); exec("/bin/bash -c './get_astrxbian_index.sh'", $videos); -// echo '
'; var_dump($videos); echo '
'; +// exec("/bin/bash -c './get_youtube_videos.sh'", $videos); +// echo file_get_contents("http://youtube2.com/ipns/12D3KooWHLLohhFqwTs3Ccego51w1Q2WUQ8JmhSMWtsZnQpMigHY/.12D3KooWHLLohhFqwTs3Ccego51w1Q2WUQ8JmhSMWtsZnQpMigHY/FASTRXBIAN"); + // echo shell_exec('whoami'); // Pour savoir quel utilisateur système exécute les scripts PHP $videos = array_reverse($videos); -// ## film;MDan5TDuT-0;;Le Manuel de Survie en Dictature v1.1 au format papier;;["onelove"];k51qzi5uqu5dl0hnglpzumjezep2avacrtbx7i15v91elcxac4cpd8290kl1hq;720p;/ipfs/QmZp63RXhLm6QASmw1t2R8fu5waSJFmyW7cmdVNxyuJXzg/MDan5TDuT-0_Le%20Manuel%20de%20Survie%20en%20Dictature%20v1.1%20au%20format%20papier.mp4 +$i = 0; foreach ($videos as $v) { + + ++$i; + if ($i > 10) { + break; + } - list($category, $videoID, $p3, $videoName, $p5, $src, $p7, $definition, $videoURI) = explode(";", $v); - - - $videoEco = '/ipns/' . $p7; + list($contentType, $videoID, $year, $videoName, $saison, $tags, $ipnsHash, $definition, $videoURI) = explode(";", $v); + $mimeType = guessTypeFromFilename($videoURI); - - + $duration = NULL; + $thumbURL = ''; + if ($mimeType == 'video/mp4') { - switch ($category) { + switch ($contentType) { case 'youtube': $thumbURL = sprintf(YOUTUBE_THUMB, $videoID); + + $json = getVideoJson($ipnsHash); + + // echo '
'; var_dump($json); echo '
'; + $videoName = $json->title; + $duration = $json->duration; + break; case 'film': @@ -34,10 +52,11 @@ foreach ($videos as $v) { } $videosList[] = [ + 'duration' => $duration, 'thumbURL' => $thumbURL, - 'category' => $category, + 'category' => $contentType, 'mime' => $mimeType, - 'eco' => $videoEco, + 'eco' => '/ipns/' . $ipnsHash, 'uri' => $videoURI, 'name' => $videoName, 'youtubeID' => $videoID @@ -46,23 +65,10 @@ foreach ($videos as $v) { } +$home = true; -?> - - - Astroport "<?php echo STATION_NAME; ?> - - - - +include('inc/header.php'); -
-

- Astroport "" -

-
-
-'; var_dump($videosList); echo ''; @@ -75,11 +81,15 @@ foreach ($videosList as $video) { $href = 'youtube_watch.php?uri='. $video['uri'] . '&name='. urlencode($video['name']) .'&mime='. $video['mime']; echo ' - + '. $video['name'] . ' - + +

+ '. formatDuration($video['duration']) . ' +

+

' . $video['name'] . ' @@ -90,16 +100,7 @@ foreach ($videosList as $video) { } echo ''; -?> -

- - - + +include('inc/footer.php'); + diff --git a/www/boris/youtube_add_video_aux.php b/www/boris/youtube_add_video_aux.php new file mode 100644 index 0000000..44a7024 --- /dev/null +++ b/www/boris/youtube_add_video_aux.php @@ -0,0 +1,22 @@ +