mirror of
https://github.com/donaldzou/WGDashboard.git
synced 2024-11-06 07:50:13 +01:00
Adjust version to v4.0.2
This commit is contained in:
parent
39b80a2e7e
commit
f042e42633
@ -33,7 +33,7 @@ import threading
|
|||||||
|
|
||||||
from flask.json.provider import DefaultJSONProvider
|
from flask.json.provider import DefaultJSONProvider
|
||||||
|
|
||||||
DASHBOARD_VERSION = 'v4.0.1.1'
|
DASHBOARD_VERSION = 'v4.0.2'
|
||||||
CONFIGURATION_PATH = os.getenv('CONFIGURATION_PATH', '.')
|
CONFIGURATION_PATH = os.getenv('CONFIGURATION_PATH', '.')
|
||||||
DB_PATH = os.path.join(CONFIGURATION_PATH, 'db')
|
DB_PATH = os.path.join(CONFIGURATION_PATH, 'db')
|
||||||
if not os.path.isdir(DB_PATH):
|
if not os.path.isdir(DB_PATH):
|
||||||
@ -2031,8 +2031,7 @@ def API_traceroute_execute():
|
|||||||
|
|
||||||
@app.route(f'{APP_PREFIX}/api/getDashboardUpdate')
|
@app.route(f'{APP_PREFIX}/api/getDashboardUpdate')
|
||||||
def API_getDashboardUpdate():
|
def API_getDashboardUpdate():
|
||||||
import urllib.request as req;
|
import urllib.request as req
|
||||||
|
|
||||||
try:
|
try:
|
||||||
r = req.urlopen("https://api.github.com/repos/donaldzou/WGDashboard/releases/latest", timeout=5).read()
|
r = req.urlopen("https://api.github.com/repos/donaldzou/WGDashboard/releases/latest", timeout=5).read()
|
||||||
data = dict(json.loads(r))
|
data = dict(json.loads(r))
|
||||||
@ -2045,8 +2044,8 @@ def API_getDashboardUpdate():
|
|||||||
return ResponseObject(message="You're on the latest version")
|
return ResponseObject(message="You're on the latest version")
|
||||||
return ResponseObject(False)
|
return ResponseObject(False)
|
||||||
|
|
||||||
except urllib.error.HTTPError as e:
|
except urllib.error.HTTPError and urllib.error.URLError as e:
|
||||||
return ResponseObject(False, f"Request to GitHub API failed. Returned a {e.code} status.")
|
return ResponseObject(False, f"Request to GitHub API failed.")
|
||||||
|
|
||||||
'''
|
'''
|
||||||
Sign Up
|
Sign Up
|
||||||
|
58
src/wgd.sh
58
src/wgd.sh
@ -337,28 +337,42 @@ start_wgd_debug() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
update_wgd() {
|
update_wgd() {
|
||||||
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'])")
|
|
||||||
printf "%s\n" "$dashes"
|
_determineOS
|
||||||
printf "[WGDashboard] Are you sure you want to update to the %s? (Y/N): " "$new_ver"
|
if ! python3 --version > /dev/null 2>&1
|
||||||
read up
|
then
|
||||||
if [ "$up" = "Y" ] || [ "$up" = "y" ]; then
|
printf "[WGDashboard] Python is not installed, trying to install now\n"
|
||||||
printf "[WGDashboard] Shutting down WGDashboard\n"
|
_installPython
|
||||||
if check_wgd_status; then
|
else
|
||||||
stop_wgd
|
printf "[WGDashboard] %s Python is installed\n" "$heavy_checkmark"
|
||||||
fi
|
fi
|
||||||
mv wgd.sh wgd.sh.old
|
|
||||||
printf "[WGDashboard] Downloading %s from GitHub..." "$new_ver"
|
_checkPythonVersion
|
||||||
{ date; git stash; git pull https://github.com/donaldzou/WGDashboard.git $new_ver --force; } >> ./log/update.txt
|
_installPythonVenv
|
||||||
chmod +x ./wgd.sh
|
_installPythonPip
|
||||||
sudo ./wgd.sh install
|
|
||||||
printf "[WGDashboard] Update completed!\n"
|
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'])")
|
||||||
printf "%s\n" "$dashes"
|
printf "%s\n" "$dashes"
|
||||||
rm wgd.sh.old
|
printf "[WGDashboard] Are you sure you want to update to the %s? (Y/N): " "$new_ver"
|
||||||
else
|
read up
|
||||||
printf "%s\n" "$dashes"
|
if [ "$up" = "Y" ] || [ "$up" = "y" ]; then
|
||||||
printf "| Update Canceled. |\n"
|
printf "[WGDashboard] Shutting down WGDashboard\n"
|
||||||
printf "%s\n" "$dashes"
|
if check_wgd_status; then
|
||||||
fi
|
stop_wgd
|
||||||
|
fi
|
||||||
|
mv wgd.sh wgd.sh.old
|
||||||
|
printf "[WGDashboard] Downloading %s from GitHub..." "$new_ver"
|
||||||
|
{ date; git stash; git pull https://github.com/donaldzou/WGDashboard.git $new_ver --force; } >> ./log/update.txt
|
||||||
|
chmod +x ./wgd.sh
|
||||||
|
sudo ./wgd.sh install
|
||||||
|
printf "[WGDashboard] Update completed!\n"
|
||||||
|
printf "%s\n" "$dashes"
|
||||||
|
rm wgd.sh.old
|
||||||
|
else
|
||||||
|
printf "%s\n" "$dashes"
|
||||||
|
printf "[WGDashboard] Update Canceled.\n"
|
||||||
|
printf "%s\n" "$dashes"
|
||||||
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
if [ "$#" != 1 ];
|
if [ "$#" != 1 ];
|
||||||
|
Loading…
Reference in New Issue
Block a user