1
0
Fork 0
mirror of https://github.com/DanielnetoDotCom/YouPHPTube synced 2025-10-02 17:29:20 +02:00
This commit is contained in:
Daniel Neto 2023-02-21 12:21:14 -03:00
parent f636f027f1
commit b3f30f1575
25 changed files with 522 additions and 137 deletions

2
.gitignore vendored
View file

@ -84,3 +84,5 @@ view/videoComments_bkp.php
/.compose/
test.php
/plugin/JosephZ/
/Encoder/
/.env

View file

@ -10,94 +10,94 @@ LABEL maintainer="TRW <trw@acoby.de>" \
ARG DEBIAN_FRONTEND=noninteractive
ENV DB_MYSQL_HOST database
ENV DB_MYSQL_PORT 3306
ENV DB_MYSQL_NAME avideo
ENV DB_MYSQL_USER avideo
ENV DB_MYSQL_PASSWORD avideo
ENV SERVER_NAME localhost
ENV ENABLE_PHPMYADMIN yes
ENV CREATE_TLS_CERTIFICATE yes
ENV TLS_CERTIFICATE_FILE /etc/apache2/ssl/localhost.crt
ENV TLS_CERTIFICATE_KEY /etc/apache2/ssl/localhost.key
ENV CONTACT_EMAIL admin@localhost
ENV SYSTEM_ADMIN_PASSWORD password
ENV WEBSITE_TITLE AVideo
ENV MAIN_LANGUAGE en_US
ENV HTTPS_PORT $HTTPS_PORT
ARG SOCKET_PORT
ARG HTTP_PORT
ARG HTTPS_PORT
ARG NGINX_RTMP_PORT
ARG NGINX_HTTP_PORT
ARG NGINX_HTTPS_PORT
ARG DB_MYSQL_HOST
ARG DB_MYSQL_PORT
ARG DB_MYSQL_NAME
ARG DB_MYSQL_USER
ARG DB_MYSQL_PASSWORD
ARG SERVER_NAME
ARG CREATE_TLS_CERTIFICATE
ARG TLS_CERTIFICATE_FILE
ARG TLS_CERTIFICATE_KEY
ARG CONTACT_EMAIL
ARG SYSTEM_ADMIN_PASSWORD
ARG WEBSITE_TITLE
ARG MAIN_LANGUAGE
# Retrieve package list
RUN apt update
# Install dependencies
RUN apt-get update -y && apt-get upgrade -y \
&& apt install -y --no-install-recommends ca-certificates apt-transport-https software-properties-common curl \
&& apt install -y --no-install-recommends dos2unix bash-completion lsof cron rsync ca-certificates apt-transport-https software-properties-common curl \
&& curl -L https://github.com/yt-dlp/yt-dlp/releases/latest/download/yt-dlp -o /usr/local/bin/yt-dlp \
&& chmod a+rx /usr/local/bin/yt-dlp \
&& apt install -y --no-install-recommends sshpass nano net-tools curl apache2 php8.1 libapache2-mod-php8.1 php8.1-mysql php8.1-curl php8.1-gd php8.1-intl \
php-zip mysql-client ffmpeg git libimage-exiftool-perl libapache2-mod-xsendfile -y && a2enmod xsendfile && cd /var/www/html \
&& git clone https://github.com/WWBN/AVideo.git \
&& apt install -y --no-install-recommends sshpass nano net-tools curl apache2 php8.1 libapache2-mod-php8.1 php8.1-mysql php8.1-sqlite3 php8.1-curl php8.1-gd php8.1-intl \
php-zip mysql-client ffmpeg git libimage-exiftool-perl libapache2-mod-xsendfile python3-certbot-apache -y && a2enmod xsendfile && cd /var/www/html \
&& apt install -y --no-install-recommends && curl -L https://yt-dl.org/downloads/latest/youtube-dl -o /usr/local/bin/youtube-dl \
&& chmod a+rx /usr/local/bin/youtube-dl && apt install -y --no-install-recommends build-essential libpcre3 libpcre3-dev libssl-dev php8.1-xml -y \
&& a2enmod rewrite && chown www-data:www-data /var/www/html/AVideo/plugin && chmod 755 /var/www/html/AVideo/plugin \
&& a2enmod rewrite \
&& apt install -y --no-install-recommends unzip -y && apt install -y --no-install-recommends htop python3-pip \
&& pip3 install youtube-dl && pip3 install --upgrade youtube-dl && a2enmod expires \
&& a2enmod headers
COPY deploy/apache/avideo.conf /etc/apache2/sites-enabled/000-default.conf
COPY deploy/apache/phpmyadmin.conf /etc/apache2/conf-available/phpmyadmin.conf
COPY deploy/docker-entrypoint /usr/local/bin/docker-entrypoint
COPY deploy/wait-for-db.php /usr/local/bin/wait-for-db.php
COPY admin /var/www/html/AVideo/admin
COPY feed /var/www/html/AVideo/feed
COPY install /var/www/html/AVideo/install
COPY locale /var/www/html/AVideo/locale
COPY node_modules /var/www/html/AVideo/node_modules
COPY objects /var/www/html/AVideo/objects
COPY plugin /var/www/html/AVideo/plugin
COPY storage /var/www/html/AVideo/storage
COPY updatedb /var/www/html/AVideo/updatedb
COPY vendor /var/www/html/AVideo/vendor
COPY view /var/www/html/AVideo/view
COPY _config.yml /var/www/html/AVideo
COPY .htaccess /var/www/html/AVideo
COPY CNAME /var/www/html/AVideo
COPY LICENSE /var/www/html/AVideo
COPY README.md /var/www/html/AVideo
COPY web.config /var/www/html/AVideo
COPY index.php /var/www/html/AVideo
COPY git.json.php /var/www/html/AVideo
COPY sw.js /var/www/html/AVideo/
# Install nginx
RUN apt-get install build-essential libssl-dev libpcre3 libpcre3-dev wget -y \
&& apt-get install --reinstall zlib1g zlib1g-dev -y \
&& mkdir /var/www/tmp && chmod -R 777 /var/www/tmp \
&& mkdir /HLS && mkdir /HLS/live && chmod -R 777 /HLS
RUN mkdir ~/build \
&& cd ~/build \
&& git clone https://github.com/arut/nginx-rtmp-module.git \
&& git clone https://github.com/nginx/nginx.git \
&& cd nginx \
&& ./auto/configure --with-http_ssl_module --with-http_stub_status_module --add-module=../nginx-rtmp-module --with-cc-opt="-Wimplicit-fallthrough=0" \
&& make \
&& make install\
&& cd /usr/local/nginx/html && wget https://youphp.tube/docs/stat.xsl
COPY deploy/nginx/nginx.conf /usr/local/nginx/conf/nginx.conf
COPY deploy/crontab /etc/cron.d/crontab
RUN chmod 0644 /etc/cron.d/crontab
# Configure AVideo
RUN chmod 755 /usr/local/bin/docker-entrypoint && \
RUN dos2unix /usr/local/bin/docker-entrypoint && \
chmod 755 /usr/local/bin/docker-entrypoint && \
chmod +x /usr/local/bin/docker-entrypoint && \
pip3 install youtube-dl && \
cd /var/www/html/AVideo && \
git config --global advice.detachedHead false && \
git clone https://github.com/WWBN/AVideo-Encoder.git Encoder && \
chown -R www-data:www-data /var/www/html/AVideo && \
cd /var/www/html/AVideo/plugin/User_Location/install && \
unzip install.zip && \
sed -i 's/^post_max_size.*$/post_max_size = 10G/' /etc/php/8.1/apache2/php.ini && \
sed -i 's/^upload_max_filesize.*$/upload_max_filesize = 10G/' /etc/php/8.1/apache2/php.ini && \
sed -i 's/^max_execution_time.*$/max_execution_time = 7200/' /etc/php/8.1/apache2/php.ini && \
sed -i 's/^memory_limit.*$/memory_limit = 512M/' /etc/php/8.1/apache2/php.ini && \
a2enmod rewrite expires headers ssl xsendfile
# Add Apache configuration
RUN echo "ServerName localhost" >> /etc/apache2/apache2.conf
VOLUME /var/www/tmp
RUN mkdir -p /var/www/tmp && \
chown www-data:www-data /var/www/tmp && \
chmod 777 /var/www/tmp
VOLUME /var/www/html/AVideo/videos
RUN mkdir -p /var/www/html/AVideo/videos && \
chown www-data:www-data /var/www/html/AVideo/videos && \
chmod 777 /var/www/html/AVideo/videos
WORKDIR /var/www/html/AVideo/
EXPOSE $SOCKET_PORT
EXPOSE $HTTP_PORT
EXPOSE $HTTPS_PORT
EXPOSE $NGINX_RTMP_PORT
EXPOSE $NGINX_HTTPS_PORT
ENTRYPOINT ["/usr/local/bin/docker-entrypoint"]
CMD ["apache2-foreground"]

