Skip to content

Commit f042e42

Browse files
committed
Adjust version to v4.0.2
1 parent 39b80a2 commit f042e42

File tree

2 files changed

+40
-27
lines changed

2 files changed

+40
-27
lines changed

src/dashboard.py

+4-5
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333

3434
from flask.json.provider import DefaultJSONProvider
3535

36-
DASHBOARD_VERSION = 'v4.0.1.1'
36+
DASHBOARD_VERSION = 'v4.0.2'
3737
CONFIGURATION_PATH = os.getenv('CONFIGURATION_PATH', '.')
3838
DB_PATH = os.path.join(CONFIGURATION_PATH, 'db')
3939
if not os.path.isdir(DB_PATH):
@@ -2031,8 +2031,7 @@ def API_traceroute_execute():
20312031

20322032
@app.route(f'{APP_PREFIX}/api/getDashboardUpdate')
20332033
def API_getDashboardUpdate():
2034-
import urllib.request as req;
2035-
2034+
import urllib.request as req
20362035
try:
20372036
r = req.urlopen("https://api.github.com/repos/donaldzou/WGDashboard/releases/latest", timeout=5).read()
20382037
data = dict(json.loads(r))
@@ -2045,8 +2044,8 @@ def API_getDashboardUpdate():
20452044
return ResponseObject(message="You're on the latest version")
20462045
return ResponseObject(False)
20472046

2048-
except urllib.error.HTTPError as e:
2049-
return ResponseObject(False, f"Request to GitHub API failed. Returned a {e.code} status.")
2047+
except urllib.error.HTTPError and urllib.error.URLError as e:
2048+
return ResponseObject(False, f"Request to GitHub API failed.")
20502049

20512050
'''
20522051
Sign Up

src/wgd.sh

+36-22
Original file line numberDiff line numberDiff line change
@@ -337,28 +337,42 @@ start_wgd_debug() {
337337
}
338338

339339
update_wgd() {
340-
new_ver=$($venv_python -c "import json; import urllib.request; data = urllib.request.urlopen('https://api.github.com/repos/donaldzou/WGDashboard/releases/latest').read(); output = json.loads(data);print(output['tag_name'])")
341-
printf "%s\n" "$dashes"
342-
printf "[WGDashboard] Are you sure you want to update to the %s? (Y/N): " "$new_ver"
343-
read up
344-
if [ "$up" = "Y" ] || [ "$up" = "y" ]; then
345-
printf "[WGDashboard] Shutting down WGDashboard\n"
346-
if check_wgd_status; then
347-
stop_wgd
348-
fi
349-
mv wgd.sh wgd.sh.old
350-
printf "[WGDashboard] Downloading %s from GitHub..." "$new_ver"
351-
{ date; git stash; git pull https://github.com/donaldzou/WGDashboard.git $new_ver --force; } >> ./log/update.txt
352-
chmod +x ./wgd.sh
353-
sudo ./wgd.sh install
354-
printf "[WGDashboard] Update completed!\n"
355-
printf "%s\n" "$dashes"
356-
rm wgd.sh.old
357-
else
358-
printf "%s\n" "$dashes"
359-
printf "| Update Canceled. |\n"
360-
printf "%s\n" "$dashes"
361-
fi
340+
341+
_determineOS
342+
if ! python3 --version > /dev/null 2>&1
343+
then
344+
printf "[WGDashboard] Python is not installed, trying to install now\n"
345+
_installPython
346+
else
347+
printf "[WGDashboard] %s Python is installed\n" "$heavy_checkmark"
348+
fi
349+
350+
_checkPythonVersion
351+
_installPythonVenv
352+
_installPythonPip
353+
354+
new_ver=$($venv_python -c "import json; import urllib.request; data = urllib.request.urlopen('https://api.github.com/repos/donaldzou/WGDashboard/releases/latest').read(); output = json.loads(data);print(output['tag_name'])")
355+
printf "%s\n" "$dashes"
356+
printf "[WGDashboard] Are you sure you want to update to the %s? (Y/N): " "$new_ver"
357+
read up
358+
if [ "$up" = "Y" ] || [ "$up" = "y" ]; then
359+
printf "[WGDashboard] Shutting down WGDashboard\n"
360+
if check_wgd_status; then
361+
stop_wgd
362+
fi
363+
mv wgd.sh wgd.sh.old
364+
printf "[WGDashboard] Downloading %s from GitHub..." "$new_ver"
365+
{ date; git stash; git pull https://github.com/donaldzou/WGDashboard.git $new_ver --force; } >> ./log/update.txt
366+
chmod +x ./wgd.sh
367+
sudo ./wgd.sh install
368+
printf "[WGDashboard] Update completed!\n"
369+
printf "%s\n" "$dashes"
370+
rm wgd.sh.old
371+
else
372+
printf "%s\n" "$dashes"
373+
printf "[WGDashboard] Update Canceled.\n"
374+
printf "%s\n" "$dashes"
375+
fi
362376
}
363377

364378
if [ "$#" != 1 ];

0 commit comments

Comments
 (0)