FIX: install script + EHH: bar to add video now in header

This commit is contained in:
Boris Paing 2021-03-12 20:18:00 +01:00
parent 6051609dab
commit 4e402d27a9
8 changed files with 159 additions and 73 deletions

View File

@ -19,4 +19,21 @@ default 120x 90 Large Preview
define('YOUTUBE_THUMB', 'https://i.ytimg.com/vi/%s/mqdefault.jpg');
define('SITENAME', '<span>Astrobunker</span>');
define('USP', 'Votre caverne remplie des <strong>trésors</strong> que vous avez découverts sur le web, votre <strong>forteresse</strong> de contenu imprenable, votre <strong>palais</strong> informationnel.');
function changeEveryNSec ($n, $a) {
$nbElts = count($a);
$refresh = $n * $nbElts;
return $a[floor((time() % $refresh) / ($refresh / $nbElts))];
}
$taglines = [
'Votre caverne remplie des <strong>trésors</strong> que vous avez découverts sur le web.',
'Votre <strong>forteresse</strong> de contenu imprenable>',
'Votre <strong>palais</strong> informationnel.'
];
define('USP', changeEveryNSec(2, $taglines));

7
inc/footer.php Normal file
View File

@ -0,0 +1,7 @@
</main>
</body>
</html>

47
inc/header.php Normal file
View File

@ -0,0 +1,47 @@
<!DOCTYPE html>
<html>
<head>
<title>Astrobunker</title>
<link rel="stylesheet" href="styles/crowdbunker/crowdbunker.css" type="text/css" />
<link rel="icon" type="image/png" href="styles/crowdbunker/astrobunker.png" />
</head>
<body>
<header>
<?php $elt = isset($home) ? 'h1' : 'h6'; ?>
<h1 class="sitetitle">
<a href="youtube.php"><?php echo SITENAME; ?></a>
</h1>
<p class="usp">
<?php echo USP; ?>
</p>
<form method="post" action="" class="add-video">
<label for="youtube_url"l>Sauvegarder une vidéo Youtube&nbsp;:</label>
<input type="text" name="youtube_url" placeholder="https://www.youtube.com/watch?v=ASywAfBAVrQ" size="45" />
<input type="submit" value="Mon précieux !" />
<?php
if (isset($_POST['youtube_url'])) {
?>
<p class="confirmation">Votre vidéo est en cours de téléchargement…</p>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
<script>
$.ajax({
method: "POST",
url: "youtube_add_video_aux.php",
data: { youtube_url: "<?php echo $_POST['youtube_url']; ?>" }
})
.done(function( response ) {
console.log(response);
});
</script>
<?php
}
?>
</form>
</header>
<main>

View File

@ -7,16 +7,16 @@ USER_GROUP=`groups | awk '{print $1}'`
#sudo adduser --home $HOME --no-create-home --disabled-password --disabled-login --quiet --gecos "" astroport
#sudo adduser astroport $USER_GROUP
sudo chgrp -R www-data ~{.zen,.ipfs,astroport}
sudo chgrp -R www-data ~/{.zen,.ipfs,astroport}
sudo chmod -R g+rw ~/{.zen,.ipfs,astroport}
echo ~ | tee ../conf/home_dir.txt
rm ./{astrXbian,astroport,swarm,me}
ln -s ../astrXbian astrXbian
ln -s ../../astroport astroport
ln -s ../ipfs_swarm swarm
ln -s ../ipfs me
rm ../{astrXbian,astroport,swarm,me}
ln -s ../astrXbian ../astrXbian
ln -s ../../astroport ../astroport
ln -s ../ipfs_swarm ../swarm
ln -s ../ipfs ../me
sudo rm $NGINX_CONF_FILE
cd /etc/nginx/sites-enabled

View File

@ -131,3 +131,63 @@ article .video-title {
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.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;
}
form label {
display: none;
}
form label input {
width: 50%;
}
form.add-video .confirmation {
margin: 0.5rem 0;
font-size: 0.85rem;
text-align: center;
}

View File

@ -30,34 +30,11 @@ foreach ($videos as $v) {
}
$home = true;
?><!DOCTYPE html>
<html>
<head>
<title>Astrobunker</title>
<link rel="stylesheet" href="styles/crowdbunker/crowdbunker.css" type="text/css" />
<link rel="icon" type="image/png" href="styles/crowdbunker/astrobunker.png" />
</head>
<body>
<header>
<h1 class="sitetitle">
<a href="youtube.php"><?php echo SITENAME; ?></a>
</h1>
<p class="usp">
<?php echo USP; ?>
</p>
</header>
<main>
include('inc/header.php');
<form method="post" action="youtube_add_video.php" class="add-video">
<label>Sauvegarder une vidéo Youtube&nbsp;: <input type="text" name="youtube_url" /></label>
<input type="submit" value="Sauvegarder" />
</form>
<?php
echo '<ul id="videosList">';
foreach ($videosList as $video) {
@ -82,9 +59,6 @@ foreach ($videosList as $video) {
}
echo '</ul>';
?>
</main>
</body>
</html>
include('inc/footer.php');

View File

@ -1,4 +1,8 @@
<?php
ini_set('max_execution_time', 1000);
require_once('conf/conf.php');
require_once('functions.php');
if (isset($_POST['youtube_url'])) {

View File

@ -15,43 +15,20 @@ $videoURL = 'http://'. HOST. '/' . urlencode($ipfsPath) . '/' . urlencode($video
$videoName = htmlentities(urldecode($_GET['name']));
$videoMIME = htmlentities($_GET['mime']);
?><!DOCTYPE html>
<html>
<head>
<title>Astrobunker</title>
<link rel="stylesheet" href="styles/crowdbunker/crowdbunker.css" type="text/css" />
<link rel="icon" type="image/png" href="styles/crowdbunker/astrobunker.png" />
</head>
<body>
include('inc/header.php');
<header>
<h6 class="sitetitle">
<a href="youtube.php"><?php echo SITENAME; ?></a>
</h6>
<p class="usp">
<?php echo USP; ?>
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>
</header>
</article>';
<main>
<?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>';
?>
</main>
</body>
</html>
include('inc/footer.php');