View file

@ -1,29 +1,40 @@
<VirtualHost *:80>
ServerName SERVER_NAME
<VirtualHost localhost:80>
ServerName localhost
ServerAdmin CONTACT_EMAIL
DocumentRoot "/var/www/html/AVideo"
ErrorLog /dev/stderr
CustomLog ${APACHE_LOG_DIR}/access.log combined
TransferLog /dev/stdout
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI}
</VirtualHost>
<VirtualHost *:443>
ServerName SERVER_NAME
<VirtualHost localhost:443>
ServerName localhost
ServerAdmin CONTACT_EMAIL
DocumentRoot "/var/www/html/AVideo"
ErrorLog /dev/stderr
CustomLog ${APACHE_LOG_DIR}/access.log combined
TransferLog /dev/stdout
SSLEngine on
SSLCertificateFile TLS_CERTIFICATE_FILE
SSLCertificateKeyFile TLS_CERTIFICATE_KEY
</VirtualHost>
<VirtualHost *:80>
ServerName SERVER_NAME
ServerAdmin CONTACT_EMAIL
DocumentRoot "/var/www/html/AVideo"
ErrorLog /dev/stderr
CustomLog ${APACHE_LOG_DIR}/access.log combined
TransferLog /dev/stdout
</VirtualHost>
<VirtualHost *:443>
ServerName SERVER_NAME
ServerAdmin CONTACT_EMAIL
DocumentRoot "/var/www/html/AVideo"
ErrorLog /dev/stderr
CustomLog ${APACHE_LOG_DIR}/access.log combined
TransferLog /dev/stdout
</VirtualHost>
<Directory /var/www/html/AVideo/>
Options Indexes FollowSymLinks
XSendFile on

View file

