fix(cloudron) configure yt-dlp interactive bashing
This commit is contained in:
parent
e0b85a0825
commit
8c408e6c5b
@ -1,18 +1,25 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
set -euo pipefail
|
set -eo pipefail
|
||||||
|
|
||||||
read -rsp "Set password for admin (HTTP Basic Auth): " pass1; echo
|
read -rsp "Set password for admin (HTTP Basic Auth): " pass1; echo
|
||||||
read -rsp "Confirm password: " pass2; echo
|
read -rsp "Confirm password: " pass2; echo
|
||||||
|
if [ -z "${pass1:-}" ] || [ -z "${pass2:-}" ]; then
|
||||||
|
echo "Password not set. Aborting."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
[ "$pass1" != "$pass2" ] && echo "Passwords do not match." && exit 1
|
[ "$pass1" != "$pass2" ] && echo "Passwords do not match." && exit 1
|
||||||
|
|
||||||
read -rp "Enter downloads directory [/app/data/downloads]: " downloads_dir
|
read -rp "Enter downloads directory [/app/data/downloads]: " downloads_dir
|
||||||
downloads_dir=${downloads_dir:-/app/data/downloads}
|
downloads_dir=${downloads_dir:-/app/data/downloads}
|
||||||
|
|
||||||
|
set -euo pipefail
|
||||||
|
|
||||||
mkdir -p /app/data/public/bin "$downloads_dir"
|
mkdir -p /app/data/public/bin "$downloads_dir"
|
||||||
/bin/rm -f /app/data/public/bin/yt-dlp
|
/bin/rm -f /app/data/public/bin/yt-dlp
|
||||||
curl -sSL https://github.com/yt-dlp/yt-dlp/releases/latest/download/yt-dlp -o /app/data/public/bin/yt-dlp
|
curl -sSL https://github.com/yt-dlp/yt-dlp/releases/latest/download/yt-dlp -o /app/data/public/bin/yt-dlp
|
||||||
chmod +x /app/data/public/bin/yt-dlp
|
chmod +x /app/data/public/bin/yt-dlp
|
||||||
|
|
||||||
|
# .htaccess basic auth
|
||||||
if command -v htpasswd >/dev/null 2>&1; then
|
if command -v htpasswd >/dev/null 2>&1; then
|
||||||
htpasswd -cb /app/data/.htpasswd admin "$pass1"
|
htpasswd -cb /app/data/.htpasswd admin "$pass1"
|
||||||
else
|
else
|
||||||
@ -26,13 +33,13 @@ AuthUserFile /app/data/.htpasswd
|
|||||||
Require valid-user
|
Require valid-user
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
set +u
|
# Config
|
||||||
{
|
{
|
||||||
echo "[settings]"
|
echo "[settings]"
|
||||||
echo "downloads_dir=$downloads_dir"
|
echo "downloads_dir=$downloads_dir"
|
||||||
} > /app/data/config.ini
|
} > /app/data/config.ini
|
||||||
set -u
|
|
||||||
|
|
||||||
|
# PHP Front
|
||||||
cat > /app/data/public/index.php <<'EOF'
|
cat > /app/data/public/index.php <<'EOF'
|
||||||
<?php
|
<?php
|
||||||
$config = parse_ini_file("/app/data/config.ini");
|
$config = parse_ini_file("/app/data/config.ini");
|
||||||
@ -115,6 +122,7 @@ foreach ($success as $entry) {
|
|||||||
</html>
|
</html>
|
||||||
EOF
|
EOF
|
||||||
|
|
||||||
|
# PHP Log viewer
|
||||||
cat > /app/data/public/log.php <<'EOF'
|
cat > /app/data/public/log.php <<'EOF'
|
||||||
<?php
|
<?php
|
||||||
if (file_exists("/tmp/yt-dlp.log") && filesize("/tmp/yt-dlp.log") > 5 * 1024 * 1024) {
|
if (file_exists("/tmp/yt-dlp.log") && filesize("/tmp/yt-dlp.log") > 5 * 1024 * 1024) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user