Refactor: web-check (#9055)

This commit is contained in:
Tobias
2025-11-12 10:52:07 +01:00
committed by GitHub
parent 35b6e58d2c
commit fa3621ef56
3 changed files with 40 additions and 20 deletions

View File

@@ -27,7 +27,35 @@ function update_script() {
msg_error "No ${APP} Installation Found!" msg_error "No ${APP} Installation Found!"
exit exit
fi fi
msg_error "Currently we don't provide an update function for this App."
if check_for_gh_release "web-check" "CrazyWolf13/web-check"; then
msg_info "Stopping Service"
systemctl stop web-check
msg_ok "Stopped Service"
msg_info "Creating backup"
mv /opt/web-check/.env /opt
msg_ok "Created backup"
NODE_VERSION="22" NODE_MODULE="yarn" setup_nodejs
CLEAN_INSTALL=1 fetch_and_deploy_gh_release "web-check" "CrazyWolf13/web-check"
msg_info "Restoring backup"
mv /opt/.env /opt/web-check
msg_ok "Restored backup"
msg_info "Building Web-Check"
cd /opt/web-check
$STD yarn install --frozen-lockfile --network-timeout 100000
$STD yarn build --production
$STD npm cache clean --force
msg_ok "Built Web-Check"
msg_info "Starting Service"
systemctl start web-check
msg_ok "Started Service"
msg_ok "Updated Successfully!"
fi
exit exit
} }

View File

@@ -6,7 +6,7 @@
], ],
"date_created": "2025-02-27", "date_created": "2025-02-27",
"type": "ct", "type": "ct",
"updateable": false, "updateable": true,
"privileged": false, "privileged": false,
"interface_port": 3000, "interface_port": 3000,
"documentation": "https://github.com/Lissy93/web-check/blob/master/.github/README.md", "documentation": "https://github.com/Lissy93/web-check/blob/master/.github/README.md",
@@ -31,5 +31,10 @@
"username": null, "username": null,
"password": null "password": null
}, },
"notes": [] "notes": [
{
"text": "This script uses a fork located here: `https://github.com/CrazyWolf13/web-check/` as the original Repository does not provide tagged Github Releases, an issues is open for this: `https://github.com/Lissy93/web-check/issues/248`",
"type": "info"
}
]
} }

View File

@@ -64,13 +64,10 @@ msg_info "Setting up Chromium"
chmod 755 /usr/bin/chromium chmod 755 /usr/bin/chromium
msg_ok "Setup Chromium" msg_ok "Setup Chromium"
fetch_and_deploy_gh_release "web-check" "CrazyWolf13/web-check"
msg_info "Installing Web-Check (Patience)" msg_info "Installing Web-Check (Patience)"
temp_file=$(mktemp) cd /opt/web-check
RELEASE="patch-1"
curl -fsSL "https://github.com/CrazyWolf13/web-check/archive/refs/heads/${RELEASE}.tar.gz" -o "$temp_file"
tar xzf "$temp_file"
mv web-check-${RELEASE} /opt/web-check
cd /opt/web-check || exit
cat <<'EOF' >/opt/web-check/.env cat <<'EOF' >/opt/web-check/.env
CHROME_PATH=/usr/bin/chromium CHROME_PATH=/usr/bin/chromium
PUPPETEER_EXECUTABLE_PATH=/usr/bin/chromium PUPPETEER_EXECUTABLE_PATH=/usr/bin/chromium
@@ -94,7 +91,6 @@ REACT_APP_API_ENDPOINT='/api'
ENABLE_ANALYTICS='false' ENABLE_ANALYTICS='false'
EOF EOF
$STD yarn install --frozen-lockfile --network-timeout 100000 $STD yarn install --frozen-lockfile --network-timeout 100000
echo "${RELEASE}" >/opt/"${APPLICATION}"_version.txt
msg_ok "Installed Web-Check" msg_ok "Installed Web-Check"
msg_info "Building Web-Check" msg_info "Building Web-Check"
@@ -141,13 +137,4 @@ msg_ok "Created Service"
motd_ssh motd_ssh
customize customize
cleanup_lxc
msg_info "Cleaning up"
rm -rf "$temp_file"
rm -rf /var/lib/apt/lists/* /app/node_modules/.cache
$STD apt -y autoremove
$STD apt -y autoclean
msg_ok "Cleaned"
motd_ssh
customize