@ -0,0 +1,33 @@
<VirtualHost localhost:80>
ServerName SERVER_NAME
ServerAlias localhost
ServerAdmin CONTACT_EMAIL
DocumentRoot "/var/www/html/AVideo"
ErrorLog /dev/stderr
CustomLog ${APACHE_LOG_DIR}/access.log combined
TransferLog /dev/stdout
</VirtualHost>
<VirtualHost localhost:443>
ServerName SERVER_NAME
ServerAlias localhost
ServerAdmin CONTACT_EMAIL
DocumentRoot "/var/www/html/AVideo"
ErrorLog /dev/stderr
CustomLog ${APACHE_LOG_DIR}/access.log combined
TransferLog /dev/stdout
SSLEngine on
SSLCertificateFile TLS_CERTIFICATE_FILE
SSLCertificateKeyFile TLS_CERTIFICATE_KEY
</VirtualHost>
<Directory /var/www/html/AVideo/>
Options Indexes FollowSymLinks
XSendFile on
XSendFilePath /var/www/html/AVideo/
AllowOverride All
Require all granted
Order Allow,Deny
Allow from All
</Directory>

4
deploy/crontab Normal file
View file

@ -0,0 +1,4 @@
# m h dom mon dow command
1 1 * * * pip3 install --upgrade youtube-dl
* * * * * php /var/www/html/AVideo/plugin/Scheduler/run.php
#2 1 * * * php /var/www/html/AVideo/plugin/CDN/tools/moveMissingFiles.php

View file

@ -2,6 +2,7 @@
echo "Starting AVideo Platform..."
CONFIG_FILE=/etc/apache2/sites-enabled/000-default.conf
CONFIG_NGINX_FILE=/usr/local/nginx/conf/nginx.conf
if [ "_${CREATE_TLS_CERTIFICATE}_" == "_yes_" ]; then
echo "Generate Certificate..."
@ -42,18 +43,25 @@ if [ "_${CREATE_TLS_CERTIFICATE}_" == "_yes_" ]; then
openssl x509 -in ${TLS_CERTIFICATE_FILE} -noout -text || true
fi
echo "Configure Apache..."
sed -i 's#SERVER_NAME#'${SERVER_NAME}'#' ${CONFIG_FILE}
sed -i 's#CONTACT_EMAIL#'${CONTACT_EMAIL}'#' ${CONFIG_FILE}
sed -i 's#server_name localhost _#server_name localhost _ '${SERVER_NAME}'#' ${CONFIG_NGINX_FILE}
echo "Configure Apache..."
sed -i 's#TLS_CERTIFICATE_FILE#'${TLS_CERTIFICATE_FILE}'#' ${CONFIG_FILE}
sed -i 's#TLS_CERTIFICATE_KEY#'${TLS_CERTIFICATE_KEY}'#' ${CONFIG_FILE}
sed -i 's#CONTACT_EMAIL#'${CONTACT_EMAIL}'#' ${CONFIG_FILE}
if [ "_${ENABLE_PHPMYADMIN}_" = "_yes_" ]; then
echo "Enabling local PHPMyAdmin on https://${SERVER_NAME}/phpmyadmin"
cp /etc/apache2/conf-available/phpmyadmin.conf /etc/apache2/conf-enabled/phpmyadmin.conf
a2enmod proxy
a2enmod proxy_http
fi
echo "Configure Nginx..."
sed -i 's#ssl_certificate /etc/apache2/ssl/localhost.crt#ssl_certificate '${TLS_CERTIFICATE_FILE}'#' ${CONFIG_NGINX_FILE}
sed -i 's#ssl_certificate_key /etc/apache2/ssl/localhost.key#ssl_certificate_key '${TLS_CERTIFICATE_KEY}'#' ${CONFIG_NGINX_FILE}
sed -i 's#listen 1935#listen '${NGINX_RTMP_PORT}'#' ${CONFIG_NGINX_FILE}
sed -i 's#listen 8080#listen '${NGINX_HTTP_PORT}'#' ${CONFIG_NGINX_FILE}
sed -i 's#listen 8443#listen '${NGINX_HTTPS_PORT}'#' ${CONFIG_NGINX_FILE}
mkdir -p /etc/letsencrypt/live/localhost/
cp ${TLS_CERTIFICATE_FILE} /etc/letsencrypt/live/localhost/fullchain.pem
cp ${TLS_CERTIFICATE_KEY} /etc/letsencrypt/live/localhost/privkey.pem
echo "Waiting for database ${DB_MYSQL_HOST} to be up and running"
php /usr/local/bin/wait-for-db.php
@ -62,14 +70,69 @@ if [ $? -ne 0 ]; then
exit 1
fi
if [ -f /var/www/html/AVideo/videos/configuration.php ]; then
echo "Using existing configuration..."
if [ -f /var/www/html/AVideo/plugin/User_Location/install/install.sql ]; then
echo "Using existing location tables..."
else
echo "Create new configuration..."
cd /var/www/html/AVideo/install/
php ./cli.php
cd /var/www/html/AVideo/
echo "Create new locations tables..."
cd /var/www/html/AVideo/plugin/User_Location/install && unzip install.zip
# Configure AVideo Encoder
cd /var/www/html/AVideo && git config --global advice.detachedHead false && git clone https://github.com/WWBN/AVideo-Encoder.git Encoder
# Configure AVideo permissions
chown -R www-data:www-data /var/www/html/AVideo
fi
if [ -f /var/www/html/AVideo/Encoder/index.php ]; then
echo "Using existing Encoder configuration..."
else
echo "Create new Encoder configuration..."
# Configure AVideo Encoder
cd /var/www/html/AVideo && git config --global advice.detachedHead false && git clone https://github.com/WWBN/AVideo-Encoder.git Encoder
fi
if [ -d /var/www/html/AVideo/Encoder/videos ]; then
echo "Using existing Encoder videos..."
else
echo "Create new Encoder videos..."
# Configure AVideo Encoder
mkdir -p /var/www/html/AVideo/Encoder/videos && chown www-data:www-data /var/www/html/AVideo/Encoder/videos && chmod 777 /var/www/html/AVideo/Encoder/videos
fi
echo "Checking configuration..."
cd /var/www/html/AVideo/install/
php ./cli.php
cd /var/www/html/AVideo/
echo "lets encrypt apache ${SERVER_NAME}"
certbot --apache --non-interactive --agree-tos --register-unsafely-without-email --redirect --keep-until-expiring -d ${SERVER_NAME}
/etc/init.d/apache2 stop
if [ -f /usr/local/nginx/sbin/nginx ]; then
/usr/local/nginx/sbin/nginx -s stop
echo "lets encrypt nginx ${SERVER_NAME}"
apt-get install -y --no-install-recommends python3-certbot-nginx
mv /usr/sbin/nginx /usr/sbin/nginx.old && cp /usr/local/nginx/sbin/nginx /usr/sbin/nginx
mv /etc/nginx/nginx.conf /etc/nginx/nginx.conf.old && cp /usr/local/nginx/conf/nginx.conf /etc/nginx/nginx.conf
certbot --nginx --non-interactive --agree-tos --nginx-server-root /usr/local/nginx/conf --no-redirect --register-unsafely-without-email --keep-until-expiring -d $SERVER_NAME
sed -i 's/listen 443 ssl/listen 8443 ssl/g' /usr/local/nginx/conf/nginx.conf
echo "nginx start"
/usr/local/nginx/sbin/nginx -s stop && sleep 3 && /usr/local/nginx/sbin/nginx
fi
nohup php /var/www/html/AVideo/plugin/YPTSocket/server.php &
echo "socket done"
echo "Reset log"
echo '' > /var/www/html/AVideo/videos/avideo.log
chmod 777 /var/www/html/AVideo/videos/avideo.log
echo "deny access to .compose"
echo "Deny from all" > /var/www/html/AVideo/.compose/.htaccess
apache2-foreground
echo "apache2-foreground done"
cd /var/www/html/AVideo/install && php updatedb.php && installPluginsTables.php 4
cd /var/www/html/AVideo/Encoder/install && php reencodeAllVideos.php
#eof

