Skip to content

Commit fa3621e

Browse files
authored
Refactor: web-check (#9055)
1 parent 35b6e58 commit fa3621e

File tree

3 files changed

+40
-20
lines changed

3 files changed

+40
-20
lines changed

ct/web-check.sh

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,35 @@ function update_script() {
2727
msg_error "No ${APP} Installation Found!"
2828
exit
2929
fi
30-
msg_error "Currently we don't provide an update function for this App."
30+
31+
if check_for_gh_release "web-check" "CrazyWolf13/web-check"; then
32+
msg_info "Stopping Service"
33+
systemctl stop web-check
34+
msg_ok "Stopped Service"
35+
36+
msg_info "Creating backup"
37+
mv /opt/web-check/.env /opt
38+
msg_ok "Created backup"
39+
40+
NODE_VERSION="22" NODE_MODULE="yarn" setup_nodejs
41+
CLEAN_INSTALL=1 fetch_and_deploy_gh_release "web-check" "CrazyWolf13/web-check"
42+
43+
msg_info "Restoring backup"
44+
mv /opt/.env /opt/web-check
45+
msg_ok "Restored backup"
46+
47+
msg_info "Building Web-Check"
48+
cd /opt/web-check
49+
$STD yarn install --frozen-lockfile --network-timeout 100000
50+
$STD yarn build --production
51+
$STD npm cache clean --force
52+
msg_ok "Built Web-Check"
53+
54+
msg_info "Starting Service"
55+
systemctl start web-check
56+
msg_ok "Started Service"
57+
msg_ok "Updated Successfully!"
58+
fi
3159
exit
3260
}
3361

frontend/public/json/web-check.json

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
],
77
"date_created": "2025-02-27",
88
"type": "ct",
9-
"updateable": false,
9+
"updateable": true,
1010
"privileged": false,
1111
"interface_port": 3000,
1212
"documentation": "https://github.com/Lissy93/web-check/blob/master/.github/README.md",
@@ -31,5 +31,10 @@
3131
"username": null,
3232
"password": null
3333
},
34-
"notes": []
34+
"notes": [
35+
{
36+
"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`",
37+
"type": "info"
38+
}
39+
]
3540
}

install/web-check-install.sh

Lines changed: 4 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -64,13 +64,10 @@ msg_info "Setting up Chromium"
6464
chmod 755 /usr/bin/chromium
6565
msg_ok "Setup Chromium"
6666

67+
fetch_and_deploy_gh_release "web-check" "CrazyWolf13/web-check"
68+
6769
msg_info "Installing Web-Check (Patience)"
68-
temp_file=$(mktemp)
69-
RELEASE="patch-1"
70-
curl -fsSL "https://github.com/CrazyWolf13/web-check/archive/refs/heads/${RELEASE}.tar.gz" -o "$temp_file"
71-
tar xzf "$temp_file"
72-
mv web-check-${RELEASE} /opt/web-check
73-
cd /opt/web-check || exit
70+
cd /opt/web-check
7471
cat <<'EOF' >/opt/web-check/.env
7572
CHROME_PATH=/usr/bin/chromium
7673
PUPPETEER_EXECUTABLE_PATH=/usr/bin/chromium
@@ -94,7 +91,6 @@ REACT_APP_API_ENDPOINT='/api'
9491
ENABLE_ANALYTICS='false'
9592
EOF
9693
$STD yarn install --frozen-lockfile --network-timeout 100000
97-
echo "${RELEASE}" >/opt/"${APPLICATION}"_version.txt
9894
msg_ok "Installed Web-Check"
9995

10096
msg_info "Building Web-Check"
@@ -141,13 +137,4 @@ msg_ok "Created Service"
141137

142138
motd_ssh
143139
customize
144-
145-
msg_info "Cleaning up"
146-
rm -rf "$temp_file"
147-
rm -rf /var/lib/apt/lists/* /app/node_modules/.cache
148-
$STD apt -y autoremove
149-
$STD apt -y autoclean
150-
msg_ok "Cleaned"
151-
152-
motd_ssh
153-
customize
140+
cleanup_lxc

0 commit comments

Comments
 (0)