mirror of
https://github.com/community-scripts/ProxmoxVE.git
synced 2026-05-21 16:15:02 +00:00
fix: qbittorrent-exporter for 5.2 (#14403)
* fix: qbittorrent-exporter for 5.2 * Adjust API key input prompt indentation * fix: tabs
This commit is contained in:
@@ -68,6 +68,24 @@ function uninstall() {
|
|||||||
# ==============================================================================
|
# ==============================================================================
|
||||||
function update() {
|
function update() {
|
||||||
if check_for_gh_release "qbittorrent-exporter" "martabal/qbittorrent-exporter"; then
|
if check_for_gh_release "qbittorrent-exporter" "martabal/qbittorrent-exporter"; then
|
||||||
|
if [[ "$(printf '%s\n' "2.0.0" "$CHECK_UPDATE_RELEASE" | sort -V | tail -n1)" == "$CHECK_UPDATE_RELEASE" ]] && \
|
||||||
|
! grep -q "QBITTORRENT_API_KEY" "$CONFIG_PATH" 2>/dev/null; then
|
||||||
|
echo ""
|
||||||
|
msg_warn "Version 2.0.0 introduces a breaking change: username/password login has been replaced by an API key."
|
||||||
|
echo -e "${TAB3}${INFO} You must create an API key in qBittorrent under Tools > Options > Web UI > API key"
|
||||||
|
echo ""
|
||||||
|
echo -n "${TAB3}Enter your qBittorrent API key (or press Enter to abort): "
|
||||||
|
read -r QBITTORRENT_API_KEY
|
||||||
|
if [[ -z "$QBITTORRENT_API_KEY" ]]; then
|
||||||
|
msg_warn "No API key provided. Update aborted."
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
sed -i '/^QBITTORRENT_USERNAME=/d' "$CONFIG_PATH"
|
||||||
|
sed -i '/^QBITTORRENT_PASSWORD=/d' "$CONFIG_PATH"
|
||||||
|
echo "QBITTORRENT_API_KEY=\"${QBITTORRENT_API_KEY}\"" >>"$CONFIG_PATH"
|
||||||
|
msg_ok "API key saved to configuration"
|
||||||
|
fi
|
||||||
|
|
||||||
msg_info "Stopping service"
|
msg_info "Stopping service"
|
||||||
if [[ "$OS" == "Alpine" ]]; then
|
if [[ "$OS" == "Alpine" ]]; then
|
||||||
rc-service qbittorrent-exporter stop &>/dev/null
|
rc-service qbittorrent-exporter stop &>/dev/null
|
||||||
@@ -100,10 +118,9 @@ function update() {
|
|||||||
# INSTALL
|
# INSTALL
|
||||||
# ==============================================================================
|
# ==============================================================================
|
||||||
function install() {
|
function install() {
|
||||||
read -erp "Enter URL of qBittorrent, example: (http://127.0.0.1:8080): " QBITTORRENT_BASE_URL
|
read -erp "${TAB3}Enter URL of qBittorrent, example: (http://127.0.0.1:8080): " QBITTORRENT_BASE_URL
|
||||||
read -erp "Enter qBittorrent username: " QBITTORRENT_USERNAME
|
echo -e "${TAB3}${INFO} Create an API key in qBittorrent under Tools > Options > Web UI > API key"
|
||||||
read -rsp "Enter qBittorrent password: " QBITTORRENT_PASSWORD
|
read -erp "${TAB3}Enter qBittorrent API key: " QBITTORRENT_API_KEY
|
||||||
printf "\n"
|
|
||||||
|
|
||||||
fetch_and_deploy_gh_release "qbittorrent-exporter" "martabal/qbittorrent-exporter" "tarball" "latest"
|
fetch_and_deploy_gh_release "qbittorrent-exporter" "martabal/qbittorrent-exporter" "tarball" "latest"
|
||||||
setup_go
|
setup_go
|
||||||
@@ -116,8 +133,7 @@ function install() {
|
|||||||
cat <<EOF >"$CONFIG_PATH"
|
cat <<EOF >"$CONFIG_PATH"
|
||||||
# https://github.com/martabal/qbittorrent-exporter?tab=readme-ov-file#parameters
|
# https://github.com/martabal/qbittorrent-exporter?tab=readme-ov-file#parameters
|
||||||
QBITTORRENT_BASE_URL="${QBITTORRENT_BASE_URL}"
|
QBITTORRENT_BASE_URL="${QBITTORRENT_BASE_URL}"
|
||||||
QBITTORRENT_USERNAME="${QBITTORRENT_USERNAME}"
|
QBITTORRENT_API_KEY="${QBITTORRENT_API_KEY}"
|
||||||
QBITTORRENT_PASSWORD="${QBITTORRENT_PASSWORD}"
|
|
||||||
EOF
|
EOF
|
||||||
msg_ok "Created configuration"
|
msg_ok "Created configuration"
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user