142
deploy/nginx/nginx.conf Normal file
View file

@ -0,0 +1,142 @@
user www-data;
worker_processes 1;
error_log logs/error.log debug;
events {
worker_connections 1024;
}
rtmp {
server {
listen 1935;
buflen 1000ms;
chunk_size 4096;
ping_timeout 30s;
### Use case option (max_streams; default is 32 )
#max_streams 10;
allow play all;
#creates our "live" full-resolution HLS videostream from our incoming encoder stream and tells where to put the HLS video manifest and video fragments
application live {
allow play all;
live on;
hls on;
hls_nested on;
hls_path /HLS/live;
hls_playlist_length 60m;
hls_fragment 4s;
drop_idle_publisher 30s;
sync 500ms;
#Experimental. Force dropped stream, or ended stream from being watched. (idle_streams)
#idle_streams off;
on_publish http://127.0.0.1/plugin/Live/on_publish.php;
on_publish_done http://127.0.0.1/plugin/Live/on_publish_done.php;
on_play http://127.0.0.1/plugin/Live/on_play.php;
on_record_done http://127.0.0.1/plugin/Live/on_record_done.php;
#exec ffmpeg -re -i rtmp://localhost/live/$name -c:v libx264 -preset veryfast -c:a copy -f hls -hls_time 5 -hls_list_size 0 -f flv rtmp://localhost/adaptive/$name_hi;
#exec ffmpeg -re -i rtmp://localhost/live/$name
# -c:v libx264 -vf scale=-2:240 -r 20 -g 40 -keyint_min 40 -sc_threshold 0 -bf 3 -b_strategy 2 -b:v 400k -maxrate 700k -bufsize 1400k -c:a aac -strict -2 -b:a 96k -f flv rtmp://localhost/adaptive/$name_low
# -c:v libx264 -vf scale=-2:480 -r 30 -g 60 -keyint_min 48 -sc_threshold 0 -bf 3 -b_strategy 2 -b:v 1200k -maxrate 2100k -bufsize 4200k -c:a aac -strict -2 -b:a 128k -f flv rtmp://localhost/adaptive/$name_mid
# -c:v libx264 -vf scale=-2:720 -r 30 -g 60 -keyint_min 48 -sc_threshold 0 -bf 3 -b_strategy 2 -b:v 2400k -maxrate 3000k -bufsize 6000k -c:a aac -strict -2 -b:a 128k -f flv rtmp://localhost/adaptive/$name_hi;
recorder video {
record all manual;
record_path /var/www/tmp;
record_notify on;
record_max_size 2048M;
record_suffix -%d-%b-%y-%T.flv;
}
### Record Audio Separately ( For podcast )
#recorder audio {
# record audio;
# record_path /var/www/tmp;
# record_max_size 1024M;
# record_suffix -%d-%b-%y-%T.mp3;
#}
}
#application adaptive {
# live on;
# hls on;
# hls_path /HLS/live;
# hls_nested on;
# hls_playlist_length 10m;
# allow play all;
# allow publish 127.0.0.1;
# deny publish all;
# hls_variant _hi BANDWIDTH=264000,RESOLUTION=1280x720; # this is for line 34 only, do not uncomment it
# hls_variant _low BANDWIDTH=900000;
# hls_variant _mid BANDWIDTH=2400000;
# hls_variant _hi BANDWIDTH=3500000;
#}
}
}
http {
include mime.types;
default_type application/octet-stream;
server {
listen 8080;
server_name localhost _;
#creates the http-location for our full-resolution (desktop) HLS stream - "http://my-ip/live/my-stream-key/index.m3u8"
location /live {
expires 60;
add_header 'Cache-Control' 'public';
location ~ \.m3u8$ {
expires -1;
# Disable cache
add_header 'Cache-Control' 'no-cache';
# CORS setup
add_header 'Access-Control-Allow-Origin' '*' always;
add_header 'Access-Control-Expose-Headers' 'Content-Length';
}
# CORS setup
add_header 'Access-Control-Allow-Origin' '*' always;
add_header 'Access-Control-Expose-Headers' 'Content-Length';
# allow CORS preflight requests
if ($request_method = 'OPTIONS') {
add_header 'Access-Control-Allow-Origin' '*';
add_header 'Access-Control-Max-Age' 1728000;
add_header 'Content-Type' 'text/plain charset=UTF-8';
add_header 'Content-Length' 0;
return 204;
}
types {
application/vnd.apple.mpegurl m3u8;
}
alias /HLS/live;
}
#allows us to see how stats on viewers on our Nginx site using a URL like: "http://my-ip/stats"
#location /stats {
# stub_status;
#}
location /stat {
rtmp_stat all;
rtmp_stat_stylesheet stat.xsl;
}
location /stat.xsl {
root html;
}
location /control {
# replace this with the IP of your AVideo site
allow 127.0.0.1;
deny all;
rtmp_control all;
}
#allows us to host some webpages which can show our videos: "http://my-ip/my-page.html"
location / {
root html;
index index.html index.htm;
}
#location ~ \.php$ {
# include /etc/nginx/snippets/fastcgi-php.conf;
# fastcgi_pass unix:/var/run/php/php7.2-fpm.sock;
#}
listen 8443 ssl;
ssl_certificate /etc/apache2/ssl/localhost.crt;
ssl_certificate_key /etc/apache2/ssl/localhost.key;
}
}

