From 26f1c8d6fa8f1741ecce86a65bfe826c80eaa84a Mon Sep 17 00:00:00 2001 From: Tobias Meier Date: Mon, 5 May 2025 10:26:14 +0200 Subject: [PATCH] add streamlink-webui --- ct/streamlink-webui.sh | 70 ++++++++++++++++++++ frontend/public/json/streamlink-webui.json | 40 ++++++++++++ install/streamlink-webui-install.sh | 74 ++++++++++++++++++++++ 3 files changed, 184 insertions(+) create mode 100644 ct/streamlink-webui.sh create mode 100644 frontend/public/json/streamlink-webui.json create mode 100644 install/streamlink-webui-install.sh diff --git a/ct/streamlink-webui.sh b/ct/streamlink-webui.sh new file mode 100644 index 0000000..1ecd29d --- /dev/null +++ b/ct/streamlink-webui.sh @@ -0,0 +1,70 @@ +#!/usr/bin/env bash +source <(curl -fsSL https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/misc/build.func) +# Copyright (c) 2021-2025 community-scripts ORG +# Author: CrazyWolf13 +# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE +# Source: https://github.com/CrazyWolf13/streamlink-webui + +# App Default Values +APP="streamlink-webui" +var_tags="download;streaming" +var_cpu="2" +var_ram="2048" +var_disk="5" +var_os="debian" +var_version="12" +var_unprivileged="1" +# 1 = unprivileged container, 0 = privileged container + +header_info "$APP" +variables +color +catch_errors + +function update_script() { + header_info + check_container_storage + check_container_resources + + if [[ ! -f /opt/streamlink-webui ]]; then + msg_error "No ${APP} Installation Found!" + exit + fi + + RELEASE=$(curl -fsSL https://api.github.com/repos/CrazyWolf13/streamlink-webui/releases/latest | grep "tag_name" | awk '{print substr($2, 2, length($2)-3) }') + if [[ "${RELEASE}" != "$(cat /opt/${APP}_version.txt)" ]] || [[ ! -f /opt/${APP}_version.txt ]]; then + msg_info "Stopping $APP" + systemctl stop ${APP} + msg_ok "Stopped $APP" + + msg_info "Creating Backup" + msg_ok "Backup Created" + + msg_info "Updating $APP to v${RELEASE}" + fetch_and_deploy_gh_release "CrazyWolf13/streamlink-webui" + cd /opt/"${APPLICATION}"/backend/src + pip install -r requirements.txt + cd ../../frontend/src + npm install + yarn build + msg_ok "Updated $APP to v${RELEASE}" + + msg_info "Starting $APP" + systemctl start ${APP} + msg_ok "Started $APP" + + msg_ok "Update Successful" + else + msg_ok "No update required. ${APP} is already at v${RELEASE}" + fi + exit +} + +start +build_container +description + +msg_ok "Completed Successfully!\n" +echo -e "${CREATING}${GN}${APP} setup has been successfully initialized!${CL}" +echo -e "${INFO}${YW} Access it using the following URL:${CL}" +echo -e "${TAB}${GATEWAY}${BGN}http://${IP}:[PORT]${CL}" diff --git a/frontend/public/json/streamlink-webui.json b/frontend/public/json/streamlink-webui.json new file mode 100644 index 0000000..bbac9aa --- /dev/null +++ b/frontend/public/json/streamlink-webui.json @@ -0,0 +1,40 @@ +{ + "name": "Streamlink WebUI", + "slug": "streamlink-webui", + "categories": [ + 11 + ], + "date_created": "2025-05-05", + "type": "ct", + "updateable": true, + "privileged": false, + "interface_port": 8000, + "documentation": "https://github.com/CrazyWolf13/streamlink-webui", + "config_path": "/opt/streamlink-webui/.env", + "website": "https://github.com/CrazyWolf13/streamlink-webui", + "logo": null, + "description": "a simple web-ui to the well-known streamlink cli application ", + "install_methods": [ + { + "type": "default", + "script": "ct/streamlink-webui.sh", + "resources": { + "cpu": 2, + "ram": 2048, + "hdd": 5, + "os": "Debian", + "version": "12" + } + } + ], + "default_credentials": { + "username": "null", + "password": "null" + }, + "notes": [ + { + "text": "This app requires a Twitch Cliend_ID and Client_Secret, set it in the Config file. Look in the Documentation on how to obtain it.", + "type": "info" + } + ] +} diff --git a/install/streamlink-webui-install.sh b/install/streamlink-webui-install.sh new file mode 100644 index 0000000..6e89398 --- /dev/null +++ b/install/streamlink-webui-install.sh @@ -0,0 +1,74 @@ +#!/usr/bin/env bash + +# Copyright (c) 2021-2025 community-scripts ORG +# Author: CrazyWolf13 +# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE +# Source: https://github.com/CrazyWolf13/streamlink-webui + +# Import Functions und Setup +source /dev/stdin <<<"$FUNCTIONS_FILE_PATH" +color +verb_ip6 +catch_errors +setting_up_container +network_check +update_os + +msg_info "Setup Python3" +$STD apt-get install -y \ + python3 \ + python3-pip +rm -rf /usr/lib/python3.*/EXTERNALLY-MANAGED +msg_ok "Setup Python3" + +msg_info "Setup NodeJS" +export NODE_MODULE="npm@latest" +install_node_and_modules +msg_ok "Setup NodeJS" + +# Setup App +msg_info "Setup ${APPLICATION}" +fetch_and_deploy_gh_release "CrazyWolf13/streamlink-webui" +cd /opt/"${APPLICATION}"/backend/src +pip install -r requirements.txt +cd ../../frontend/src +npm install +yarn build +msg_ok "Setup ${APPLICATION}" + +# Creating Service (if needed) +msg_info "Creating Service" +cat <<'EOF' >/opt/"${APPLICATION}".env +CLIENT_ID='your_client_id' +CLIENT_SECRET='your_client_secret' +DOWNLOAD_PATH=/opt/streamlink-webui-download' +# BASE_URL='https://sub.domain.com' \ +# REVERSE_PROXY=True \ +EOF + +cat </etc/systemd/system/"${APPLICATION}".service +[Unit] +Description=${APPLICATION} Service +After=network.target + +[Service] +EnvironmentFile=/opt/${APPLICATION}.env +WorkingDirectory=/opt/${APPLICATION}/backend/src +ExecStart=fastapi run main.py +Restart=always + +[Install] +WantedBy=multi-user.target +EOF +systemctl enable -q --now "${APPLICATION}" +msg_ok "Created Service" + +motd_ssh +customize + +# Cleanup +msg_info "Cleaning up" +rm -f "${RELEASE}".zip +$STD apt-get -y autoremove +$STD apt-get -y autoclean +msg_ok "Cleaned"