First
This commit is contained in:
commit
7c74235129
9 changed files with 179 additions and 0 deletions
5
.gitignore
vendored
Normal file
5
.gitignore
vendored
Normal file
|
@ -0,0 +1,5 @@
|
|||
.fslckout
|
||||
viltube.fossil
|
||||
*.mp4
|
||||
*.webm
|
||||
*.mkv
|
35
README.md
Normal file
35
README.md
Normal file
|
@ -0,0 +1,35 @@
|
|||
# VILTUBE
|
||||
|
||||
A minimalist video hosting solution, written in PHP. If you want to post
|
||||
videos on the internet with free software, but want something very easy to
|
||||
setup and something not as big as PeerTube, this is perfect for you!
|
||||
|
||||
# Features
|
||||
1. Very small and fast!
|
||||
2. No databases or SQL usage, you just put videos up
|
||||
3. No login or registration page to be hacked
|
||||
4. Very customizable
|
||||
5. Text browser friendly
|
||||
6. Remove CSS by deleting styling.css
|
||||
|
||||
## The setup
|
||||
1. Have PHP installed on your webserver and running
|
||||
2. Clone this repository to a directory your webserver can access
|
||||
3. Put videos in the videos folder of viltube!
|
||||
|
||||
## Thumbnails
|
||||
|
||||
Put webps of matching name in the thumbs folder, if they arent present
|
||||
viltube wont serve a thumbnail.
|
||||
|
||||
There is a shell script 'genthumbs.sh'
|
||||
you can use to generate thumbnails for your videos via ffmpeg.
|
||||
|
||||
## Further improvements
|
||||
|
||||
Anything better than this would be statically generated or just a directory of
|
||||
videos served by the webserver.
|
||||
|
||||
## LICENSE
|
||||
|
||||
Public Domain CC0
|
BIN
favicon.ico
Normal file
BIN
favicon.ico
Normal file
Binary file not shown.
After Width: | Height: | Size: 6 KiB |
11
genthumbs.sh
Executable file
11
genthumbs.sh
Executable file
|
@ -0,0 +1,11 @@
|
|||
#!/bin/sh
|
||||
# Script to generate thumbnails
|
||||
rm thumbs/*.webp
|
||||
for video_file in videos/*; do
|
||||
file_name=$(basename "$video_file")
|
||||
file_extension="${file_name##*.}"
|
||||
thumbnail_file="thumbs/${file_name%.*}.webp"
|
||||
ffmpeg -loglevel 8 -y -i "$video_file" -ss 00:00:30 -vframes 1 -vf "scale=160:-1" -c:v libwebp "$thumbnail_file"
|
||||
#this one makes animated webp thumbnails
|
||||
#ffmpeg -loglevel 8 -y -i "$video_file" -vf "setpts=0.6*PTS,scale=iw/8:-1" -c:v libwebp "$thumbnail_file"
|
||||
done
|
53
index.php
Normal file
53
index.php
Normal file
|
@ -0,0 +1,53 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>Viltube</title>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<link rel="stylesheet" type="text/css" href="styling.css">
|
||||
</head>
|
||||
<body>
|
||||
<a href="index.php"><h1>Viltube</h1></a>
|
||||
<small>Vilyaem's video sharing system.</small>
|
||||
<?php
|
||||
/*get a list of video files from the 'videos/' directory*/
|
||||
$videoFiles = glob("videos/*.webm");
|
||||
|
||||
/*get a random video from the list*/
|
||||
$randomVideo = $videoFiles[array_rand($videoFiles)];
|
||||
|
||||
/*display the random video in a video tag*/
|
||||
echo '<h2>Featured video</h2>';
|
||||
echo '<h3>' . basename($randomVideo) . '</h3>';
|
||||
echo '<center>';
|
||||
echo '<video width="640" height="480" controls>
|
||||
<source src="' . $randomVideo . '" type="video/webm">
|
||||
</video>';
|
||||
echo '</center>';
|
||||
?>
|
||||
<h2>Videos</h2>
|
||||
<ul>
|
||||
<?php
|
||||
/*display links to other random videos*/
|
||||
for($i = 0; $i != 5; $i++){
|
||||
$directory = 'videos/';
|
||||
$files = glob($directory . '*.*');
|
||||
$randomFile = array_rand($files);
|
||||
$randomFilePath = $files[$randomFile];
|
||||
$randomFileName = basename($randomFilePath);
|
||||
|
||||
echo '<hr><a href="video.php?video=videos/' . $randomFileName . '">' . $randomFileName . '</a><br>';
|
||||
|
||||
/*if a webp thumbnail exists in the 'thumbs/' directory, serve it*/
|
||||
$thumbnailFilePath = 'thumbs/' . pathinfo($randomFileName, PATHINFO_FILENAME) . '.webp';
|
||||
|
||||
if (file_exists($thumbnailFilePath)) {
|
||||
echo '<a href="video.php?video=videos/' . $randomFileName . '"><img width=160 height=120 src="' . $thumbnailFilePath . '" alt="Thumbnail" loop="true"></a><br>';
|
||||
}
|
||||
}
|
||||
?>
|
||||
</ul>
|
||||
<center>
|
||||
<small>Viltube, a video sharing system created by <a href="https://vilyaem.xyz">Vilyaem Kenyaz</a>, Viltube is public domain<br>Donate Monero (XMR): 48Sxa8J6518gqp4WeGtQ4rLe6SctPrEnnCqm6v6ydjLwRPi9Uh9gvVuUsU2AEDw75meTHCNY8KfU6Txysom4Bn5qPKMJ75w</small>
|
||||
</center>
|
||||
</body>
|
||||
</html>
|
19
styling.css
Normal file
19
styling.css
Normal file
|
@ -0,0 +1,19 @@
|
|||
body {
|
||||
/*
|
||||
margin-bottom:350px;
|
||||
margin-right:300px;
|
||||
margin-left:300px;
|
||||
*/
|
||||
color:#C0C8FF;
|
||||
background:#1A1A1A;
|
||||
font-family:Courier New,monospace;
|
||||
}
|
||||
a{
|
||||
color:#D3DAFF;
|
||||
}
|
||||
table, tr, th{
|
||||
border: 1px solid #C0C8FF;
|
||||
}
|
||||
h1{
|
||||
color:#C0C8FF;
|
||||
}
|
BIN
thumbs/If.webp
Normal file
BIN
thumbs/If.webp
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.3 KiB |
55
video.php
Normal file
55
video.php
Normal file
|
@ -0,0 +1,55 @@
|
|||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>Viltube Video</title>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<link rel="stylesheet" type="text/css" href="styling.css">
|
||||
</head>
|
||||
<body>
|
||||
<a href="index.php"><h1>Viltube</h1></a>
|
||||
<small>This is where Vilyaem shares videos.</small>
|
||||
<?php
|
||||
// get the video file from the URL parameter
|
||||
$video = $_GET['video'];
|
||||
|
||||
// validate the video file
|
||||
if (strpos($video, 'videos/') === 0 && file_exists($video)) {
|
||||
// Display the video in a video tag
|
||||
echo '<h3>' . $video . '</h3>';
|
||||
echo '<center>';
|
||||
echo '<video width="640" height="480" controls>
|
||||
<source src="' . $video . '" type="video/webm">
|
||||
</video><br/>';
|
||||
echo '<a href=" ' . $video .'">Download video</a>';
|
||||
echo '</center>';
|
||||
} else {
|
||||
echo '<p>Invalid video file.</p>';
|
||||
}
|
||||
?>
|
||||
<h2>More videos</h2>
|
||||
<ul>
|
||||
<?php
|
||||
// display links to other random videos
|
||||
for($i = 0; $i != 5; $i++){
|
||||
$directory = 'videos/';
|
||||
$files = glob($directory . '*.*');
|
||||
$randomFile = array_rand($files);
|
||||
$randomFilePath = $files[$randomFile];
|
||||
$randomFileName = basename($randomFilePath);
|
||||
|
||||
echo '<hr><a href="video.php?video=videos/' . $randomFileName . '">' . $randomFileName . '</a><br>';
|
||||
|
||||
//if a webp thumbnail exists in the 'thumbs/' directory, serve it
|
||||
$thumbnailFilePath = 'thumbs/' . pathinfo($randomFileName, PATHINFO_FILENAME) . '.webp';
|
||||
|
||||
if (file_exists($thumbnailFilePath)) {
|
||||
echo '<a href="video.php?video=videos/' . $randomFileName . '"><img width=160 height=120 src="' . $thumbnailFilePath . '" alt="Thumbnail" loop="true"></a><br>';
|
||||
}
|
||||
}
|
||||
?>
|
||||
</ul>
|
||||
<center>
|
||||
<small>Viltube, a video sharing system created by <a href="https://vilyaem.xyz">Vilyaem Kenyaz</a>, Viltube is free and open source software licensed under the CFSL<br>Donate Monero (XMR): 48Sxa8J6518gqp4WeGtQ4rLe6SctPrEnnCqm6v6ydjLwRPi9Uh9gvVuUsU2AEDw75meTHCNY8KfU6Txysom4Bn5qPKMJ75w</small>
|
||||
</center>
|
||||
</body>
|
||||
</html>
|
1
videos/README.txt
Normal file
1
videos/README.txt
Normal file
|
@ -0,0 +1 @@
|
|||
You put videos here.
|
Loading…
Add table
Reference in a new issue