Add version option in ./wgd.sh

This commit is contained in:
Donald Zou 2025-01-21 15:59:28 +08:00
parent a62c54b4ed
commit e45360e8ed
2 changed files with 15 additions and 2 deletions

View File

@ -512,10 +512,12 @@ class WireguardConfiguration:
self.__parser.write(configFile)
self.__initPeersList()
print(f"[WGDashboard] Initialized Configuration: {name}")
if __name__ == "__main__":
print(f"[WGDashboard] Initialized Configuration: {name}")
if self.getAutostartStatus() and not self.getStatus() and startup:
self.toggleConfiguration()
print(f"[WGDashboard] Autostart Configuration: {name}")
if __name__ == "__main__":
print(f"[WGDashboard] Autostart Configuration: {name}")
def __initPeersList(self):

View File

@ -443,6 +443,15 @@ update_wgd() {
fi
}
get_version() {
if [ ! -f "$venv_python" ];
then
printf "[WGDashboard] WGDashboard is not install yet. Please install it with [./wgd.sh install]\n"
else
sudo "$venv_python" -c "from dashboard import DASHBOARD_VERSION; print(DASHBOARD_VERSION)"
fi
}
if [ "$#" -lt 1 ]; then
help
else
@ -491,6 +500,8 @@ else
else
start_wgd_debug
fi
elif [ "$1" = "version" ]; then
get_version
else
help
fi