View file

@ -11,7 +11,7 @@ $db_user = getenv("DB_MYSQL_USER");
$db_pass = getenv("DB_MYSQL_PASSWORD");
while (!$connected) {
echo "Checking database connection....";
echo "Checking database connection.... $db_host, $db_user";
$mysqli = @new mysqli($db_host, $db_user, $db_pass, $db_name, $db_port);
if ($mysqli !== false) {
echo "OK\n";

View file

@ -1,50 +1,67 @@
version: '3'
services:
web:
build: .
avideo:
build:
context: .
args:
SOCKET_PORT: ${SOCKET_PORT}
HTTP_PORT: ${HTTP_PORT}
HTTPS_PORT: ${HTTPS_PORT}
NGINX_RTMP_PORT: ${NGINX_RTMP_PORT}
NGINX_HTTP_PORT: ${NGINX_HTTP_PORT}
NGINX_HTTPS_PORT: ${NGINX_HTTPS_PORT}
DB_MYSQL_HOST: ${DB_MYSQL_HOST}
DB_MYSQL_PORT: ${DB_MYSQL_PORT}
DB_MYSQL_NAME: ${DB_MYSQL_NAME}
DB_MYSQL_USER: ${DB_MYSQL_USER}
DB_MYSQL_PASSWORD: ${DB_MYSQL_PASSWORD}
SERVER_NAME: ${SERVER_NAME}
CREATE_TLS_CERTIFICATE: ${CREATE_TLS_CERTIFICATE}
TLS_CERTIFICATE_FILE: ${TLS_CERTIFICATE_FILE}
TLS_CERTIFICATE_KEY: ${TLS_CERTIFICATE_KEY}
CONTACT_EMAIL: ${CONTACT_EMAIL}
SYSTEM_ADMIN_PASSWORD: ${SYSTEM_ADMIN_PASSWORD}
WEBSITE_TITLE: ${WEBSITE_TITLE}
MAIN_LANGUAGE: ${MAIN_LANGUAGE}
restart: "unless-stopped"
environment:
SOCKET_PORT: ${SOCKET_PORT:-2053}
HTTP_PORT: ${HTTP_PORT:-80}
HTTPS_PORT: ${HTTPS_PORT:-443}
DB_MYSQL_HOST: "database"
HTTPS_PORT: ${HTTP_PORT:-443}
NGINX_RTMP_PORT: ${NGINX_RTMP_PORT:-1935}
NGINX_HTTP_PORT: ${NGINX_HTTP_PORT:-8080}
NGINX_HTTPS_PORT: ${NGINX_HTTPS_PORT:-8443}
DB_MYSQL_HOST: "${DB_MYSQL_HOST:-database}"
DB_MYSQL_PORT: ${DB_MYSQL_PORT:-3306}
DB_MYSQL_NAME: "avideo"
DB_MYSQL_USER: "avideo"
DB_MYSQL_PASSWORD: "avideo"
SERVER_NAME: "localhost"
ENABLE_PHPMYADMIN: "yes"
CREATE_TLS_CERTIFICATE: "yes"
TLS_CERTIFICATE_FILE: "/etc/apache2/ssl/localhost.crt"
TLS_CERTIFICATE_KEY: "/etc/apache2/ssl/localhost.key"
CONTACT_EMAIL: "admin@localhost"
SYSTEM_ADMIN_PASSWORD: "password"
WEBSITE_TITLE: "AVideo"
MAIN_LANGUAGE: "en_US"
DB_MYSQL_NAME: "${DB_MYSQL_NAME:-avideo}"
DB_MYSQL_USER: "${DB_MYSQL_USER:-avideo}"
DB_MYSQL_PASSWORD: "${DB_MYSQL_PASSWORD:-avideo}"
SERVER_NAME: "${SERVER_NAME:-localhost}"
CREATE_TLS_CERTIFICATE: "${CREATE_TLS_CERTIFICATE:-yes}"
TLS_CERTIFICATE_FILE: "${TLS_CERTIFICATE_FILE:-/etc/apache2/ssl/localhost.crt}"
TLS_CERTIFICATE_KEY: "${TLS_CERTIFICATE_KEY:-/etc/apache2/ssl/localhost.key}"
CONTACT_EMAIL: "${CONTACT_EMAIL:-admin@localhost}"
SYSTEM_ADMIN_PASSWORD: "${SYSTEM_ADMIN_PASSWORD:-password}"
WEBSITE_TITLE: "${WEBSITE_TITLE:-AVideo}"
MAIN_LANGUAGE: "${MAIN_LANGUAGE:-en_US}"
env_file:
- .env
ports:
- '${HTTP_PORT}:80'
- '${HTTPS_PORT}:443'
- "${SOCKET_PORT:-2053}:2053"
- "${HTTP_PORT:-80}:80"
- "${HTTPS_PORT:-443}:443"
- "${NGINX_RTMP_PORT:-1935}:1935"
- "${NGINX_HTTP_PORT:-8080}:8080"
- "${NGINX_HTTPS_PORT:-8443}:8443"
volumes:
- "./var/www/avideo:/var/www/avideo"
depends_on:
- database
- phpmyadmin
networks:
- app_net
phpmyadmin:
image: "phpmyadmin/phpmyadmin"
restart: "unless-stopped"
environment:
PMA_ABSOLUTE_URI: "https://localhost/phpmyadmin"
PMA_HOST: "database"
PMA_PORT: 3306
PMA_CONTROLUSER: "avideo"
PMA_CONTROLPASS: "avideo"
PMA_PMADB: "avideo"
HIDE_PHP_VERSION: "true"
- "./:/var/www/html/AVideo"
- "./.compose/videos:/var/www/html/AVideo/videos"
- "./.compose/encoder:/var/www/html/AVideo/Encoder"
- "./.compose/letsencrypt:/etc/letsencrypt/"
depends_on:
- database
- database_encoder
networks:
- app_net
@ -62,6 +79,20 @@ services:
networks:
- app_net
database_encoder:
image: "mariadb:latest"
restart: "unless-stopped"
environment:
MYSQL_RANDOM_ROOT_PASSWORD: "yes"
MYSQL_INITDB_SKIP_TZINFO: 1
MYSQL_DATABASE: "avideo_encoder"
MYSQL_USER: "avideo"
MYSQL_PASSWORD: "avideo"
volumes:
- ./.compose/db_encoder:/var/lib/mysql
networks:
- app_net
networks:
app_net:
driver: bridge
driver: bridge

View file

@ -1,5 +1,13 @@
webSiteRootURL={webSiteRootURL}
# Exposed HTTP port
HTTP_PORT={HTTP_PORT}
HTTPS_PORT={HTTPS_PORT}
Socket_PORT={Socket_PORT}
SERVER_NAME=localhost
SOCKET_PORT=2053
HTTP_PORT=80
HTTPS_PORT=443
NGINX_RTMP_PORT=1935
NGINX_HTTP_PORT=8080
NGINX_HTTPS_PORT=8443
DB_MYSQL_HOST=database
DB_MYSQL_PORT=3306
DB_MYSQL_NAME=avideo
DB_MYSQL_USER=avideo
DB_MYSQL_PASSWORD=avideo

View file

@ -1,5 +1,7 @@
<?php
$isANewInstall = !file_exists('../videos/configuration.php');
$_POST["systemRootPath"] = "/var/www/html/AVideo/";
$_POST["databaseHost"] = getenv("DB_MYSQL_HOST");
$_POST["databasePort"] = getenv("DB_MYSQL_PORT");
@ -13,4 +15,28 @@ $_POST["webSiteTitle"] = getenv("WEBSITE_TITLE");
$_POST["mainLanguage"] = getenv("MAIN_LANGUAGE");
$_POST["webSiteRootURL"] = "https://".getenv("SERVER_NAME")."/";
require_once "./checkConfiguration.php";
if($isANewInstall){
require_once "./checkConfiguration.php";
$argv[1] = 1;
require_once "./installPluginsTables.php";
}
$_POST['systemRootPath'] = "{$_POST["systemRootPath"]}Encoder/";
$_POST["databaseHost"] = "{$_POST["databaseHost"]}_encoder";
$_POST["databaseName"] = "{$_POST["databaseName"]}_encoder";
$_POST['tablesPrefix'] = "";
$_POST['createTables'] = 1;
$_POST['systemAdminPass'] = getenv("SYSTEM_ADMIN_PASSWORD");
$_POST['inputUser'] = 'admin';
$_POST['inputPassword'] = $_POST['systemAdminPass'];
$_POST['webSiteTitle'] = "AVideo";
$_POST['siteURL'] = $_POST["webSiteRootURL"];
$_POST['webSiteRootURL'] = $_POST["webSiteRootURL"] . "Encoder/";
$_POST['allowedStreamers'] = $_POST['siteURL'];
$_POST['defaultPriority'] = 6;
chdir('../Encoder/install/');
$isANewInstall = !file_exists('../videos/configuration.php');
if($isANewInstall){
require_once "checkConfiguration.php";
}

29
nohup.out Normal file
View file

@ -0,0 +1,29 @@
[2023-02-21 12:38:29] AVideoLog::DEBUG: Socket server SQLite loading SCRIPT_NAME: /var/www/html/AVideo/plugin/YPTSocket/server.php
[2023-02-21 12:38:29] AVideoLog::DEBUG: Starting Socket server at port 2053 SCRIPT_NAME: /var/www/html/AVideo/plugin/YPTSocket/server.php
Starting AVideo Socket server version 4.1 on port 2053
Your socket server uses a secure connection
Parameter [local_cert]: /etc/letsencrypt/live/vlu.me/fullchain.pem
Parameter [local_pk]: /etc/letsencrypt/live/vlu.me/privkey.pem
Parameter [allow_self_signed]: 1
Parameter [verify_peer]:
Parameter [verify_peer_name]:
Parameter [security_level]: 0
DO NOT CLOSE THIS TERMINAL
2023-02-21 12:38:29 Using: 11.50MB RAM Construct
2023-02-21 12:38:33 Using: 12.38MB RAM msgToResourceId: resourceId=(220) NEW_CONNECTION
2023-02-21 12:38:33 Using: 12.37MB RAM msgToAll FROM (220) NEW_CONNECTION Total Clients: 1 in 0.0033 seconds
2023-02-21 12:38:33 Using: 12.37MB RAM Connection opened in 0.0040 seconds
2023-02-21 12:38:36 Using: 12.37MB RAM onClose 220 before deleted
2023-02-21 12:38:36 Using: 12.37MB RAM onClose 220 has deleted
2023-02-21 12:38:36 Using: 12.37MB RAM msgToAll FROM (220) NEW_DISCONNECTION Total Clients: 0 in 0.0001 seconds
2023-02-21 12:38:36 Using: 12.37MB RAM Connection 220 has disconnected
2023-02-21 12:38:36 Using: 12.40MB RAM msgToResourceId: resourceId=(261) NEW_CONNECTION
2023-02-21 12:38:36 Using: 12.39MB RAM msgToAll FROM (261) NEW_CONNECTION Total Clients: 1 in 0.0005 seconds
2023-02-21 12:38:36 Using: 12.38MB RAM Connection opened in 0.0011 seconds
2023-02-21 12:38:54 Using: 12.37MB RAM onClose 261 before deleted
2023-02-21 12:38:54 Using: 12.37MB RAM onClose 261 has deleted
2023-02-21 12:38:54 Using: 12.37MB RAM msgToAll FROM (261) NEW_DISCONNECTION Total Clients: 0 in 0.0001 seconds
2023-02-21 12:38:54 Using: 12.37MB RAM Connection 261 has disconnected
2023-02-21 12:38:55 Using: 12.40MB RAM msgToResourceId: resourceId=(264) NEW_CONNECTION
2023-02-21 12:38:55 Using: 12.39MB RAM msgToAll FROM (264) NEW_CONNECTION Total Clients: 1 in 0.0023 seconds
2023-02-21 12:38:55 Using: 12.38MB RAM Connection opened in 0.0030 seconds

View file

@ -357,7 +357,17 @@ class PlayList extends ObjectYPT {
return Video::getAllVideosLight("viewableNotUnlisted", false, false, true, 'serie');
}
public static function getVideosIndexFromPlaylistLight($playlists_id, $videos_id) {
if(!empty($videos_id)){
$pl = self::getVideosIDFromPlaylistLight($playlists_id);
foreach ($pl as $key => $value) {
if($value['videos_id']==$videos_id){
return $key;
}
}
}
return 0;
}
public static function getVideosIDFromPlaylistLight($playlists_id) {
global $global, $getVideosIDFromPlaylistLight;

View file

@ -300,7 +300,7 @@ class AVideoPlugin
// need to add dechex because some times it return an negative value and make it fails on javascript playlists
if (!isset($pluginIsLoaded[$name]) && empty($forceReload)) {
$pluginIsLoaded[$name] = false;
if (file_exists($loadPluginFile)) {
if (file_exists($loadPluginFile) && !class_exists($name)) {
require_once $loadPluginFile;
if (class_exists($name)) {
$code = "\$p = new {$name}();";

View file

@ -43,7 +43,7 @@ if ($totalPages < $page) {
<div class="clear clearfix">
<h3 class="galleryTitle">
<?php
echo VideoTags::getButton($value['tags_id'], 'btn-md', 'btn-link', 'btn-link', 'btn-link');
echo VideoTags::getButton($value['tags_id'], getVideos_id(),'btn-md', 'btn-link', 'btn-link', 'btn-link');
?>
</h3>
<div class="">

View file

@ -406,8 +406,6 @@ class PlayLists extends PluginAbstract {
foreach ($fullData as $row) {
$rows[] = $row;
}
} else {
die($sql . '\nError : (' . $global['mysqli']->errno . ') ' . $global['mysqli']->error);
}
return $rows;
}

View file

@ -30,7 +30,7 @@ class Scheduler extends PluginAbstract {
}
public function getPluginVersion() {
return "4.1";
return "4.2";
}
public function updateScript() {
@ -56,6 +56,13 @@ class Scheduler extends PluginAbstract {
sqlDal::writeSql(trim($value));
}
}
if (AVideoPlugin::compareVersion($this->getName(), "4.2") < 0) {
$sqls = file_get_contents($global['systemRootPath'] . 'plugin/Scheduler/install/updateV4.2.sql');
$sqlParts = explode(";", $sqls);
foreach ($sqlParts as $value) {
sqlDal::writeSql(trim($value));
}
}
return true;
}

View file

@ -13,6 +13,7 @@ CREATE TABLE IF NOT EXISTS `scheduler_commands` (
`repeat_hour` INT NULL,
`repeat_day_of_month` INT NULL,
`repeat_month` INT NULL,
`repeat_day_of_week` INT NULL,
`day_of_week` INT NULL,
`videos_id` INT(11) NULL,
PRIMARY KEY (`id`),

View file

@ -0,0 +1,2 @@
ALTER TABLE `scheduler_commands`
ADD COLUMN `repeat_day_of_week` INT(11) NULL DEFAULT NULL;

View file

@ -116,6 +116,18 @@ class VideoTags extends PluginAbstract {
static function getAllVideosIdFromTagsId($tags_id) {
return TagsHasVideos::getAllVideosIdFromTagsId($tags_id);
}
static function getVideoIndexFromTagsId($tags_id, $videos_id) {
if(!empty($videos_id)){
$pl = self::getAllVideosFromTagsId($tags_id);
foreach ($pl as $key => $value) {
if($value['videos_id']==$videos_id){
return $key;
}
}
}
return 0;
}
static function getAllVideosFromTagsId($tags_id) {
return TagsHasVideos::getAllVideosFromTagsId($tags_id);
@ -216,7 +228,7 @@ $(\'#inputTags' . $tagTypesId . '\').tagsinput({
return $_isUserSubscribedTags[$users_id][$tags_id];
}
public static function getButton($tags_id, $btnClass = 'btn-xs', $btnClassPrimary = 'btn-primary', $btnClassSuccess = 'btn-success', $btnClassDefault = 'btn-default'){
public static function getButton($tags_id, $videos_id = 0, $btnClass = 'btn-xs', $btnClassPrimary = 'btn-primary', $btnClassSuccess = 'btn-success', $btnClassDefault = 'btn-default'){
if(empty($tags_id)){
return '';
}
@ -235,7 +247,9 @@ $(\'#inputTags' . $tagTypesId . '\').tagsinput({
$playAllLink = '#';
$playAllClass = 'hidden';
if(AVideoPlugin::isEnabledByName('PlayLists')){
$playAllLink = PlayLists::getTagLink($tags_id, $embed = false, $playlist_index = null);
$playlist_index = self::getVideoIndexFromTagsId($tags_id, $videos_id);
//var_dump($videos_id,getVideos_id(), $playlist_index);exit;
$playAllLink = PlayLists::getTagLink($tags_id, false, $playlist_index);
$playAllClass = '';
}
@ -248,7 +262,6 @@ $(\'#inputTags' . $tagTypesId . '\').tagsinput({
$btnFile = $global['systemRootPath'] . 'plugin/VideoTags/subscribeBtn.html';
$email = User::getMail();
$subs = self::isUserSubscribed($users_id, $tags_id);
if (!empty($subs)) {
if (!empty($subs['notify'])) {
$notify = 'notify';
@ -378,7 +391,7 @@ $(\'#inputTags' . $tagTypesId . '\').tagsinput({
if($obj->disableTagsSubscriptions){
$strT .= self::getTagHTMLLink($value['tags_id'], $value['total']);
}else{
$strT .= self::getButton($value['tags_id']);
$strT .= self::getButton($value['tags_id'], $videos_id);
}
}
if (!empty($strT)) {

View file

@ -1,2 +1,4 @@
<button onclick="avideoModalIframe(webSiteRootURL + 'plugin/VideoTags/');" class="btn btn-primary btn-xs btn-block"><i class="fas fa-list-ul"></i> Create Tag Type</button>
<button onclick="avideoModalIframeLarge(webSiteRootURL + 'plugin/VideoTags/View/editor.php')" class="btn btn-primary btn-xs btn-block"><i class="fa fa-edit"></i> Tags Subscriptions</button>
<!--
<button onclick="avideoModalIframeLarge(webSiteRootURL + 'plugin/VideoTags/View/editor.php')" class="btn btn-primary btn-xs btn-block"><i class="fa fa-edit"></i> Tags Subscriptions</button>
-->

View file

@ -56,7 +56,9 @@ _error_log("Starting Socket server at port {$SocketDataObj->port}");
$scheme = parse_url($global['webSiteRootURL'], PHP_URL_SCHEME);
echo "Starting AVideo Socket server version {$SocketDataObj->serverVersion} on port {$SocketDataObj->port}" . PHP_EOL;
if (strtolower($scheme) !== 'https' || !empty($SocketDataObj->forceNonSecure)) {
$sslFound = file_exists($SocketDataObj->server_crt_file) && is_readable($SocketDataObj->server_crt_file) && file_exists($SocketDataObj->server_key_file) && is_readable($SocketDataObj->server_key_file);
if ((strtolower($scheme) !== 'https' || !empty($SocketDataObj->forceNonSecure)) && !$sslFound) {
echo "Your socket server does NOT use a secure connection" . PHP_EOL;
$server = IoServer::factory(
new HttpServer(

Binary file not shown.

After

Width:  |  Height:  |  Size: 40 KiB

View file

@ -109,6 +109,7 @@
<div class="<?php echo $divCol2; ?>">
<?php
if ($showCategory) {
$categories = Category::getAllCategories(true, true);
?>
<label class="control-label" for="inputCategory" ><?php echo __("Category"); ?></label>
<select class="form-control last" id="inputCategory" required>

View file

@ -1,6 +1,6 @@
<?php
//require_once '../videos/configuration.php';
$file = __DIR__ . DIRECTORY_SEPARATOR.'../plugin/VideoOffline/offlineVideo.php';
$file = dirname(__FILE__) . DIRECTORY_SEPARATOR.'../plugin/VideoOffline/offlineVideo.php';
error_log($file);
$offlineFile = $file;
if(file_exists($offlineFile)){