mirror of
https://github.com/DanielnetoDotCom/YouPHPTube
synced 2025-10-06 03:50:04 +02:00
updates
This commit is contained in:
parent
a1f5544788
commit
3dbdce673b
15 changed files with 275 additions and 171 deletions
122
Dockerfile
122
Dockerfile
|
@ -1,8 +1,8 @@
|
||||||
FROM ubuntu/apache2:2.4-22.10_edge
|
FROM ubuntu:latest
|
||||||
|
|
||||||
LABEL maintainer="TRW <trw@acoby.de>" \
|
LABEL maintainer="Daniel Neto <developer@youphptube.com>" \
|
||||||
org.label-schema.schema-version="1.0" \
|
org.label-schema.schema-version="2.0" \
|
||||||
org.label-schema.version="1.1.0" \
|
org.label-schema.version="2.0.0" \
|
||||||
org.label-schema.name="avideo-platform" \
|
org.label-schema.name="avideo-platform" \
|
||||||
org.label-schema.description="Audio Video Platform" \
|
org.label-schema.description="Audio Video Platform" \
|
||||||
org.label-schema.url="https://github.com/WWBN/AVideo" \
|
org.label-schema.url="https://github.com/WWBN/AVideo" \
|
||||||
|
@ -29,33 +29,104 @@ ARG CONTACT_EMAIL
|
||||||
ARG SYSTEM_ADMIN_PASSWORD
|
ARG SYSTEM_ADMIN_PASSWORD
|
||||||
ARG WEBSITE_TITLE
|
ARG WEBSITE_TITLE
|
||||||
ARG MAIN_LANGUAGE
|
ARG MAIN_LANGUAGE
|
||||||
|
ARG NGINX_RTMP_PORT
|
||||||
|
ARG NGINX_HTTP_PORT
|
||||||
|
ARG NGINX_HTTPS_PORT
|
||||||
|
|
||||||
# Retrieve package list
|
# Update package list and upgrade installed packages
|
||||||
RUN apt update
|
RUN apt-get update && apt-get upgrade -y
|
||||||
|
|
||||||
# Install dependencies
|
# Install basic utilities
|
||||||
RUN apt-get update -y && apt-get upgrade -y \
|
RUN apt-get install -y --no-install-recommends \
|
||||||
&& apt install -y --no-install-recommends dos2unix bash-completion lsof rsyslog cron rsync ca-certificates apt-transport-https software-properties-common curl \
|
apt-transport-https \
|
||||||
&& curl -L https://github.com/yt-dlp/yt-dlp/releases/latest/download/yt-dlp -o /usr/local/bin/yt-dlp \
|
bash-completion \
|
||||||
&& chmod a+rx /usr/local/bin/yt-dlp \
|
ca-certificates \
|
||||||
&& 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 \
|
cron \
|
||||||
php-zip mysql-client ffmpeg git libimage-exiftool-perl libapache2-mod-xsendfile python3-certbot-apache -y && a2enmod xsendfile && cd /var/www/html \
|
curl \
|
||||||
&& apt install -y --no-install-recommends && curl -L https://yt-dl.org/downloads/latest/youtube-dl -o /usr/local/bin/youtube-dl \
|
dos2unix \
|
||||||
&& 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 \
|
git \
|
||||||
&& a2enmod rewrite \
|
htop \
|
||||||
&& apt install -y --no-install-recommends unzip -y && apt install -y --no-install-recommends htop python3-pip \
|
iputils-ping \
|
||||||
&& pip3 install youtube-dl && pip3 install --upgrade youtube-dl && a2enmod expires \
|
lsof \
|
||||||
&& a2enmod headers
|
nano \
|
||||||
|
net-tools \
|
||||||
|
rsyslog \
|
||||||
|
rsync \
|
||||||
|
software-properties-common \
|
||||||
|
unzip \
|
||||||
|
sshpass
|
||||||
|
|
||||||
|
# Install Apache and Apache modules
|
||||||
|
RUN apt-get install -y --no-install-recommends \
|
||||||
|
apache2 \
|
||||||
|
libapache2-mod-xsendfile \
|
||||||
|
libapache2-mod-php \
|
||||||
|
libimage-exiftool-perl
|
||||||
|
|
||||||
|
# Install PHP and PHP extensions
|
||||||
|
RUN apt-get install -y --no-install-recommends \
|
||||||
|
libapache2-mod-php \
|
||||||
|
#libzip-dev \
|
||||||
|
libssl-dev \
|
||||||
|
#libicu-dev \
|
||||||
|
#libpq-dev \
|
||||||
|
#libpng-dev \
|
||||||
|
#libjpeg-dev \
|
||||||
|
#libfreetype6-dev \
|
||||||
|
#libonig-dev \
|
||||||
|
#libxml2-dev \
|
||||||
|
zlib1g-dev \
|
||||||
|
php \
|
||||||
|
php-curl \
|
||||||
|
php-gd \
|
||||||
|
php-intl \
|
||||||
|
php-mysql \
|
||||||
|
php-sqlite3 \
|
||||||
|
php-xml \
|
||||||
|
#php-dev \
|
||||||
|
php-zip \
|
||||||
|
php-pear
|
||||||
|
|
||||||
|
# Install multimedia tools
|
||||||
|
RUN apt-get install -y --no-install-recommends \
|
||||||
|
ffmpeg
|
||||||
|
|
||||||
|
# Install Python packages
|
||||||
|
RUN apt-get install -y --no-install-recommends \
|
||||||
|
python3-certbot-apache \
|
||||||
|
python3-pip
|
||||||
|
|
||||||
|
# Download and install yt-dlp
|
||||||
|
RUN 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
|
||||||
|
|
||||||
|
# Download and install youtube-dl
|
||||||
|
RUN cd /var/www/html && \
|
||||||
|
curl -L https://yt-dl.org/downloads/latest/youtube-dl -o /usr/local/bin/youtube-dl && \
|
||||||
|
chmod a+rx /usr/local/bin/youtube-dl
|
||||||
|
|
||||||
|
# Install ssh2 and openssl
|
||||||
|
#RUN pecl install ssh2 && \
|
||||||
|
# docker-php-ext-enable ssh2 && \
|
||||||
|
# docker-php-ext-install openssl && \
|
||||||
|
# echo "extension=ssh2.so" >> /usr/local/etc/php/conf.d/ssh2.ini
|
||||||
|
|
||||||
|
# Enable necessary Apache modules
|
||||||
|
RUN a2enmod xsendfile rewrite expires headers ssl
|
||||||
|
|
||||||
|
# Install and upgrade youtube-dl using pip
|
||||||
|
RUN pip3 install youtube-dl --upgrade youtube-dl
|
||||||
|
|
||||||
|
# Copy configuration files
|
||||||
COPY deploy/apache/avideo.conf /etc/apache2/sites-enabled/000-default.conf
|
COPY deploy/apache/avideo.conf /etc/apache2/sites-enabled/000-default.conf
|
||||||
COPY deploy/apache/docker-entrypoint /usr/local/bin/docker-entrypoint
|
COPY deploy/apache/docker-entrypoint /usr/local/bin/docker-entrypoint
|
||||||
COPY deploy/apache/wait-for-db.php /usr/local/bin/wait-for-db.php
|
COPY deploy/apache/wait-for-db.php /usr/local/bin/wait-for-db.php
|
||||||
#COPY deploy/apache/phpmyadmin.conf /etc/apache2/conf-available/phpmyadmin.conf
|
|
||||||
|
|
||||||
COPY deploy/apache/crontab /etc/cron.d/crontab
|
COPY deploy/apache/crontab /etc/cron.d/crontab
|
||||||
RUN dos2unix /etc/cron.d/crontab
|
|
||||||
RUN chmod 0644 /etc/cron.d/crontab
|
# Set permissions for crontab
|
||||||
RUN chmod +x /etc/cron.d/crontab
|
RUN dos2unix /etc/cron.d/crontab && \
|
||||||
|
chmod 0644 /etc/cron.d/crontab && \
|
||||||
|
chmod +x /etc/cron.d/crontab
|
||||||
|
|
||||||
# Configure AVideo
|
# Configure AVideo
|
||||||
RUN dos2unix /usr/local/bin/docker-entrypoint && \
|
RUN dos2unix /usr/local/bin/docker-entrypoint && \
|
||||||
|
@ -71,11 +142,14 @@ RUN dos2unix /usr/local/bin/docker-entrypoint && \
|
||||||
# Add Apache configuration
|
# Add Apache configuration
|
||||||
RUN echo "ServerName localhost" >> /etc/apache2/apache2.conf
|
RUN echo "ServerName localhost" >> /etc/apache2/apache2.conf
|
||||||
|
|
||||||
|
# Create directory and set permissions
|
||||||
VOLUME /var/www/tmp
|
VOLUME /var/www/tmp
|
||||||
RUN mkdir -p /var/www/tmp && \
|
RUN mkdir -p /var/www/tmp && \
|
||||||
chown www-data:www-data /var/www/tmp && \
|
chown www-data:www-data /var/www/tmp && \
|
||||||
chmod 777 /var/www/tmp
|
chmod 777 /var/www/tmp
|
||||||
|
|
||||||
|
RUN apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
|
||||||
|
|
||||||
WORKDIR /var/www/html/AVideo/
|
WORKDIR /var/www/html/AVideo/
|
||||||
|
|
||||||
EXPOSE $SOCKET_PORT
|
EXPOSE $SOCKET_PORT
|
||||||
|
|
|
@ -10,7 +10,10 @@ ARG CREATE_TLS_CERTIFICATE
|
||||||
ARG TLS_CERTIFICATE_FILE
|
ARG TLS_CERTIFICATE_FILE
|
||||||
ARG TLS_CERTIFICATE_KEY
|
ARG TLS_CERTIFICATE_KEY
|
||||||
|
|
||||||
|
# Update and upgrade packages
|
||||||
RUN apt-get update -y && apt-get upgrade -y
|
RUN apt-get update -y && apt-get upgrade -y
|
||||||
|
|
||||||
|
# Install basic packages
|
||||||
RUN apt-get install -y --no-install-recommends \
|
RUN apt-get install -y --no-install-recommends \
|
||||||
dos2unix \
|
dos2unix \
|
||||||
bash-completion \
|
bash-completion \
|
||||||
|
@ -24,16 +27,27 @@ RUN apt-get install -y --no-install-recommends \
|
||||||
curl \
|
curl \
|
||||||
build-essential \
|
build-essential \
|
||||||
libssl-dev \
|
libssl-dev \
|
||||||
php-fpm \
|
|
||||||
php-cli \
|
|
||||||
php-curl \
|
|
||||||
libpcre3 \
|
|
||||||
libpcre3-dev \
|
|
||||||
git \
|
|
||||||
python3-certbot-nginx \
|
|
||||||
ffmpeg \
|
ffmpeg \
|
||||||
zlib1g-dev \
|
zlib1g-dev \
|
||||||
wget
|
wget
|
||||||
|
|
||||||
|
# Install PHP packages
|
||||||
|
RUN apt-get install -y --no-install-recommends \
|
||||||
|
php-fpm \
|
||||||
|
php-cli \
|
||||||
|
php-curl
|
||||||
|
|
||||||
|
# Install NGINX dependencies
|
||||||
|
RUN apt-get install -y --no-install-recommends \
|
||||||
|
libpcre3 \
|
||||||
|
libpcre3-dev
|
||||||
|
|
||||||
|
# Install Git and Certbot
|
||||||
|
RUN apt-get install -y --no-install-recommends \
|
||||||
|
git \
|
||||||
|
python3-certbot-nginx
|
||||||
|
|
||||||
|
# Build NGINX with RTMP module
|
||||||
RUN mkdir ~/build && \
|
RUN mkdir ~/build && \
|
||||||
cd ~/build && \
|
cd ~/build && \
|
||||||
git clone https://github.com/arut/nginx-rtmp-module.git && \
|
git clone https://github.com/arut/nginx-rtmp-module.git && \
|
||||||
|
@ -42,6 +56,8 @@ RUN apt-get install -y --no-install-recommends \
|
||||||
./auto/configure --with-http_ssl_module --with-http_stub_status_module --add-module=../nginx-rtmp-module --with-cc-opt="-Wimplicit-fallthrough=0" && \
|
./auto/configure --with-http_ssl_module --with-http_stub_status_module --add-module=../nginx-rtmp-module --with-cc-opt="-Wimplicit-fallthrough=0" && \
|
||||||
make && \
|
make && \
|
||||||
make install
|
make install
|
||||||
|
|
||||||
|
# Download and configure NGINX
|
||||||
RUN cd /usr/local/nginx/html && \
|
RUN cd /usr/local/nginx/html && \
|
||||||
wget https://youphp.tube/docs/stat.xsl --no-check-certificate && \
|
wget https://youphp.tube/docs/stat.xsl --no-check-certificate && \
|
||||||
mv /usr/local/nginx/conf/nginx.conf /usr/local/nginx/conf/nginx.conf.old && \
|
mv /usr/local/nginx/conf/nginx.conf /usr/local/nginx/conf/nginx.conf.old && \
|
||||||
|
@ -53,30 +69,34 @@ RUN apt-get install -y --no-install-recommends \
|
||||||
mkdir /var/www/tmp/ && \
|
mkdir /var/www/tmp/ && \
|
||||||
chmod 777 /var/www/tmp
|
chmod 777 /var/www/tmp
|
||||||
|
|
||||||
|
# Copy configuration files
|
||||||
COPY deploy/nginx/docker-entrypoint-live /usr/local/bin/docker-entrypoint-live
|
COPY deploy/nginx/docker-entrypoint-live /usr/local/bin/docker-entrypoint-live
|
||||||
COPY deploy/nginx/nginx.conf /usr/local/nginx/conf/nginx.conf
|
COPY deploy/nginx/nginx.conf /usr/local/nginx/conf/nginx.conf
|
||||||
|
|
||||||
COPY deploy/nginx/crontab /etc/cron.d/crontab
|
COPY deploy/nginx/crontab /etc/cron.d/crontab
|
||||||
RUN dos2unix /etc/cron.d/crontab
|
|
||||||
RUN chmod 0644 /etc/cron.d/crontab
|
|
||||||
RUN chmod +x /etc/cron.d/crontab
|
|
||||||
RUN service cron start
|
|
||||||
RUN crontab /etc/cron.d/crontab
|
|
||||||
|
|
||||||
|
# Set permissions for crontab
|
||||||
|
RUN dos2unix /etc/cron.d/crontab && \
|
||||||
|
chmod 0644 /etc/cron.d/crontab && \
|
||||||
|
chmod +x /etc/cron.d/crontab && \
|
||||||
|
service cron start && \
|
||||||
|
crontab /etc/cron.d/crontab
|
||||||
|
|
||||||
|
# Set permissions for docker-entrypoint-live
|
||||||
RUN dos2unix /usr/local/bin/docker-entrypoint-live && \
|
RUN dos2unix /usr/local/bin/docker-entrypoint-live && \
|
||||||
chmod 755 /usr/local/bin/docker-entrypoint-live && \
|
chmod 755 /usr/local/bin/docker-entrypoint-live && \
|
||||||
chmod +x /usr/local/bin/docker-entrypoint-live
|
chmod +x /usr/local/bin/docker-entrypoint-live
|
||||||
|
|
||||||
|
# Create directory and set permissions
|
||||||
VOLUME /var/www/tmp
|
VOLUME /var/www/tmp
|
||||||
RUN mkdir -p /var/www/tmp && \
|
RUN mkdir -p /var/www/tmp && \
|
||||||
chmod 777 /var/www/tmp
|
chmod 777 /var/www/tmp
|
||||||
|
|
||||||
|
RUN apt-get clean && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
|
||||||
|
|
||||||
|
# Expose ports
|
||||||
EXPOSE $NGINX_RTMP_PORT
|
EXPOSE $NGINX_RTMP_PORT
|
||||||
EXPOSE $NGINX_HTTP_PORT
|
EXPOSE $NGINX_HTTP_PORT
|
||||||
EXPOSE $NGINX_HTTPS_PORT
|
EXPOSE $NGINX_HTTPS_PORT
|
||||||
|
|
||||||
|
# Set the entrypoint and command
|
||||||
ENTRYPOINT ["/usr/local/bin/docker-entrypoint-live"]
|
ENTRYPOINT ["/usr/local/bin/docker-entrypoint-live"]
|
||||||
|
|
||||||
CMD ["/usr/local/nginx/sbin/nginx", "-g", "daemon off;"]
|
|
||||||
|
|
||||||
#CMD ["bash"]
|
|
|
@ -1,20 +1,17 @@
|
||||||
|
php_flag log_errors on
|
||||||
|
php_value error_log /dev/stderr
|
||||||
|
ErrorLog /dev/stderr
|
||||||
|
CustomLog ${APACHE_LOG_DIR}/access.log combined
|
||||||
|
TransferLog /dev/stdout
|
||||||
<VirtualHost localhost:80>
|
<VirtualHost localhost:80>
|
||||||
ServerName localhost
|
ServerName localhost
|
||||||
ServerAdmin CONTACT_EMAIL
|
ServerAdmin CONTACT_EMAIL
|
||||||
DocumentRoot "/var/www/html/AVideo"
|
DocumentRoot "/var/www/html/AVideo"
|
||||||
ErrorLog /dev/stderr
|
|
||||||
CustomLog ${APACHE_LOG_DIR}/access.log combined
|
|
||||||
TransferLog /dev/stdout
|
|
||||||
</VirtualHost>
|
</VirtualHost>
|
||||||
<VirtualHost localhost:443>
|
<VirtualHost localhost:443>
|
||||||
ServerName localhost
|
ServerName localhost
|
||||||
ServerAdmin CONTACT_EMAIL
|
ServerAdmin CONTACT_EMAIL
|
||||||
DocumentRoot "/var/www/html/AVideo"
|
DocumentRoot "/var/www/html/AVideo"
|
||||||
|
|
||||||
ErrorLog /dev/stderr
|
|
||||||
CustomLog ${APACHE_LOG_DIR}/access.log combined
|
|
||||||
TransferLog /dev/stdout
|
|
||||||
|
|
||||||
SSLEngine on
|
SSLEngine on
|
||||||
SSLCertificateFile TLS_CERTIFICATE_FILE
|
SSLCertificateFile TLS_CERTIFICATE_FILE
|
||||||
SSLCertificateKeyFile TLS_CERTIFICATE_KEY
|
SSLCertificateKeyFile TLS_CERTIFICATE_KEY
|
||||||
|
@ -23,17 +20,11 @@
|
||||||
ServerName SERVER_NAME
|
ServerName SERVER_NAME
|
||||||
ServerAdmin CONTACT_EMAIL
|
ServerAdmin CONTACT_EMAIL
|
||||||
DocumentRoot "/var/www/html/AVideo"
|
DocumentRoot "/var/www/html/AVideo"
|
||||||
ErrorLog /dev/stderr
|
|
||||||
CustomLog ${APACHE_LOG_DIR}/access.log combined
|
|
||||||
TransferLog /dev/stdout
|
|
||||||
</VirtualHost>
|
</VirtualHost>
|
||||||
<VirtualHost *:443>
|
<VirtualHost *:443>
|
||||||
ServerName SERVER_NAME
|
ServerName SERVER_NAME
|
||||||
ServerAdmin CONTACT_EMAIL
|
ServerAdmin CONTACT_EMAIL
|
||||||
DocumentRoot "/var/www/html/AVideo"
|
DocumentRoot "/var/www/html/AVideo"
|
||||||
ErrorLog /dev/stderr
|
|
||||||
CustomLog ${APACHE_LOG_DIR}/access.log combined
|
|
||||||
TransferLog /dev/stdout
|
|
||||||
</VirtualHost>
|
</VirtualHost>
|
||||||
<Directory /var/www/html/AVideo/>
|
<Directory /var/www/html/AVideo/>
|
||||||
Options Indexes FollowSymLinks
|
Options Indexes FollowSymLinks
|
||||||
|
|
|
@ -1,12 +1,12 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
echo "Starting AVideo Platform..."
|
echo "entrypoint -- Starting AVideo Platform..."
|
||||||
CONFIG_FILE=/etc/apache2/sites-enabled/000-default.conf
|
CONFIG_FILE=/etc/apache2/sites-enabled/000-default.conf
|
||||||
|
|
||||||
if [ "_${CREATE_TLS_CERTIFICATE}_" == "_yes_" ]; then
|
if [ "_${CREATE_TLS_CERTIFICATE}_" == "_yes_" ]; then
|
||||||
echo "Generate Certificate..."
|
echo "entrypoint -- Generate Certificate..."
|
||||||
echo "Certificate file: ${TLS_CERTIFICATE_FILE}"
|
echo "entrypoint -- Certificate file: ${TLS_CERTIFICATE_FILE}"
|
||||||
echo "Certificate key: ${TLS_CERTIFICATE_KEY}"
|
echo "entrypoint -- Certificate key: ${TLS_CERTIFICATE_KEY}"
|
||||||
|
|
||||||
mkdir -p `dirname ${TLS_CERTIFICATE_FILE}`
|
mkdir -p `dirname ${TLS_CERTIFICATE_FILE}`
|
||||||
mkdir -p `dirname ${TLS_CERTIFICATE_KEY}`
|
mkdir -p `dirname ${TLS_CERTIFICATE_KEY}`
|
||||||
|
@ -38,14 +38,14 @@ if [ "_${CREATE_TLS_CERTIFICATE}_" == "_yes_" ]; then
|
||||||
-extensions EXT -config <( \
|
-extensions EXT -config <( \
|
||||||
printf "${CONFIG}")
|
printf "${CONFIG}")
|
||||||
|
|
||||||
echo "New Certificate config..."
|
echo "entrypoint -- New Certificate config..."
|
||||||
openssl x509 -in ${TLS_CERTIFICATE_FILE} -noout -text || true
|
openssl x509 -in ${TLS_CERTIFICATE_FILE} -noout -text || true
|
||||||
fi
|
fi
|
||||||
|
|
||||||
sed -i 's#SERVER_NAME#'${SERVER_NAME}'#' ${CONFIG_FILE}
|
sed -i 's#SERVER_NAME#'${SERVER_NAME}'#' ${CONFIG_FILE}
|
||||||
sed -i 's#CONTACT_EMAIL#'${CONTACT_EMAIL}'#' ${CONFIG_FILE}
|
sed -i 's#CONTACT_EMAIL#'${CONTACT_EMAIL}'#' ${CONFIG_FILE}
|
||||||
|
|
||||||
echo "Configure Apache..."
|
echo "entrypoint -- Configure Apache..."
|
||||||
sed -i 's#TLS_CERTIFICATE_FILE#'${TLS_CERTIFICATE_FILE}'#' ${CONFIG_FILE}
|
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#TLS_CERTIFICATE_KEY#'${TLS_CERTIFICATE_KEY}'#' ${CONFIG_FILE}
|
||||||
|
|
||||||
|
@ -54,17 +54,17 @@ mkdir -p /etc/letsencrypt/live/localhost/
|
||||||
cp ${TLS_CERTIFICATE_FILE} /etc/letsencrypt/live/localhost/fullchain.pem
|
cp ${TLS_CERTIFICATE_FILE} /etc/letsencrypt/live/localhost/fullchain.pem
|
||||||
cp ${TLS_CERTIFICATE_KEY} /etc/letsencrypt/live/localhost/privkey.pem
|
cp ${TLS_CERTIFICATE_KEY} /etc/letsencrypt/live/localhost/privkey.pem
|
||||||
|
|
||||||
echo "Waiting for database ${DB_MYSQL_HOST} to be up and running"
|
echo "entrypoint -- Waiting for database ${DB_MYSQL_HOST} to be up and running"
|
||||||
php /usr/local/bin/wait-for-db.php
|
php /usr/local/bin/wait-for-db.php
|
||||||
if [ $? -ne 0 ]; then
|
if [ $? -ne 0 ]; then
|
||||||
echo "Stopping container"
|
echo "entrypoint -- Stopping container"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -f /var/www/html/AVideo/plugin/User_Location/install/install.sql ]; then
|
if [ -f /var/www/html/AVideo/plugin/User_Location/install/install.sql ]; then
|
||||||
echo "Using existing location tables..."
|
echo "entrypoint -- Using existing location tables..."
|
||||||
else
|
else
|
||||||
echo "Create new locations tables..."
|
echo "entrypoint -- Create new locations tables..."
|
||||||
cd /var/www/html/AVideo/plugin/User_Location/install && unzip install.zip
|
cd /var/www/html/AVideo/plugin/User_Location/install && unzip install.zip
|
||||||
# Configure AVideo Encoder
|
# Configure AVideo Encoder
|
||||||
cd /var/www/html/AVideo && git config --global advice.detachedHead false && git clone https://github.com/WWBN/AVideo-Encoder.git Encoder
|
cd /var/www/html/AVideo && git config --global advice.detachedHead false && git clone https://github.com/WWBN/AVideo-Encoder.git Encoder
|
||||||
|
@ -73,51 +73,50 @@ else
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -f /var/www/html/AVideo/Encoder/index.php ]; then
|
if [ -f /var/www/html/AVideo/Encoder/index.php ]; then
|
||||||
echo "Using existing Encoder configuration..."
|
echo "entrypoint -- Using existing Encoder configuration..."
|
||||||
else
|
else
|
||||||
echo "Create new Encoder configuration..."
|
echo "entrypoint -- Create new Encoder configuration..."
|
||||||
# Configure AVideo Encoder
|
# Configure AVideo Encoder
|
||||||
cd /var/www/html/AVideo && git config --global advice.detachedHead false && git clone https://github.com/WWBN/AVideo-Encoder.git Encoder
|
cd /var/www/html/AVideo && git config --global advice.detachedHead false && git clone https://github.com/WWBN/AVideo-Encoder.git Encoder
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -d /var/www/html/AVideo/Encoder/videos ]; then
|
if [ -d /var/www/html/AVideo/Encoder/videos ]; then
|
||||||
echo "Using existing Encoder videos..."
|
echo "entrypoint -- Using existing Encoder videos..."
|
||||||
else
|
else
|
||||||
echo "Create new Encoder videos..."
|
echo "entrypoint -- Create new Encoder videos..."
|
||||||
# Configure AVideo Encoder
|
# 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
|
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
|
fi
|
||||||
|
|
||||||
echo "Checking configuration..."
|
echo "entrypoint -- Checking configuration..."
|
||||||
cd /var/www/html/AVideo/install/
|
cd /var/www/html/AVideo/install/
|
||||||
php ./cli.php
|
php ./cli.php
|
||||||
cd /var/www/html/AVideo/
|
cd /var/www/html/AVideo/
|
||||||
|
|
||||||
#if [ "_${ENABLE_PHPMYADMIN}_" = "_yes_" ]; then
|
echo "entrypoint -- Running certbot..."
|
||||||
# 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 "lets encrypt apache ${SERVER_NAME}"
|
|
||||||
certbot --apache --non-interactive --agree-tos --register-unsafely-without-email --redirect --keep-until-expiring -d ${SERVER_NAME}
|
certbot --apache --non-interactive --agree-tos --register-unsafely-without-email --redirect --keep-until-expiring -d ${SERVER_NAME}
|
||||||
/etc/init.d/apache2 stop
|
/etc/init.d/apache2 stop
|
||||||
|
|
||||||
echo "Start socket"
|
echo "entrypoint -- Writing /var/www/docker_vars.json"
|
||||||
|
echo "{\"SOCKET_PORT\":${SOCKET_PORT}, \"HTTP_PORT\":${HTTP_PORT}, \"HTTPS_PORT\":${HTTPS_PORT}, \"SERVER_NAME\":\"${SERVER_NAME}\", \"NGINX_RTMP_PORT\":${NGINX_RTMP_PORT}, \"NGINX_HTTP_PORT\":${NGINX_HTTP_PORT}, \"NGINX_HTTPS_PORT\":${NGINX_HTTPS_PORT}}" > /var/www/docker_vars.json
|
||||||
|
|
||||||
|
echo "entrypoint -- Starting socket server..."
|
||||||
nohup php /var/www/html/AVideo/plugin/YPTSocket/server.php &
|
nohup php /var/www/html/AVideo/plugin/YPTSocket/server.php &
|
||||||
|
|
||||||
echo "Reset log"
|
echo "entrypoint -- Reset log"
|
||||||
echo '' > /var/www/html/AVideo/videos/avideo.log
|
echo '' > /var/www/html/AVideo/videos/avideo.log
|
||||||
chmod 777 /var/www/html/AVideo/videos/avideo.log
|
chmod 777 /var/www/html/AVideo/videos/avideo.log
|
||||||
|
|
||||||
echo "deny access to .compose"
|
echo "entrypoint -- Deny access to .compose"
|
||||||
echo "Deny from all" > /var/www/html/AVideo/.compose/.htaccess
|
echo "Deny from all" > /var/www/html/AVideo/.compose/.htaccess
|
||||||
|
|
||||||
|
echo "entrypoint -- Running updatedb script..."
|
||||||
cd /var/www/html/AVideo/install && php updatedb.php
|
cd /var/www/html/AVideo/install && php updatedb.php
|
||||||
|
|
||||||
|
echo "entrypoint -- Running reencodeAllVideos script..."
|
||||||
cd /var/www/html/AVideo/Encoder/install && php reencodeAllVideos.php
|
cd /var/www/html/AVideo/Encoder/install && php reencodeAllVideos.php
|
||||||
|
|
||||||
echo "crontab starting"
|
echo "entrypoint -- Starting cron service..."
|
||||||
cron
|
cron
|
||||||
service cron start
|
service cron start
|
||||||
crontab /etc/cron.d/crontab
|
crontab /etc/cron.d/crontab
|
||||||
|
@ -125,9 +124,9 @@ crontab /etc/cron.d/crontab
|
||||||
bash
|
bash
|
||||||
source /etc/bash_completion
|
source /etc/bash_completion
|
||||||
|
|
||||||
echo "apache2-foreground start"
|
echo "entrypoint -- service apache2 start"
|
||||||
apache2-foreground
|
#apache2-foreground
|
||||||
echo "apache2-foreground done"
|
apachectl -DFOREGROUND
|
||||||
|
echo "entrypoint -- service apache2 done"
|
||||||
|
|
||||||
#eof
|
#eof
|
|
@ -45,6 +45,9 @@ services:
|
||||||
SYSTEM_ADMIN_PASSWORD: "${SYSTEM_ADMIN_PASSWORD:-password}"
|
SYSTEM_ADMIN_PASSWORD: "${SYSTEM_ADMIN_PASSWORD:-password}"
|
||||||
WEBSITE_TITLE: "${WEBSITE_TITLE:-AVideo}"
|
WEBSITE_TITLE: "${WEBSITE_TITLE:-AVideo}"
|
||||||
MAIN_LANGUAGE: "${MAIN_LANGUAGE:-en_US}"
|
MAIN_LANGUAGE: "${MAIN_LANGUAGE:-en_US}"
|
||||||
|
NGINX_RTMP_PORT: "${NGINX_RTMP_PORT:-1935}"
|
||||||
|
NGINX_HTTP_PORT: "${NGINX_HTTP_PORT:-8080}"
|
||||||
|
NGINX_HTTPS_PORT: "${NGINX_HTTPS_PORT:-8443}"
|
||||||
env_file:
|
env_file:
|
||||||
- .env
|
- .env
|
||||||
ports:
|
ports:
|
||||||
|
@ -85,6 +88,9 @@ services:
|
||||||
CREATE_TLS_CERTIFICATE: "${CREATE_TLS_CERTIFICATE:-yes}"
|
CREATE_TLS_CERTIFICATE: "${CREATE_TLS_CERTIFICATE:-yes}"
|
||||||
TLS_CERTIFICATE_FILE: "${TLS_CERTIFICATE_FILE:-/etc/apache2/ssl/localhost.crt}"
|
TLS_CERTIFICATE_FILE: "${TLS_CERTIFICATE_FILE:-/etc/apache2/ssl/localhost.crt}"
|
||||||
TLS_CERTIFICATE_KEY: "${TLS_CERTIFICATE_KEY:-/etc/apache2/ssl/localhost.key}"
|
TLS_CERTIFICATE_KEY: "${TLS_CERTIFICATE_KEY:-/etc/apache2/ssl/localhost.key}"
|
||||||
|
NGINX_RTMP_PORT: "${NGINX_RTMP_PORT:-1935}"
|
||||||
|
NGINX_HTTP_PORT: "${NGINX_HTTP_PORT:-8080}"
|
||||||
|
NGINX_HTTPS_PORT: "${NGINX_HTTPS_PORT:-8443}"
|
||||||
env_file:
|
env_file:
|
||||||
- .env
|
- .env
|
||||||
ports:
|
ports:
|
||||||
|
|
|
@ -700,7 +700,7 @@ abstract class ObjectYPT implements ObjectInterface
|
||||||
rrmdirCommandLine($newtmpDir, true);
|
rrmdirCommandLine($newtmpDir, true);
|
||||||
}
|
}
|
||||||
self::setLastDeleteALLCacheTime();
|
self::setLastDeleteALLCacheTime();
|
||||||
unlink($lockFile);
|
@unlink($lockFile);
|
||||||
$end = microtime(true) - $start;
|
$end = microtime(true) - $start;
|
||||||
_error_log("deleteALLCache end in {$end} seconds");
|
_error_log("deleteALLCache end in {$end} seconds");
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -3765,7 +3765,8 @@ function rrmdir($dir) {
|
||||||
rrmdirCommandLine($dir);
|
rrmdirCommandLine($dir);
|
||||||
if (is_dir($dir)) {
|
if (is_dir($dir)) {
|
||||||
//_error_log('rrmdir: The Directory was not deleted, trying again ' . $dir);
|
//_error_log('rrmdir: The Directory was not deleted, trying again ' . $dir);
|
||||||
$objects = scandir($dir);
|
$objects = @scandir($dir);
|
||||||
|
if(!empty($objects)){
|
||||||
//_error_log('rrmdir: scandir ' . $dir . ' '. json_encode($objects));
|
//_error_log('rrmdir: scandir ' . $dir . ' '. json_encode($objects));
|
||||||
foreach ($objects as $object) {
|
foreach ($objects as $object) {
|
||||||
if ($object !== '.' && $object !== '..') {
|
if ($object !== '.' && $object !== '..') {
|
||||||
|
@ -3776,17 +3777,20 @@ function rrmdir($dir) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
if (preg_match('/(\/|^)videos(\/cache)?\/?$/i', $dir)) {
|
if (preg_match('/(\/|^)videos(\/cache)?\/?$/i', $dir)) {
|
||||||
_error_log('rrmdir: do not delete videos or cache folder ' . $dir);
|
_error_log('rrmdir: do not delete videos or cache folder ' . $dir);
|
||||||
// do not delete videos or cache folder
|
// do not delete videos or cache folder
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (rmdir($dir)) {
|
if(is_dir($dir)){
|
||||||
|
if (@rmdir($dir)) {
|
||||||
return true;
|
return true;
|
||||||
} else if (is_dir($dir)) {
|
} else if (is_dir($dir)) {
|
||||||
_error_log('rrmdir: could not delete folder ' . $dir);
|
_error_log('rrmdir: could not delete folder ' . $dir);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
//_error_log('rrmdir: The Directory does not exists '.$dir);
|
//_error_log('rrmdir: The Directory does not exists '.$dir);
|
||||||
return true;
|
return true;
|
||||||
|
@ -5648,10 +5652,12 @@ function isValidURLOrPath($str, $insideCacheOrTmpDirOnly = true) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function hasLastSlash($word) {
|
function hasLastSlash($word) {
|
||||||
|
$word = trim($word);
|
||||||
return substr($word, -1) === '/';
|
return substr($word, -1) === '/';
|
||||||
}
|
}
|
||||||
|
|
||||||
function addLastSlash($word) {
|
function addLastSlash($word) {
|
||||||
|
$word = trim($word);
|
||||||
return $word . (hasLastSlash($word) ? "" : "/");
|
return $word . (hasLastSlash($word) ? "" : "/");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -10134,3 +10140,8 @@ function isConfirmationPage() {
|
||||||
global $_isConfirmationPage;
|
global $_isConfirmationPage;
|
||||||
return !empty($_isConfirmationPage);
|
return !empty($_isConfirmationPage);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function getDockerVars(){
|
||||||
|
$content = file_get_contents('/var/www/docker_vars.json');
|
||||||
|
return json_decode($content);
|
||||||
|
}
|
|
@ -3963,13 +3963,17 @@ class LiveStreamObject {
|
||||||
public function getM3U8($doNotProtect = false, $allowOnlineIndex = false, $ignoreCDN = false) {
|
public function getM3U8($doNotProtect = false, $allowOnlineIndex = false, $ignoreCDN = false) {
|
||||||
global $global;
|
global $global;
|
||||||
$o = AVideoPlugin::getObjectData("Live");
|
$o = AVideoPlugin::getObjectData("Live");
|
||||||
|
|
||||||
$uuid = $this->getKeyWithIndex($allowOnlineIndex, $allowOnlineIndex);
|
$uuid = $this->getKeyWithIndex($allowOnlineIndex, $allowOnlineIndex);
|
||||||
//_error_log("Live:getM3U8($doNotProtect , $allowOnlineIndex e, $ignoreCDN) $uuid ($allowOnlineIndex");
|
//_error_log("Live:getM3U8($doNotProtect , $allowOnlineIndex e, $ignoreCDN) $uuid ($allowOnlineIndex");
|
||||||
if (empty($o->server_type->value)) {
|
if (empty($o->server_type->value)) {
|
||||||
$row = LiveTransmitionHistory::getLatest($this->key, $this->live_servers_id);
|
$row = LiveTransmitionHistory::getLatest($this->key, $this->live_servers_id);
|
||||||
if (!empty($row['domain'])) {
|
if (!empty($row['domain'])) {
|
||||||
return "{$row['domain']}live/{$uuid}.m3u8";
|
if($row['domain'] == 'http://avideo:8080/'){
|
||||||
|
$row['domain'] = $o->playerServer;
|
||||||
|
}
|
||||||
|
$url = "{$row['domain']}live/{$uuid}.m3u8";
|
||||||
|
//_error_log("getM3U8($doNotProtect, $allowOnlineIndex, $ignoreCDN) ".__LINE__." {$url}");
|
||||||
|
return $url;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3983,13 +3987,22 @@ class LiveStreamObject {
|
||||||
}
|
}
|
||||||
|
|
||||||
$playerServer = addLastSlash($playerServer);
|
$playerServer = addLastSlash($playerServer);
|
||||||
if ($o->protectLive && empty($doNotProtect)) {
|
if($playerServer == 'http://avideo:8080/live/'){
|
||||||
return "{$global['webSiteRootURL']}plugin/Live/m3u8.php?live_servers_id={$this->live_servers_id}&uuid=" . encryptString($uuid);
|
$dockerVars = getDockerVars();
|
||||||
} elseif ($o->useAadaptiveMode) {
|
$playerServer = "https://{$dockerVars->SERVER_NAME}:{$dockerVars->NGINX_HTTPS_PORT}/live/";
|
||||||
return $playerServer . "{$uuid}.m3u8";
|
//_error_log("getM3U8($doNotProtect, $allowOnlineIndex, $ignoreCDN) {$playerServer} ".__LINE__);
|
||||||
} else {
|
|
||||||
return $playerServer . "{$uuid}/index.m3u8";
|
|
||||||
}
|
}
|
||||||
|
if ($o->protectLive && empty($doNotProtect)) {
|
||||||
|
$url = "{$global['webSiteRootURL']}plugin/Live/m3u8.php?live_servers_id={$this->live_servers_id}&uuid=" . encryptString($uuid);
|
||||||
|
//_error_log("getM3U8($doNotProtect, $allowOnlineIndex, $ignoreCDN) ".__LINE__." {$url}");
|
||||||
|
} elseif ($o->useAadaptiveMode) {
|
||||||
|
$url = $playerServer . "{$uuid}.m3u8";
|
||||||
|
//_error_log("getM3U8($doNotProtect, $allowOnlineIndex, $ignoreCDN) ".__LINE__." {$url}");
|
||||||
|
} else {
|
||||||
|
$url = $playerServer . "{$uuid}/index.m3u8";
|
||||||
|
//_error_log("getM3U8($doNotProtect, $allowOnlineIndex, $ignoreCDN) {$playerServer} ".__LINE__." {$url}");
|
||||||
|
}
|
||||||
|
return $url;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getOnlineM3U8($users_id, $doNotProtect = false) {
|
public function getOnlineM3U8($users_id, $doNotProtect = false) {
|
||||||
|
|
|
@ -139,7 +139,7 @@ class LiveTransmition extends ObjectYPT
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function getFromDbByUser($user_id)
|
public static function getFromDbByUser($user_id, $refreshCache = false)
|
||||||
{
|
{
|
||||||
global $global;
|
global $global;
|
||||||
if (!self::isTableInstalled(static::getTableName())) {
|
if (!self::isTableInstalled(static::getTableName())) {
|
||||||
|
@ -148,10 +148,11 @@ class LiveTransmition extends ObjectYPT
|
||||||
}
|
}
|
||||||
$user_id = intval($user_id);
|
$user_id = intval($user_id);
|
||||||
$sql = "SELECT * FROM " . static::getTableName() . " WHERE users_id = ? LIMIT 1";
|
$sql = "SELECT * FROM " . static::getTableName() . " WHERE users_id = ? LIMIT 1";
|
||||||
$res = sqlDAL::readSql($sql, "i", [$user_id]);
|
$res = sqlDAL::readSql($sql, "i", [$user_id], $refreshCache);
|
||||||
$data = sqlDAL::fetchAssoc($res);
|
$data = sqlDAL::fetchAssoc($res);
|
||||||
sqlDAL::close($res);
|
sqlDAL::close($res);
|
||||||
if ($res != false) {
|
if (!empty($data)) {
|
||||||
|
$data['live_servers_id'] = Live::getLiveServersIdRequest();
|
||||||
$liveStreamObject = new LiveStreamObject($data['key'], $data['live_servers_id']);
|
$liveStreamObject = new LiveStreamObject($data['key'], $data['live_servers_id']);
|
||||||
$data['key_with_index'] = $liveStreamObject->getKeyWithIndex(true);
|
$data['key_with_index'] = $liveStreamObject->getKeyWithIndex(true);
|
||||||
$data['live_index'] = $liveStreamObject->getIndex();
|
$data['live_index'] = $liveStreamObject->getIndex();
|
||||||
|
@ -291,13 +292,17 @@ class LiveTransmition extends ObjectYPT
|
||||||
if (!empty($row)) {
|
if (!empty($row)) {
|
||||||
$row['live_schedule_id'] = 0;
|
$row['live_schedule_id'] = 0;
|
||||||
$row['scheduled'] = 0;
|
$row['scheduled'] = 0;
|
||||||
$row['users_id'] = 0;
|
|
||||||
}
|
}
|
||||||
if (!empty($row)) {
|
if (!empty($row)) {
|
||||||
$p = $row['live_password'];
|
$p = $row['live_password'];
|
||||||
$row = cleanUpRowFromDatabase($row);
|
$row = cleanUpRowFromDatabase($row);
|
||||||
$row['live_password'] = $p;
|
$row['live_password'] = $p;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (empty($row['users_id'])) {
|
||||||
|
$row['users_id'] = 0;
|
||||||
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
$row = false;
|
$row = false;
|
||||||
}
|
}
|
||||||
|
@ -313,8 +318,15 @@ class LiveTransmition extends ObjectYPT
|
||||||
return $row;
|
return $row;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function save()
|
public function save(){
|
||||||
{
|
if(empty($this->users_id)){
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
$row = self::getFromDbByUser($this->users_id, true);
|
||||||
|
if(!empty($row)){
|
||||||
|
$this->id = $row['id'];
|
||||||
|
}
|
||||||
|
|
||||||
$this->public = intval($this->public);
|
$this->public = intval($this->public);
|
||||||
$this->saveTransmition = intval($this->saveTransmition);
|
$this->saveTransmition = intval($this->saveTransmition);
|
||||||
$this->showOnTV = intval($this->showOnTV);
|
$this->showOnTV = intval($this->showOnTV);
|
||||||
|
@ -413,7 +425,6 @@ class LiveTransmition extends ObjectYPT
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function getFromKey($key, $checkSchedule = true){
|
public static function getFromKey($key, $checkSchedule = true){
|
||||||
global $global;
|
|
||||||
return self::keyExists($key, $checkSchedule);
|
return self::keyExists($key, $checkSchedule);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -276,34 +276,6 @@ $global['doNotLoadPlayer'] = 1;
|
||||||
var params = {};
|
var params = {};
|
||||||
var attributes = {};
|
var attributes = {};
|
||||||
|
|
||||||
function amIOnline() {
|
|
||||||
$.ajax({
|
|
||||||
url: '<?php echo $global['webSiteRootURL']; ?>plugin/Live/stats.json.php?checkIfYouOnline',
|
|
||||||
data: {
|
|
||||||
"name": "<?php echo $streamName; ?>"
|
|
||||||
},
|
|
||||||
type: 'post',
|
|
||||||
success: function(response) {
|
|
||||||
offLine = true;
|
|
||||||
if (response.applications) {
|
|
||||||
for (i = 0; i < response.applications.length; i++) {
|
|
||||||
if (response.applications[i].key === "<?php echo $trasnmition['key']; ?>") {
|
|
||||||
offLine = false;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// you online do not show webcam
|
|
||||||
if (!offLine) {
|
|
||||||
$('#webcam').find('.alert').text("<?php echo __("You are online now, web cam is disabled"); ?>");
|
|
||||||
} else {
|
|
||||||
$('#webcam').find('.alert').text("<?php echo __("You are not online, loading webcam..."); ?>");
|
|
||||||
swfobject.embedSWF("<?php echo $global['webSiteRootURL']; ?>plugin/Live/view/webcam.swf", "webcam", "100%", "100%", "9.0.0", "expressInstall.swf", flashvars, params, attributes);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
function saveStream() {
|
function saveStream() {
|
||||||
modal.showPleaseWait();
|
modal.showPleaseWait();
|
||||||
|
|
||||||
|
@ -351,9 +323,6 @@ $global['doNotLoadPlayer'] = 1;
|
||||||
$('.btnSaveStream').click(function() {
|
$('.btnSaveStream').click(function() {
|
||||||
saveStream();
|
saveStream();
|
||||||
});
|
});
|
||||||
$('#enableWebCam').click(function() {
|
|
||||||
amIOnline();
|
|
||||||
});
|
|
||||||
|
|
||||||
<?php
|
<?php
|
||||||
echo PlayerSkins::getStartPlayerJS("", "", true);
|
echo PlayerSkins::getStartPlayerJS("", "", true);
|
||||||
|
|
|
@ -57,7 +57,7 @@ if (empty($_GET['p'])) {
|
||||||
|
|
||||||
$lt = LiveTransmition::getFromKey($name);
|
$lt = LiveTransmition::getFromKey($name);
|
||||||
|
|
||||||
if(!empty($lt)){
|
if(!empty($lt) && !empty($lt['users_id'])){
|
||||||
$name = Live::cleanUpKey($_POST['name']);
|
$name = Live::cleanUpKey($_POST['name']);
|
||||||
if($name == $lt['key']){
|
if($name == $lt['key']){
|
||||||
$user = new User($lt['users_id']);
|
$user = new User($lt['users_id']);
|
||||||
|
@ -67,7 +67,7 @@ if (empty($_GET['p'])) {
|
||||||
_error_log("NGINX ON Publish encryption token keys doe not matchd: {$name} == {$lt['key']}");
|
_error_log("NGINX ON Publish encryption token keys doe not matchd: {$name} == {$lt['key']}");
|
||||||
}
|
}
|
||||||
}else{
|
}else{
|
||||||
_error_log("NGINX ON Publish encryption token error livetransmition error: [{$name}]");
|
_error_log("NGINX ON Publish encryption token error livetransmition error: [{$name}] ".json_encode($lt));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -97,7 +97,7 @@ if (empty($_POST['name']) && !empty($_GET['name'])) {
|
||||||
if (empty($_POST['name']) && !empty($_GET['key'])) {
|
if (empty($_POST['name']) && !empty($_GET['key'])) {
|
||||||
$_POST['name'] = $_GET['key'];
|
$_POST['name'] = $_GET['key'];
|
||||||
}
|
}
|
||||||
if (strpos($_GET['p'], '/') !== false) {
|
if (!empty($_GET['p']) && strpos($_GET['p'], '/') !== false) {
|
||||||
$parts = explode("/", $_GET['p']);
|
$parts = explode("/", $_GET['p']);
|
||||||
if (!empty($parts[1])) {
|
if (!empty($parts[1])) {
|
||||||
$_GET['p'] = $parts[0];
|
$_GET['p'] = $parts[0];
|
||||||
|
@ -177,7 +177,7 @@ if (!empty($obj) && empty($obj->error)) {
|
||||||
_error_log("NGINX Live::on_publish end");
|
_error_log("NGINX Live::on_publish end");
|
||||||
if (AVideoPlugin::isEnabledByName('YPTSocket')) {
|
if (AVideoPlugin::isEnabledByName('YPTSocket')) {
|
||||||
$array = setLiveKey($lth->getKey(), $lth->getLive_servers_id());
|
$array = setLiveKey($lth->getKey(), $lth->getLive_servers_id());
|
||||||
ob_end_flush();
|
@ob_clean();
|
||||||
_ob_start();
|
_ob_start();
|
||||||
$lth = new LiveTransmitionHistory($obj->liveTransmitionHistory_id);
|
$lth = new LiveTransmitionHistory($obj->liveTransmitionHistory_id);
|
||||||
$m3u8 = Live::getM3U8File($lth->getKey(), false,true);
|
$m3u8 = Live::getM3U8File($lth->getKey(), false,true);
|
||||||
|
@ -187,7 +187,6 @@ if (!empty($obj) && empty($obj->error)) {
|
||||||
include "{$global['systemRootPath']}plugin/Live/on_publish_socket_notification.php";
|
include "{$global['systemRootPath']}plugin/Live/on_publish_socket_notification.php";
|
||||||
} else {
|
} else {
|
||||||
$command = get_php(). " {$global['systemRootPath']}plugin/Live/on_publish_socket_notification.php '$users_id' '$m3u8' '{$obj->liveTransmitionHistory_id}'";
|
$command = get_php(). " {$global['systemRootPath']}plugin/Live/on_publish_socket_notification.php '$users_id' '$m3u8' '{$obj->liveTransmitionHistory_id}'";
|
||||||
|
|
||||||
_error_log("NGINX Live::on_publish YPTSocket start ($command)");
|
_error_log("NGINX Live::on_publish YPTSocket start ($command)");
|
||||||
$pid = execAsync($command);
|
$pid = execAsync($command);
|
||||||
_error_log("NGINX Live::on_publish YPTSocket end {$pid}");
|
_error_log("NGINX Live::on_publish YPTSocket end {$pid}");
|
||||||
|
|
|
@ -58,7 +58,8 @@ if (strpos($_GET['p'], '/') !== false) {
|
||||||
}
|
}
|
||||||
|
|
||||||
Live::deleteStatsCache(true);
|
Live::deleteStatsCache(true);
|
||||||
$row = LiveTransmitionHistory::getLatest($_POST['name'], $row['live_servers_id'], true);
|
$live_servers_id = Live::getLiveServersIdRequest();
|
||||||
|
$row = LiveTransmitionHistory::getLatest($_POST['name'], $live_servers_id, true);
|
||||||
$insert_row = LiveTransmitionHistory::finishFromTransmitionHistoryId($row['id']);
|
$insert_row = LiveTransmitionHistory::finishFromTransmitionHistoryId($row['id']);
|
||||||
_error_log("NGINX ON Publish Done finishFromTransmitionHistoryId {$_POST['name']} id={$row['id']} key={$row['key']} live_servers_id={$row['live_servers_id']} insert_row={$insert_row}");
|
_error_log("NGINX ON Publish Done finishFromTransmitionHistoryId {$_POST['name']} id={$row['id']} key={$row['key']} live_servers_id={$row['live_servers_id']} insert_row={$insert_row}");
|
||||||
Live::killIfIsRunning($row['key']);
|
Live::killIfIsRunning($row['key']);
|
||||||
|
@ -67,4 +68,8 @@ $parameters = Live::getLiveParametersFromKey($array['key']);
|
||||||
$array['cleanKey'] = $parameters['cleanKey'];
|
$array['cleanKey'] = $parameters['cleanKey'];
|
||||||
$array['stats'] = LiveTransmitionHistory::getStatsAndRemoveApplication($row['id']);
|
$array['stats'] = LiveTransmitionHistory::getStatsAndRemoveApplication($row['id']);
|
||||||
$socketObj = Live::notifySocketStats("socketLiveOFFCallback", $array);
|
$socketObj = Live::notifySocketStats("socketLiveOFFCallback", $array);
|
||||||
|
if(empty($row)){
|
||||||
|
_error_log("NGINX ON Publish Done error LiveTransmitionHistory::getLatest({$_POST['name']}, $live_servers_id, true);");
|
||||||
|
}else{
|
||||||
AVideoPlugin::on_publish_done($row['id'], $row['users_id'], $row['key'], $row['live_servers_id']);
|
AVideoPlugin::on_publish_done($row['id'], $row['users_id'], $row['key'], $row['live_servers_id']);
|
||||||
|
}
|
|
@ -239,15 +239,24 @@ class Message implements MessageComponentInterface {
|
||||||
}
|
}
|
||||||
|
|
||||||
private function shouldPropagateInfo($row) {
|
private function shouldPropagateInfo($row) {
|
||||||
|
global $_shouldPropagateInfoLastMessage;
|
||||||
if (!empty($row['yptDeviceId']) && preg_match('/^unknowDevice.*/', $row['yptDeviceId'])) {
|
if (!empty($row['yptDeviceId']) && preg_match('/^unknowDevice.*/', $row['yptDeviceId'])) {
|
||||||
|
$_shouldPropagateInfoLastMessage = 'unknowDevice';
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (!empty($row['isCommandLine'])) {
|
if (!empty($row['isCommandLine'])) {
|
||||||
|
$_shouldPropagateInfoLastMessage = 'isCommandLine';
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private function getShouldPropagateInfoLastMessage() {
|
||||||
|
global $_shouldPropagateInfoLastMessage;
|
||||||
|
return $_shouldPropagateInfoLastMessage;
|
||||||
|
}
|
||||||
|
|
||||||
public function msgToResourceId($msg, $resourceId, $type = "", $totals = array()) {
|
public function msgToResourceId($msg, $resourceId, $type = "", $totals = array()) {
|
||||||
global $onMessageSentTo, $SocketDataObj;
|
global $onMessageSentTo, $SocketDataObj;
|
||||||
if (empty($resourceId)) {
|
if (empty($resourceId)) {
|
||||||
|
@ -261,7 +270,7 @@ class Message implements MessageComponentInterface {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$this->shouldPropagateInfo($row)) {
|
if (!$this->shouldPropagateInfo($row)) {
|
||||||
_log_message("msgToResourceId: we wil NOT send the message to resourceId=({$resourceId}) {$type}");
|
_log_message("msgToResourceId: we wil NOT send the message to resourceId=({$resourceId}) [{$type}] ".$this->getShouldPropagateInfoLastMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!is_array($msg)) {
|
if (!is_array($msg)) {
|
||||||
|
@ -437,17 +446,10 @@ class Message implements MessageComponentInterface {
|
||||||
}
|
}
|
||||||
|
|
||||||
$rows = dbGetAllResourcesIdFromLive($live_key, $live_servers_id);
|
$rows = dbGetAllResourcesIdFromLive($live_key, $live_servers_id);
|
||||||
$return = $this->getTotals();
|
$totals = $this->getTotals();
|
||||||
|
|
||||||
$info = array(
|
|
||||||
'webSocketServerVersion' => $SocketDataObj->serverVersion,
|
|
||||||
'socket_users_id' => $users_id,
|
|
||||||
'socket_resourceId' => $resourceId,
|
|
||||||
);
|
|
||||||
|
|
||||||
$autoUpdateOnHTML = array_merge($info, $return);
|
|
||||||
foreach ($rows as $value) {
|
foreach ($rows as $value) {
|
||||||
$this->msgToResourceId($msg, $value['resourceId'], \SocketMessageType::ON_LIVE_MSG);
|
$this->msgToResourceId($msg, $value['resourceId'], \SocketMessageType::ON_LIVE_MSG, $totals);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -196,7 +196,11 @@ class YPTSocket extends PluginAbstract {
|
||||||
$port = $socketobj->port;
|
$port = $socketobj->port;
|
||||||
$protocol = "ws";
|
$protocol = "ws";
|
||||||
$scheme = parse_url($global['webSiteRootURL'], PHP_URL_SCHEME);
|
$scheme = parse_url($global['webSiteRootURL'], PHP_URL_SCHEME);
|
||||||
if (strtolower($scheme) === 'https') {
|
if($address == 'avideo'){
|
||||||
|
$protocol = "wss";
|
||||||
|
$dockerVars = getDockerVars();
|
||||||
|
$address = $dockerVars->SERVER_NAME;
|
||||||
|
}else if (strtolower($scheme) === 'https') {
|
||||||
$protocol = "wss";
|
$protocol = "wss";
|
||||||
}
|
}
|
||||||
if (empty($webSocketToken)) {
|
if (empty($webSocketToken)) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue