diff --git a/ct/streamlink-webui.sh b/ct/streamlink-webui.sh new file mode 100644 index 000000000..240454a04 --- /dev/null +++ b/ct/streamlink-webui.sh @@ -0,0 +1,73 @@ +#!/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="streamlink-webui" +var_tags="${var_tags:-download,streaming}" +var_cpu="${var_cpu:-2}" +var_ram="${var_ram:-2048}" +var_disk="${var_disk:-10}" +var_os="${var_os:-debian}" +var_version="${var_version:-12}" +var_unprivileged="${var_unprivileged:-1}" + +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" + + rm -rf /opt/${APP} + NODE_VERSION="22" + NODE_MODULE="npm@latest,yarn@latest" + install_node_and_modules + setup_uv + fetch_and_deploy_gh_release "CrazyWolf13/streamlink-webui" + + msg_info "Updating $APP to v${RELEASE}" + $STD uv venv /opt/"${APPLICATION}"/backend/src/.venv + source /opt/"${APPLICATION}"/backend/src/.venv/bin/activate + $STD uv pip install -r /opt/streamlink-webui/backend/src/requirements.txt --python=/opt/"${APPLICATION}"/backend/src/.venv + cd /opt/"${APPLICATION}"/frontend/src + $STD yarn install + $STD yarn build + chmod +x /opt/"${APPLICATION}"/start.sh + 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}:8000${CL}" diff --git a/frontend/public/json/streamlink-webui.json b/frontend/public/json/streamlink-webui.json new file mode 100644 index 000000000..3fcdfa43a --- /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, which allows you to save twitch streams to your local disk.", + "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 application 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 000000000..2ab9fe6a2 --- /dev/null +++ b/install/streamlink-webui-install.sh @@ -0,0 +1,66 @@ +#!/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 + +NODE_VERSION="22" +NODE_MODULE="npm@latest,yarn@latest" +install_node_and_modules +setup_uv +fetch_and_deploy_gh_release "CrazyWolf13/streamlink-webui" + +msg_info "Setup ${APPLICATION}" +mkdir -p "/opt/${APPLICATION}-download" +$STD uv venv /opt/"${APPLICATION}"/backend/src/.venv +source /opt/"${APPLICATION}"/backend/src/.venv/bin/activate +$STD uv pip install -r /opt/streamlink-webui/backend/src/requirements.txt --python=/opt/"${APPLICATION}"/backend/src/.venv +cd /opt/"${APPLICATION}"/frontend/src +$STD yarn install +$STD yarn build +chmod +x /opt/"${APPLICATION}"/start.sh +msg_ok "Setup ${APPLICATION}" + +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=/bin/bash -c 'source /opt/${APPLICATION}/backend/src/.venv/bin/activate && exec /opt/${APPLICATION}/start.sh' +Restart=always + +[Install] +WantedBy=multi-user.target +EOF +systemctl enable -q --now "${APPLICATION}" +msg_ok "Created Service" + +motd_ssh +customize + +msg_info "Cleaning up" +$STD apt-get -y autoremove +$STD apt-get -y autoclean +msg_ok "Cleaned"