Skip to content
Snippets Groups Projects
Commit c7bc27c4 authored by Peter Gerwinski's avatar Peter Gerwinski
Browse files

Initial revision

parents
No related branches found
No related tags found
No related merge requests found
Showing
with 767 additions and 0 deletions
room-1001: {
description = "VNC 1 Camera"
publishers = 1
bitrate = 128000
fir_freq = 10
record = false
}
room-1002: {
description = "VNC 2 Camera"
publishers = 1
bitrate = 128000
fir_freq = 10
record = false
}
room-1003: {
description = "VNC 3 Camera"
publishers = 1
bitrate = 128000
fir_freq = 10
record = false
}
room-1004: {
description = "VNC 4 Camera"
publishers = 1
bitrate = 128000
fir_freq = 10
record = false
}
room-1005: {
description = "VNC 5 Camera"
publishers = 1
bitrate = 128000
fir_freq = 10
record = false
}
room-1006: {
description = "VNC 6 Camera"
publishers = 1
bitrate = 128000
fir_freq = 10
record = false
}
server {
listen 443 ssl;
listen [::]:443 ssl;
[...]
location /cgi-bin/ {
# https://www.howtoforge.com/serving-cgi-scripts-with-nginx-on-debian-squeeze-ubuntu-11.04-p3
# Disable gzip (it makes scripts feel slower since they have to complete
# before getting gzipped)
gzip off;
# Set the root to /usr/lib (inside this location this means that we are
# giving access to the files under /usr/lib/cgi-bin)
root /var/www/streaming;
# Fastcgi socket
fastcgi_pass unix:/var/run/fcgiwrap.socket;
# Fastcgi parameters, include the standard ones
include /etc/nginx/fastcgi_params;
# Adjust non standard parameters (SCRIPT_FILENAME)
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
}
#ProxyPass /websock/1/ ws://localhost:6081/websockify
location ~ ^/websock/1/(.*) {
proxy_pass http://127.0.0.1:6081/websockify$1;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "Upgrade";
proxy_set_header Host $host;
proxy_read_timeout 3600s;
proxy_send_timeout 3600s;
}
[...]
location ~ ^/websock/26/(.*) {
proxy_pass http://127.0.0.1:6106/websockify$1;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "Upgrade";
proxy_set_header Host $host;
proxy_read_timeout 3600s;
proxy_send_timeout 3600s;
}
[...]
location ~ ^/socket.io/5005/ {
proxy_pass http://127.0.0.1:5005;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "Upgrade";
proxy_set_header Host $host;
proxy_read_timeout 3600s;
proxy_send_timeout 3600s;
proxy_redirect off;
}
location ~ ^/vnc.html?(.*) {
proxy_pass http://127.0.0.1:6081/vnc.html?$1;
}
location ~ /(app|core|include|utils|vendor)/(.*) {
proxy_pass http://127.0.0.1:6081/$1/$2;
}
}
bbb_url="https://bbb.cvh-server.de/b/pet-jxk-dch"
bbb_invitation="follow <a target="_blank" href=\"$bbb_url\">link</a> to $bbb_url"
module vnc vnc port=5521 autostart nobuttons
#module vnc-gast vnc invitation="connect to streaming.cvh-server.de:1"
module bbb bbb-camera module_name="" url="$bbb_url" invitation="$bbb_invitation"
#start_text="starten"
#stop_text="stoppen"
#hide_text="verbergen"
#show_text="zeigen"
#min_text="minimieren"
#max_text="maximieren"
bbb_url="https://bbb.cvh-server.de/b/pet-jxk-dch"
bbb_invitation="follow <a target=\"_blank\" href=\"$bbb_url\">this link</a> to $bbb_url"
jm_url="https://meet.cvh-server.de/VNC6"
jm_invitation="follow <a target=\"_blank\" href=\"$jm_url\">this link</a> to $jm_url"
janus_receiver_url="https://streaming.cvh-server.de/cvh-camera/camera-receiver.html?room=1006"
janus_receiver_url_redundant="https://streaming.cvh-server.de/cvh-camera/camera-receiver.html?room=1005"
janus_sender_url="https://streaming.cvh-server.de/cvh-camera/camera-sender.html?room=1006"
janus_sender_url_redundant="https://streaming.cvh-server.de/cvh-camera/camera-sender.html?room=1005"
janus_invitation="follow <a target=\"_blank\" href=\"$janus_sender_url\">this link</a> to $janus_sender_url"
janus_invitation_redundant="follow <a target=\"_blank\" href=\"$janus_sender_url_redundant\">this link</a> to $janus_sender_url_redundant"
om_url="https://openmeetings.cvh-server.de:5443/openmeetings/#room/24"
om_invitation="follow <a target=\"_blank\" href=\"$om_url\">this link</a> to $om_url"
upload_sender_url="https://streaming.cvh-server.de/cgi-bin/pult-upload-6.cgi"
upload_invitation="follow <a target="_blank" href=\"$upload_sender_url\">this link</a> to $upload_sender_url"
module vnc vnc module_name="VNC" listen=26 invitation="connect through SSH tunnel to port 5526"
module vnc-gast vnc module_name="VNC Gast" invitation="connect to streaming.cvh-server.de:6"
module bbb bbb-camera module_name="BBB-Kamera" url="$bbb_url" invitation="$bbb_invitation"
module jm jm-camera module_name="JM-Kamera" url="$jm_url" invitation="$jm_invitation"
camera_default_max_resolution="1024x768"
module janus cvh-camera module_name="CVH-Kamera 6" url="$janus_receiver_url" persistent_invitation="$janus_invitation"
module janus-r cvh-camera module_name="CVH-Kamera 5" camera_room="1005" url="$janus_receiver_url_redundant" persistent_invitation="$janus_invitation_redundant" min_geometry="480x360-0-360"
module janus-d cvh-camera module_name="CVH-Kamera D" browser="false" direct="true" persistent_invitation="$janus_invitation"
module om om-board module_name="OM-Tafel" url="$om_url" persistent_invitation="$om_invitation"
module bbbb bbb-board module_name="BBB-Tafel" url="$bbb_url" persistent_invitation="$bbb_invitation" min_geometry="1440x810+0+0"
module upload upload module_name="Upload" persistent_invitation="$upload_invitation"
pultd_port="$((6070 + channel))"
module_directory="/usr/local/lib/pult"
run_directory="/usr/local/var/run/pult"
upload_directory="/usr/local/var/spool/pult"
default_resolution="1920x1080"
camera_default_max_resolution="1024x768"
#cert_file="/etc/letsencrypt/live/$(hostname -f)/fullchain.pem"
#key_file="/etc/letsencrypt/live/$(hostname -f)/privkey.pem"
cert_file="/etc/letsencrypt/live/meet.cvh-server.de/fullchain.pem"
key_file="/etc/letsencrypt/live/meet.cvh-server.de/privkey.pem"
[Unit]
Description = CVH Camera %i
After = syslog.target network.target janus.target
[Service]
Type = simple
User = pult
ExecStart = /usr/local/sbin/cvh-camera %i
[Install]
WantedBy = multi-user.target
[Unit]
Description = noVNC service %i
After=syslog.target network.target
[Service]
Type = simple
User = novnc
ExecStart = /usr/local/sbin/novnc %i
[Install]
WantedBy = multi-user.target
[Unit]
Description = PULT ULTimate Learning/Teaching Tool %i
After = syslog.target network.target vncserver@%i.target
[Service]
Type = simple
User = pult
ExecStart = /usr/local/sbin/pultd %i
[Install]
WantedBy = multi-user.target
[Unit]
Description = VNC repeater %i
After = syslog.target network.target vncserver@%i.target
[Service]
Type = simple
User = pult
ExecStart = /usr/local/sbin/vncrepeater %i
[Install]
WantedBy = multi-user.target
[Unit]
Description = VNC server %i
After = syslog.target network.target
[Service]
Type = forking
User = pult
ExecStart = /usr/local/sbin/vncserver start %i
ExecStop = /usr/local/sbin/vncserver stop %i
[Install]
WantedBy = multi-user.target
File added
#!/bin/bash
debug=true
module_name="$1"
channel="$2"
. "/usr/local/etc/pult/pult.conf"
. "/usr/local/lib/pult/pult.functions"
pid_file="$run_directory/$module_name-$channel.pid"
$debug && echo "$0[$channel]: pid_file = $pid_file" 1>&2
module ()
{
m="$1"
shift 2
if [ "$m" = "$module_name" ]; then
for opt in "$@"; do
$debug && echo "$0[$channel]: option: $opt" 1>&2
case "$opt" in
"url="*)
url="$(echo $opt | sed -e 's/^url=//')"
;;
esac
done
fi
}
max_width=1920
max_height=810
. "/usr/local/etc/pult/pult-$channel.conf"
$debug && echo "$0[$channel]: url = $url" 1>&2
cleanup ()
{
if [ -n "$(jobs -p)" ]; then
kill $(jobs -p)
fi
}
trap cleanup exit;
if [ -z "$url" ]; then
echo "$0[$channel]: configuration error: missing URL" 1>&2
exit 1
fi
env python3 "$module_directory/bbb-board.py" "$url" &
selenium_pid="$!"
line=$(xwininfo -root -children | grep "bbb\.cvh-server\.de")
while [ -z "$line" ]; do
sleep 0.1
line=$(xwininfo -root -children | grep "data:\|Datenschutz\|BigBlueButton")
done
windowid=$(echo $line | cut -d " " -f 1)
xdotool set_window --name "Controlled by PULT" "$windowid"
report_status "waiting" "$windowid" "$max_width" "$max_height"
chromium_pid=$(xdotool getwindowpid "$windowid")
$debug && echo "$0[$channel]: chromium_pid = $chromium_pid" 1>&2
rm -rf "$pid_file"
echo "$chromium_pid" > "$pid_file"
wait "$selenium_pid"
xdotool set_window --name "Controlled by PULT" "$windowid"
report_status "running" "$windowid" "$max_width" "$max_height"
#!/bin/bash
debug=true
module_name="$PULT_MODULE_NAME"
channel="$PULT_CHANNEL"
$debug && echo "$0[$channel]: $module_name $@" 1>&2
. "/usr/local/etc/pult/pult.conf"
pid_file="$run_directory/$module_name-$channel.pid"
$debug && echo "$0[$channel]: pid_file = $pid_file" 1>&2
cmd="$1"
case "$cmd" in
start)
daemon="$(echo $0 | sed -e 's/\.module/.daemon/')"
"$daemon" "$module_name" "$channel" &
;;
stop)
if [ -f "$pid_file" ]; then
pid=$(cat "$pid_file")
ppid=$(ps --no-headers -o "%P" "$pid")
kill "$pid" "$ppid" || true
rm -rf "$pid_file"
else
echo -e "$0[$channel]: stop: not running"
fi
;;
defaults)
echo "min=false"
;;
geometry)
$debug && echo "new geometry: ${2}x${3}+$4+$5" 1>&2
;;
*)
echo -e "$0[$channel]: invalid command\"$@\""
;;
esac
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
from time import sleep
from sys import argv
from selenium import webdriver
from selenium.webdriver.chrome.options import Options
from selenium.common.exceptions import NoSuchElementException
def find_element(xpath):
element = None
while not element:
try:
element = browser.find_element_by_xpath(xpath)
except NoSuchElementException:
sleep(1)
element = None
return element
def click_element(xpath):
element = find_element(xpath)
success = False
while not success:
try:
element.click()
success = True
except:
sleep(1)
options = Options()
options.add_argument('--disable-infobars')
options.add_argument('--no-sandbox')
options.add_argument('--kiosk')
options.add_argument('--window-size=1920,1080')
options.add_argument('--window-position=0,0')
options.add_experimental_option("excludeSwitches", ['enable-automation']);
options.add_argument('--shm-size=1gb')
options.add_argument('--disable-dev-shm-usage')
options.add_argument('--start-fullscreen')
browser = webdriver.Chrome(executable_path='chromedriver', options=options)
browser.get (argv[1])
find_element('//input[contains(@id,"_join_name")]').send_keys('VNC')
find_element('//button[@id="room-join"]').click()
browser.find_element_by_id('yes').click()
click_element('//button[@aria-label="Close Join audio modal"]')
click_element('//button[@aria-label="Make Presentation fullscreen"]')
find_element('//div[contains(@class,"svgContainer")]') # Just wait for it ...
browser.execute_script('var divs = document.getElementsByTagName ("div"); '
+ 'var item; '
+ 'for (var i = 0, len = divs.length; i < len; i++) '
+ ' { '
+ ' item = divs[i]; '
+ ' if (item.className && item.className.indexOf ("svgContainer") == 0) '
+ ' item.style.marginRight = "480px"; '
+ ' } ')
#!/bin/bash
debug=true
module_name="$1"
channel="$2"
. "/usr/local/etc/pult/pult.conf"
. "/usr/local/lib/pult/pult.functions"
pid_file="$run_directory/$module_name-$channel.pid"
$debug && echo "$0[$channel]: pid_file = $pid_file" 1>&2
module ()
{
m="$1"
shift 2
if [ "$m" = "$module_name" ]; then
for opt in "$@"; do
$debug && echo "$0[$channel]: option: $opt" 1>&2
case "$opt" in
"url="*)
url="$(echo $opt | sed -e 's/^url=//')"
;;
esac
done
fi
}
max_width=$(echo "$camera_default_max_resolution" | cut -d "x" -f 1)
max_height=$(echo "$camera_default_max_resolution" | cut -d "x" -f 2)
. "/usr/local/etc/pult/pult-$channel.conf"
$debug && echo "$0[$channel]: url = $url" 1>&2
cleanup ()
{
if [ -n "$(jobs -p)" ]; then
kill $(jobs -p)
fi
}
trap cleanup exit;
if [ -z "$url" ]; then
echo "$0[$channel]: configuration error: missing URL" 1>&2
exit 1
fi
env python3 "$module_directory/bbb-camera.py" "$url" &
selenium_pid="$!"
line=$(xwininfo -root -children | grep "bbb\.cvh-server\.de")
while [ -z "$line" ]; do
sleep 0.1
line=$(xwininfo -root -children | grep "data:\|Datenschutz\|BigBlueButton")
done
windowid=$(echo $line | cut -d " " -f 1)
xdotool set_window --name "Controlled by PULT" "$windowid"
report_status "waiting" "$windowid" "$max_width" "$max_height"
chromium_pid=$(xdotool getwindowpid "$windowid")
$debug && echo "$0[$channel]: chromium_pid = $chromium_pid" 1>&2
rm -rf "$pid_file"
echo "$chromium_pid" > "$pid_file"
wait "$selenium_pid"
xdotool set_window --name "Controlled by PULT" "$windowid"
report_status "running" "$windowid" "$max_width" "$max_height"
#!/bin/bash
debug=true
module_name="$PULT_MODULE_NAME"
channel="$PULT_CHANNEL"
$debug && echo "$0[$channel]: $module_name $@" 1>&2
. "/usr/local/etc/pult/pult.conf"
pid_file="$run_directory/$module_name-$channel.pid"
$debug && echo "$0[$channel]: pid_file = $pid_file" 1>&2
cmd="$1"
case "$cmd" in
start)
daemon="$(echo $0 | sed -e 's/\.module/.daemon/')"
"$daemon" "$module_name" "$channel" &
;;
stop)
if [ -f "$pid_file" ]; then
pid=$(cat "$pid_file")
ppid=$(ps --no-headers -o "%P" "$pid")
kill "$pid" "$ppid" || true
rm -rf "$pid_file"
else
echo -e "$0[$channel]: stop: not running"
fi
;;
defaults)
echo "min=true"
;;
geometry)
$debug && echo "new geometry: ${2}x${3}+$4+$5" 1>&2
;;
*)
echo -e "$0[$channel]: invalid command\"$@\""
;;
esac
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
from time import sleep
from sys import argv
from selenium import webdriver
from selenium.webdriver.chrome.options import Options
from selenium.common.exceptions import NoSuchElementException
def find_element(xpath):
element = None
while not element:
try:
element = browser.find_element_by_xpath(xpath)
except NoSuchElementException:
sleep(1)
element = None
return element
def click_element(xpath):
element = find_element(xpath)
success = False
while not success:
try:
element.click()
success = True
except:
sleep(1)
options = Options()
options.add_argument('--disable-infobars')
options.add_argument('--no-sandbox')
options.add_argument('--kiosk')
options.add_argument('--window-size=1920,1080')
options.add_argument('--window-position=0,0')
options.add_experimental_option("excludeSwitches", ['enable-automation']);
options.add_argument('--shm-size=1gb')
options.add_argument('--disable-dev-shm-usage')
options.add_argument('--start-fullscreen')
browser = webdriver.Chrome(executable_path='chromedriver', options=options)
browser.get (argv[1])
find_element('//input[contains(@id,"_join_name")]').send_keys('VNC')
find_element('//button[@id="room-join"]').click()
browser.find_element_by_id('yes').click()
click_element('//button[@aria-label="Close Join audio modal"]')
click_element('//div[@id="container"]//div[contains(@class,"videoContainer--")]//button')
#!/bin/bash
debug=true
module_name="$1"
channel="$2"
camera_room="$((1000 + channel))"
browser=true
direct=false
. "/usr/local/etc/pult/pult.conf"
. "/usr/local/lib/pult/pult.functions"
pid_file="$run_directory/$module_name-$channel.pid"
$debug && echo "$0[$channel]: pid_file = $pid_file" 1>&2
module ()
{
m="$1"
shift 2
if [ "$m" = "$module_name" ]; then
for opt in "$@"; do
$debug && echo "$0[$channel]: option: $opt" 1>&2
case "$opt" in
"url="*)
url="$(echo $opt | sed -e 's/^url=//')"
;;
"camera_room="*)
camera_room="$(echo $opt | sed -e 's/^camera_room=//')"
;;
"direct="*)
direct="$(echo $opt | sed -e 's/^direct=//')"
;;
"browser="*)
browser="$(echo $opt | sed -e 's/^browser=//')"
;;
esac
done
fi
}
max_width=$(echo "$camera_default_max_resolution" | cut -d "x" -f 1)
max_height=$(echo "$camera_default_max_resolution" | cut -d "x" -f 2)
. "/usr/local/etc/pult/pult-$channel.conf"
$debug && echo "$0[$channel]: url = $url" 1>&2
cleanup ()
{
if [ -n "$(jobs -p)" ]; then
kill $(jobs -p)
fi
}
trap cleanup exit;
if $browser; then
if [ -z "$url" ]; then
echo "$0[$channel]: configuration error: missing URL for browser" 1>&2
exit 1
fi
env python3 "$module_directory/cvh-camera.py" "$url" &
selenium_pid="$!"
line=$(xwininfo -root -children | grep "novnc\.cvh-server\.de")
$debug && echo "camera_room = $camera_room" 1>&2
while [ -z "$line" ]; do
sleep 0.1
line=$(xwininfo -root -children | grep "Camera Receiver $camera_room")
done
windowid=$(echo $line | cut -d " " -f 1)
chromium_pid=$(xdotool getwindowpid "$windowid")
$debug && echo "$0[$channel]: chromium_pid = $chromium_pid" 1>&2
rm -rf "$pid_file"
echo "$chromium_pid" > "$pid_file"
if wait "$selenium_pid"; then
report_status "running" "$windowid" "$max_width" "$max_height"
else
$debug && echo "start of $module_name interrupted" 1>&2
fi
elif $direct; then
report_status "running" "NULL" "$max_width" "$max_height"
else
echo "$0[$channel]: configuration error: neither browser nor direct" 1>&2
exit 1
fi
#!/bin/bash
debug=true
module_name="$PULT_MODULE_NAME"
channel="$PULT_CHANNEL"
$debug && echo "$0[$channel]: $module_name $@" 1>&2
camera_room="$((1000 + channel))"
camera_server_port="$((5010 + channel))"
. "/usr/local/etc/pult/pult.conf"
direct=false
module ()
{
m="$1"
shift 2
if [ "$m" = "$module_name" ]; then
for opt in "$@"; do
$debug && echo "$0[$channel]: option: $opt" 1>&2
case "$opt" in
"camera_room="*)
camera_room="$(echo $opt | sed -e 's/^camera_room=//')"
;;
"camera_server_port="*)
camera_server_port="$(echo $opt | sed -e 's/^camera_server_port=//')"
;;
"direct="*)
direct="$(echo $opt | sed -e 's/^direct=//')"
esac
done
fi
}
. "/usr/local/etc/pult/pult-$channel.conf"
$debug && echo "$0[$channel]: camera_room = $camera_room, camera_server_port = $camera_server_port" 1>&2
pid_file="$run_directory/$module_name-$channel.pid"
$debug && echo "$0[$channel]: pid_file = $pid_file" 1>&2
cmd="$1"
case "$cmd" in
start)
daemon="$(echo $0 | sed -e 's/\.module/.daemon/')"
"$daemon" "$module_name" "$channel" &
;;
stop)
if $direct; then
$debug && echo "$0[$channel]: sending command to camera server: hide" 1>&2
echo "hide" | nc -q 0 localhost "$camera_server_port"
fi
if [ -f "$pid_file" ]; then
pid=$(cat "$pid_file")
ppid=$(ps --no-headers -o "%P" "$pid")
kill "$pid" "$ppid" || true
rm -rf "$pid_file"
else
echo -e "$0[$channel]: stop: not running"
fi
;;
defaults)
echo "min=true browser=true direct=false"
;;
geometry)
$debug && echo "new geometry: ${2}x${3}+$4+$5" 1>&2
if $direct; then
if [ "$2" = "hidden" ]; then
$debug && echo "$0[$channel]: sending command to camera server: hide" 1>&2
echo "hide" | nc -q 0 localhost "$camera_server_port"
else
$debug && echo "$0[$channel]: sending command to camera server: show" 1>&2
echo "show" | nc -q 0 localhost "$camera_server_port"
$debug && echo "$0[$channel]: sending command to camera server: set_geometry_relative_to_canvas lt $4 $5 $2 $3" 1>&2
echo "set_geometry_relative_to_canvas lt $4 $5 $2 $3" | nc -q 0 localhost "$camera_server_port"
fi
fi
;;
*)
echo -e "$0[$channel]: invalid command\"$@\""
;;
esac
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
from time import sleep
from sys import argv
from selenium import webdriver
from selenium.webdriver.chrome.options import Options
from selenium.common.exceptions import NoSuchElementException
def find_element(xpath):
element = None
while not element:
try:
element = browser.find_element_by_xpath(xpath)
except NoSuchElementException:
sleep(1)
element = None
return element
options = Options()
options.add_argument('--disable-infobars')
options.add_argument('--no-sandbox')
options.add_argument('--kiosk')
options.add_argument('--window-size=1920,1080')
options.add_argument('--window-position=0,0')
options.add_experimental_option("excludeSwitches", ['enable-automation']);
options.add_argument('--shm-size=1gb')
options.add_argument('--disable-dev-shm-usage')
options.add_argument('--start-fullscreen')
browser = webdriver.Chrome(executable_path='chromedriver', options=options)
browser.get (argv[1])
sleep(1)
# element = find_element('//button[@id="view"]')
element = find_element('//button')
success = False
while not success:
try:
element.click()
success = True
except:
sleep(1)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment