diff --git a/README.md b/README.md index bbd8669d..daab0842 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ > 🎉 I'm excited to announce that WGDashboard is officially listed on DigitalOcean's Marketplace! For more information, please visit [Host WGDashboard & WireGuard with DigitalOcean](https://docs.wgdashboard.dev/host-wgdashboard-wireguard-with-digitalocean.html) for more information! > [!NOTE] -> **Help Wanted 🎉**: Localizing WGDashboard to other languages! If you're willing to help, please visit https://github.com/donaldzou/WGDashboard/issues/397. Many thanks! +> **Help Wanted 🎉**: Localizing WGDashboard to other languages! If you're willing to help, please visit https://github.com/WGDashboard/WGDashboard/issues/397. Many thanks! diff --git a/docker/README.md b/docker/README.md index 80d22978..be2a065b 100644 --- a/docker/README.md +++ b/docker/README.md @@ -122,7 +122,7 @@ Examples: To build from source: ```bash -git clone https://github.com/donaldzou/WGDashboard.git +git clone https://github.com/WGDashboard/WGDashboard.git cd WGDashboard docker build . -f docker/Dockerfile -t yourname/wgdashboard:latest ``` diff --git a/src/dashboard.py b/src/dashboard.py index 05bd3c4c..d4dcc4b3 100644 --- a/src/dashboard.py +++ b/src/dashboard.py @@ -433,29 +433,30 @@ def API_getAllWireguardConfigurationBackup(): for protocol in ProtocolsEnabled(): directory = os.path.join(DashboardConfig.GetConfig("Server", f"{protocol}_conf_path")[1], 'WGDashboard_Backup') - files = [(file, os.path.getctime(os.path.join(directory, file))) - for file in os.listdir(directory) if os.path.isfile(os.path.join(directory, file))] - files.sort(key=lambda x: x[1], reverse=True) - - for f, ct in files: - if RegexMatch(r"^(.*)_(.*)\.(conf)$", f): - s = re.search(r"^(.*)_(.*)\.(conf)$", f) - name = s.group(1) - if name not in existingConfiguration: - if name not in data['NonExistingConfigurations'].keys(): - data['NonExistingConfigurations'][name] = [] - - date = s.group(2) - d = { - "protocol": protocol, - "filename": f, - "backupDate": date, - "content": open(os.path.join(DashboardConfig.GetConfig("Server", f"{protocol}_conf_path")[1], 'WGDashboard_Backup', f), 'r').read() - } - if f.replace(".conf", ".sql") in list(os.listdir(directory)): - d['database'] = True - d['databaseContent'] = open(os.path.join(DashboardConfig.GetConfig("Server", f"{protocol}_conf_path")[1], 'WGDashboard_Backup', f.replace(".conf", ".sql")), 'r').read() - data['NonExistingConfigurations'][name].append(d) + if os.path.exists(directory): + files = [(file, os.path.getctime(os.path.join(directory, file))) + for file in os.listdir(directory) if os.path.isfile(os.path.join(directory, file))] + files.sort(key=lambda x: x[1], reverse=True) + + for f, ct in files: + if RegexMatch(r"^(.*)_(.*)\.(conf)$", f): + s = re.search(r"^(.*)_(.*)\.(conf)$", f) + name = s.group(1) + if name not in existingConfiguration: + if name not in data['NonExistingConfigurations'].keys(): + data['NonExistingConfigurations'][name] = [] + + date = s.group(2) + d = { + "protocol": protocol, + "filename": f, + "backupDate": date, + "content": open(os.path.join(DashboardConfig.GetConfig("Server", f"{protocol}_conf_path")[1], 'WGDashboard_Backup', f), 'r').read() + } + if f.replace(".conf", ".sql") in list(os.listdir(directory)): + d['database'] = True + d['databaseContent'] = open(os.path.join(DashboardConfig.GetConfig("Server", f"{protocol}_conf_path")[1], 'WGDashboard_Backup', f.replace(".conf", ".sql")), 'r').read() + data['NonExistingConfigurations'][name].append(d) return ResponseObject(data=data) @app.get(f'{APP_PREFIX}/api/createWireguardConfigurationBackup') @@ -1192,7 +1193,7 @@ def API_traceroute_execute(): def API_getDashboardUpdate(): import urllib.request as req try: - r = req.urlopen("https://api.github.com/repos/donaldzou/WGDashboard/releases/latest", timeout=5).read() + r = req.urlopen("https://api.github.com/repos/WGDashboard/WGDashboard/releases/latest", timeout=5).read() data = dict(json.loads(r)) tagName = data.get('tag_name') htmlUrl = data.get('html_url') diff --git a/src/modules/WireguardConfiguration.py b/src/modules/WireguardConfiguration.py index 34f78b72..bf9f2fee 100644 --- a/src/modules/WireguardConfiguration.py +++ b/src/modules/WireguardConfiguration.py @@ -903,7 +903,7 @@ class WireguardConfiguration: "backupDate": datetime.now().strftime("%Y%m%d%H%M%S") } - def getBackups(self, databaseContent: bool = False) -> list[dict[str: str, str: str, str: str]]: + def getBackups(self, databaseContent: bool = False) -> list[dict[str, str]]: backups = [] directory = os.path.join(self.__getProtocolPath(), 'WGDashboard_Backup') diff --git a/src/wgd.sh b/src/wgd.sh index 7ce169bc..0cf0d1c0 100755 --- a/src/wgd.sh +++ b/src/wgd.sh @@ -29,7 +29,7 @@ fi dashes='---------------------------------------------------------------------------------' equals='============================================================' -helpMsg="[WGDashboard] Please check ./log/install.txt for more details. For further assistance, please open a ticket on https://github.com/donaldzou/WGDashboard/issues/new/choose, I'm more than happy to help :)" +helpMsg="[WGDashboard] Please check ./log/install.txt for more details. For further assistance, please open a ticket on https://github.com/WGDashboard/WGDashboard/issues/new/choose, I'm more than happy to help :)" print_header(){ printf "=================================================================================\n" printf "+ by Donald Zou - https://github.com/donaldzou +\n" @@ -525,7 +525,7 @@ update_wgd() { _installPythonVenv _installPythonPip - 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'])") + new_ver=$($venv_python -c "import json; import urllib.request; data = urllib.request.urlopen('https://api.github.com/repos/WGDashboard/WGDashboard/releases/latest').read(); output = json.loads(data);print(output['tag_name'])") if [ "$commandConfirmed" = "true" ]; then printf "[WGDashboard] Confirmation granted.\n" @@ -544,7 +544,7 @@ update_wgd() { 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 + { date; git stash; git pull https://github.com/WGDashboard/WGDashboard.git $new_ver --force; } >> ./log/update.txt chmod +x ./wgd.sh sudo ./wgd.sh install printf "[WGDashboard] Update completed!\n"