mirror of
https://github.com/WGDashboard/WGDashboard.git
synced 2026-12-01 17:07:47 +00:00
Compare commits
8
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f4b33de173 | ||
|
|
914a7812e7 | ||
|
|
0a9f37cd2e | ||
|
|
a00799c3c5 | ||
|
|
dec86ad222 | ||
|
|
e547a83776 | ||
|
|
f8bb750d5d | ||
|
|
8d21152947 |
@@ -33,6 +33,7 @@ pnpm-debug.log*
|
|||||||
lerna-debug.log*
|
lerna-debug.log*
|
||||||
|
|
||||||
dist
|
dist
|
||||||
|
/src/static/.dist-staging.*
|
||||||
|
|
||||||
node_modules
|
node_modules
|
||||||
.DS_Store
|
.DS_Store
|
||||||
|
|||||||
+1
-1
@@ -4,5 +4,5 @@
|
|||||||
|
|
||||||
| Version | Supported |
|
| Version | Supported |
|
||||||
| ------- | ------------------ |
|
| ------- | ------------------ |
|
||||||
| 4.3 | :white_check_mark: |
|
| > 4.3 | :white_check_mark: |
|
||||||
| < 4.3 | :x: |
|
| < 4.3 | :x: |
|
||||||
|
|||||||
@@ -121,6 +121,20 @@ Updating the WGDashboard container should be through 'The Docker Way' - by pulli
|
|||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
|
## 🧩 Custom Startup Scripts
|
||||||
|
|
||||||
|
Every file placed in `/data/custom-init.d/` is executed with `bash` at container startup, in alphabetical order, right before WGDashboard starts. A failing script is logged but does not stop the container.
|
||||||
|
|
||||||
|
This is useful for installing additional packages, for example `/data/custom-init.d/apk-add`:
|
||||||
|
```bash
|
||||||
|
apk update > /dev/null 2>&1
|
||||||
|
apk add --no-cache util-linux openssh-client > /dev/null 2>&1
|
||||||
|
```
|
||||||
|
|
||||||
|
> 📁 When using a Docker volume for `/data`, you can also bind-mount the directory directly, e.g. `./custom-init.d:/data/custom-init.d:ro`.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
## 🔐 Port Forwarding Note
|
## 🔐 Port Forwarding Note
|
||||||
|
|
||||||
When using multiple WireGuard interfaces, remember to **open their respective ports** on the host.
|
When using multiple WireGuard interfaces, remember to **open their respective ports** on the host.
|
||||||
@@ -202,6 +216,7 @@ ENTRYPOINT ["/bin/bash", "/entrypoint.sh"]
|
|||||||
|
|
||||||
- **`ensure_installation`**: Sets up the app, database, and Python environment.
|
- **`ensure_installation`**: Sets up the app, database, and Python environment.
|
||||||
- **`set_envvars`**: Writes `wg-dashboard.ini` and applies environment variables.
|
- **`set_envvars`**: Writes `wg-dashboard.ini` and applies environment variables.
|
||||||
|
- **`run_custom_init`**: Runs user scripts from `/data/custom-init.d/`.
|
||||||
- **`start_core`**: Starts the main WGDashboard service.
|
- **`start_core`**: Starts the main WGDashboard service.
|
||||||
- **`ensure_blocking`**: Tails the error log to keep the container process alive.
|
- **`ensure_blocking`**: Tails the error log to keep the container process alive.
|
||||||
|
|
||||||
|
|||||||
@@ -258,6 +258,24 @@ set_envvars() {
|
|||||||
done
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# Run user-provided drop-in scripts, e.g. to install additional packages
|
||||||
|
run_custom_init() {
|
||||||
|
local init_dir="/data/custom-init.d"
|
||||||
|
|
||||||
|
[[ -d "$init_dir" ]] || return 0
|
||||||
|
|
||||||
|
printf "\n------------------ RUNNING CUSTOM SCRIPTS ------------------\n"
|
||||||
|
|
||||||
|
for script in "$init_dir"/*; do
|
||||||
|
[[ -f "$script" ]] || continue
|
||||||
|
|
||||||
|
echo "Running custom script: ${script}"
|
||||||
|
if ! bash "$script"; then
|
||||||
|
echo "Custom script ${script} exited with an error, continuing."
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
}
|
||||||
|
|
||||||
# Start service and monitor logs
|
# Start service and monitor logs
|
||||||
start_and_monitor() {
|
start_and_monitor() {
|
||||||
printf "\n---------------------- STARTING CORE -----------------------\n"
|
printf "\n---------------------- STARTING CORE -----------------------\n"
|
||||||
@@ -331,4 +349,5 @@ start_and_monitor() {
|
|||||||
# Main execution flow
|
# Main execution flow
|
||||||
ensure_installation
|
ensure_installation
|
||||||
set_envvars
|
set_envvars
|
||||||
|
run_custom_init
|
||||||
start_and_monitor
|
start_and_monitor
|
||||||
|
|||||||
+5
-5
@@ -113,10 +113,12 @@ def createClientBlueprint(wireguardConfigurations: dict[WireguardConfiguration],
|
|||||||
return ResponseObject(False, "Please provide a valid Email")
|
return ResponseObject(False, "Please provide a valid Email")
|
||||||
|
|
||||||
token = dashboardClients.GenerateClientPasswordResetToken(u.get('ClientID'))
|
token = dashboardClients.GenerateClientPasswordResetToken(u.get('ClientID'))
|
||||||
|
if not token:
|
||||||
|
return ResponseObject(False, "A reset token was recently sent. Please wait 2 minutes before requesting another.")
|
||||||
|
|
||||||
status, msg = emailSender.send(
|
status, msg = emailSender.send(
|
||||||
email, "[WGDashboard | Client] Reset Password",
|
email, "[WGDashboard | Client] Reset Password",
|
||||||
f"Hi {email}, \n\nIt looks like you're trying to reset your password at {date} \n\nEnter this 6 digits code on the Forgot Password to continue:\n\n{token}\n\nThis code will expire in 30 minutes for your security. If you didn’t request a password reset, you can safely ignore this email—your current password will remain unchanged.\n\nIf you need help, feel free to contact support.\n\nBest regards,\n\nWGDashboard"
|
f"Hi {email}, \n\nIt looks like you're trying to reset your password at {date} \n\nEnter this reset token on the Forgot Password page to continue:\n\n{token}\n\nThis token will expire in 30 minutes for your security. If you didn’t request a password reset, you can safely ignore this email—your current password will remain unchanged.\n\nIf you need help, feel free to contact support.\n\nBest regards,\n\nWGDashboard"
|
||||||
)
|
)
|
||||||
|
|
||||||
return ResponseObject(status, msg)
|
return ResponseObject(status, msg)
|
||||||
@@ -150,11 +152,9 @@ def createClientBlueprint(wireguardConfigurations: dict[WireguardConfiguration],
|
|||||||
return ResponseObject(False, "Please provide a valid Email")
|
return ResponseObject(False, "Please provide a valid Email")
|
||||||
|
|
||||||
if not dashboardClients.ValidateClientPasswordResetToken(u.get('ClientID'), token):
|
if not dashboardClients.ValidateClientPasswordResetToken(u.get('ClientID'), token):
|
||||||
return ResponseObject(False, "Verification code is either invalid or expired")
|
return ResponseObject(False, "Reset token is either invalid or expired")
|
||||||
|
|
||||||
status, msg = dashboardClients.ResetClientPassword(u.get('ClientID'), password, confirmPassword)
|
status, msg = dashboardClients.ResetClientPassword(u.get('ClientID'), password, confirmPassword, token)
|
||||||
|
|
||||||
dashboardClients.RevokeClientPasswordResetToken(u.get('ClientID'), token)
|
|
||||||
|
|
||||||
return ResponseObject(status, msg)
|
return ResponseObject(status, msg)
|
||||||
|
|
||||||
|
|||||||
+5
-8
@@ -9,7 +9,7 @@ from zipfile import ZipFile
|
|||||||
from datetime import datetime, timedelta
|
from datetime import datetime, timedelta
|
||||||
|
|
||||||
import sqlalchemy
|
import sqlalchemy
|
||||||
from flask import Flask, request, render_template, session, send_file, current_app
|
from flask import Flask, request, render_template, session, send_file, current_app, g
|
||||||
from flask_cors import CORS
|
from flask_cors import CORS
|
||||||
from icmplib import ping, traceroute
|
from icmplib import ping, traceroute
|
||||||
from flask.json.provider import DefaultJSONProvider
|
from flask.json.provider import DefaultJSONProvider
|
||||||
@@ -248,7 +248,7 @@ def auth_req():
|
|||||||
if request.method.lower() == 'options':
|
if request.method.lower() == 'options':
|
||||||
return ResponseObject(True)
|
return ResponseObject(True)
|
||||||
|
|
||||||
DashboardConfig.APIAccessed = False
|
g.api_key_authenticated = False
|
||||||
authenticationRequired = DashboardConfig.GetConfig("Server", "auth_req")[1]
|
authenticationRequired = DashboardConfig.GetConfig("Server", "auth_req")[1]
|
||||||
d = request.headers
|
d = request.headers
|
||||||
if authenticationRequired:
|
if authenticationRequired:
|
||||||
@@ -258,7 +258,6 @@ def auth_req():
|
|||||||
apiKeyExist = len(list(filter(lambda x : x.Key == apiKey, DashboardConfig.DashboardAPIKeys))) == 1
|
apiKeyExist = len(list(filter(lambda x : x.Key == apiKey, DashboardConfig.DashboardAPIKeys))) == 1
|
||||||
DashboardLogger.log(str(request.url), str(request.remote_addr), Message=f"API Key Access: {('true' if apiKeyExist else 'false')} - Key: {apiKey}")
|
DashboardLogger.log(str(request.url), str(request.remote_addr), Message=f"API Key Access: {('true' if apiKeyExist else 'false')} - Key: {apiKey}")
|
||||||
if not apiKeyExist:
|
if not apiKeyExist:
|
||||||
DashboardConfig.APIAccessed = False
|
|
||||||
response = Flask.make_response(app, {
|
response = Flask.make_response(app, {
|
||||||
"status": False,
|
"status": False,
|
||||||
"message": "API Key does not exist",
|
"message": "API Key does not exist",
|
||||||
@@ -267,9 +266,8 @@ def auth_req():
|
|||||||
response.content_type = "application/json"
|
response.content_type = "application/json"
|
||||||
response.status_code = 401
|
response.status_code = 401
|
||||||
return response
|
return response
|
||||||
DashboardConfig.APIAccessed = True
|
g.api_key_authenticated = True
|
||||||
else:
|
else:
|
||||||
DashboardConfig.APIAccessed = False
|
|
||||||
appPrefix = APP_PREFIX if len(APP_PREFIX) > 0 else ''
|
appPrefix = APP_PREFIX if len(APP_PREFIX) > 0 else ''
|
||||||
whiteList = [
|
whiteList = [
|
||||||
# f'/static/',
|
# f'/static/',
|
||||||
@@ -358,7 +356,7 @@ def API_AuthenticateLogin():
|
|||||||
if not DashboardConfig.GetConfig("Server", "auth_req")[1]:
|
if not DashboardConfig.GetConfig("Server", "auth_req")[1]:
|
||||||
return ResponseObject(True, DashboardConfig.GetConfig("Other", "welcome_session")[1])
|
return ResponseObject(True, DashboardConfig.GetConfig("Other", "welcome_session")[1])
|
||||||
|
|
||||||
if DashboardConfig.APIAccessed:
|
if getattr(g, 'api_key_authenticated', False):
|
||||||
authToken = hashlib.sha256(f"{request.headers.get('wg-dashboard-apikey')}{datetime.now()}".encode()).hexdigest()
|
authToken = hashlib.sha256(f"{request.headers.get('wg-dashboard-apikey')}{datetime.now()}".encode()).hexdigest()
|
||||||
session['role'] = 'admin'
|
session['role'] = 'admin'
|
||||||
session['username'] = authToken
|
session['username'] = authToken
|
||||||
@@ -1054,8 +1052,7 @@ def API_addPeers(configName):
|
|||||||
if ipStatus:
|
if ipStatus:
|
||||||
for subnet in availableIps.keys():
|
for subnet in availableIps.keys():
|
||||||
for ip in availableIps[subnet]:
|
for ip in availableIps[subnet]:
|
||||||
allowed_ips = [ip]
|
allowed_ips.append(ip)
|
||||||
break
|
|
||||||
break
|
break
|
||||||
else:
|
else:
|
||||||
return ResponseObject(False, "No more available IP can assign")
|
return ResponseObject(False, "No more available IP can assign")
|
||||||
|
|||||||
@@ -37,6 +37,15 @@ class AmneziaConfiguration(WireguardConfiguration):
|
|||||||
self.I3 = ""
|
self.I3 = ""
|
||||||
self.I4 = ""
|
self.I4 = ""
|
||||||
self.I5 = ""
|
self.I5 = ""
|
||||||
|
self.HeaderProtectionKey = ""
|
||||||
|
self.ContentPaddingAddition = 0
|
||||||
|
self.RekeyAfterTime = 0
|
||||||
|
self.RekeyTimeout = 0
|
||||||
|
self.RejectAfterTime = 0
|
||||||
|
self.KeepaliveTimeout = 0
|
||||||
|
self.MaxHandshakeAttempts = 0
|
||||||
|
self.RandomTrailers = 0
|
||||||
|
self.DisableCookies = 0
|
||||||
self.J1 = ""
|
self.J1 = ""
|
||||||
self.J2 = ""
|
self.J2 = ""
|
||||||
self.J3 = ""
|
self.J3 = ""
|
||||||
@@ -84,6 +93,15 @@ class AmneziaConfiguration(WireguardConfiguration):
|
|||||||
"I3": self.I3,
|
"I3": self.I3,
|
||||||
"I4": self.I4,
|
"I4": self.I4,
|
||||||
"I5": self.I5,
|
"I5": self.I5,
|
||||||
|
"HeaderProtectionKey": self.HeaderProtectionKey,
|
||||||
|
"ContentPaddingAddition": self.ContentPaddingAddition,
|
||||||
|
"RekeyAfterTime": self.RekeyAfterTime,
|
||||||
|
"RekeyTimeout": self.RekeyTimeout,
|
||||||
|
"RejectAfterTime": self.RejectAfterTime,
|
||||||
|
"KeepaliveTimeout": self.KeepaliveTimeout,
|
||||||
|
"MaxHandshakeAttempts": self.MaxHandshakeAttempts,
|
||||||
|
"RandomTrailers": self.RandomTrailers,
|
||||||
|
"DisableCookies": self.DisableCookies,
|
||||||
"J1": self.J1,
|
"J1": self.J1,
|
||||||
"J2": self.J2,
|
"J2": self.J2,
|
||||||
"J3": self.J3,
|
"J3": self.J3,
|
||||||
@@ -152,7 +170,8 @@ class AmneziaConfiguration(WireguardConfiguration):
|
|||||||
f'{dbName}_history_endpoint', self.metadata,
|
f'{dbName}_history_endpoint', self.metadata,
|
||||||
sqlalchemy.Column('id', sqlalchemy.String(255), nullable=False),
|
sqlalchemy.Column('id', sqlalchemy.String(255), nullable=False),
|
||||||
sqlalchemy.Column('endpoint', sqlalchemy.String(255), nullable=False),
|
sqlalchemy.Column('endpoint', sqlalchemy.String(255), nullable=False),
|
||||||
sqlalchemy.Column('time', time_col_type)
|
sqlalchemy.Column('time', time_col_type),
|
||||||
|
extend_existing=True
|
||||||
)
|
)
|
||||||
|
|
||||||
self.infoTable = sqlalchemy.Table(
|
self.infoTable = sqlalchemy.Table(
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import datetime
|
import datetime
|
||||||
import hashlib
|
import hashlib
|
||||||
import random
|
import secrets
|
||||||
import uuid
|
import uuid
|
||||||
|
|
||||||
import bcrypt
|
import bcrypt
|
||||||
@@ -305,7 +305,9 @@ class DashboardClients:
|
|||||||
def GetClientAssignedPeers(self, ClientID):
|
def GetClientAssignedPeers(self, ClientID):
|
||||||
return self.DashboardClientsPeerAssignment.GetAssignedPeers(ClientID)
|
return self.DashboardClientsPeerAssignment.GetAssignedPeers(ClientID)
|
||||||
|
|
||||||
def ResetClientPassword(self, ClientID, NewPassword, ConfirmNewPassword) -> tuple[bool, str] | tuple[bool, None]:
|
def ResetClientPassword(
|
||||||
|
self, ClientID, NewPassword, ConfirmNewPassword, ResetToken
|
||||||
|
) -> tuple[bool, str] | tuple[bool, None]:
|
||||||
c = self.GetClient(ClientID)
|
c = self.GetClient(ClientID)
|
||||||
if c is None:
|
if c is None:
|
||||||
return False, "Client does not exist"
|
return False, "Client does not exist"
|
||||||
@@ -316,18 +318,36 @@ class DashboardClients:
|
|||||||
pwStrength, msg = ValidatePasswordStrength(NewPassword)
|
pwStrength, msg = ValidatePasswordStrength(NewPassword)
|
||||||
if not pwStrength:
|
if not pwStrength:
|
||||||
return pwStrength, msg
|
return pwStrength, msg
|
||||||
|
|
||||||
|
if not isinstance(ResetToken, str) or not ResetToken or len(ResetToken) > 128:
|
||||||
|
return False, "Reset token is either invalid or expired"
|
||||||
|
|
||||||
|
tokenDigest = hashlib.sha256(ResetToken.encode("utf-8")).hexdigest()
|
||||||
|
now = datetime.datetime.now()
|
||||||
try:
|
try:
|
||||||
with self.engine.begin() as conn:
|
with self.engine.begin() as conn:
|
||||||
|
tokenClaimed = conn.execute(
|
||||||
|
self.dashboardClientsPasswordResetLinkTable.update().values({
|
||||||
|
"ExpiryDate": now
|
||||||
|
}).where(
|
||||||
|
db.and_(
|
||||||
|
self.dashboardClientsPasswordResetLinkTable.c.ClientID == ClientID,
|
||||||
|
self.dashboardClientsPasswordResetLinkTable.c.ResetToken == tokenDigest,
|
||||||
|
self.dashboardClientsPasswordResetLinkTable.c.ExpiryDate > now
|
||||||
|
)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
if tokenClaimed.rowcount != 1:
|
||||||
|
return False, "Reset token is either invalid or expired"
|
||||||
|
|
||||||
conn.execute(
|
conn.execute(
|
||||||
self.dashboardClientsTable.update().values({
|
self.dashboardClientsTable.update().values({
|
||||||
"TotpKeyVerified": None,
|
|
||||||
"TotpKey": pyotp.random_base32(),
|
|
||||||
"Password": bcrypt.hashpw(NewPassword.encode('utf-8'), bcrypt.gensalt()).decode("utf-8"),
|
"Password": bcrypt.hashpw(NewPassword.encode('utf-8'), bcrypt.gensalt()).decode("utf-8"),
|
||||||
}).where(
|
}).where(
|
||||||
self.dashboardClientsTable.c.ClientID == ClientID
|
self.dashboardClientsTable.c.ClientID == ClientID
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
self.logger.log(Message=f"User {ClientID} reset password and TOTP")
|
self.logger.log(Message=f"User {ClientID} reset password")
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
self.logger.log(Status="false", Message=f"User {ClientID} reset password failed, reason: {str(e)}")
|
self.logger.log(Status="false", Message=f"User {ClientID} reset password failed, reason: {str(e)}")
|
||||||
return False, "Reset password failed."
|
return False, "Reset password failed."
|
||||||
@@ -420,11 +440,24 @@ class DashboardClients:
|
|||||||
if c is None:
|
if c is None:
|
||||||
return False
|
return False
|
||||||
|
|
||||||
newToken = str(random.randint(0, 999999)).zfill(6)
|
newToken = secrets.token_urlsafe(32)
|
||||||
|
tokenDigest = hashlib.sha256(newToken.encode("utf-8")).hexdigest()
|
||||||
|
now = datetime.datetime.now()
|
||||||
with self.engine.begin() as conn:
|
with self.engine.begin() as conn:
|
||||||
|
recentToken = conn.execute(
|
||||||
|
self.dashboardClientsPasswordResetLinkTable.select().where(
|
||||||
|
db.and_(
|
||||||
|
self.dashboardClientsPasswordResetLinkTable.c.ClientID == ClientID,
|
||||||
|
self.dashboardClientsPasswordResetLinkTable.c.CreatedDate > now - datetime.timedelta(minutes=2)
|
||||||
|
)
|
||||||
|
).limit(1)
|
||||||
|
).first()
|
||||||
|
if recentToken:
|
||||||
|
return False
|
||||||
|
|
||||||
conn.execute(
|
conn.execute(
|
||||||
self.dashboardClientsPasswordResetLinkTable.update().values({
|
self.dashboardClientsPasswordResetLinkTable.update().values({
|
||||||
"ExpiryDate": datetime.datetime.now()
|
"ExpiryDate": now
|
||||||
|
|
||||||
}).where(
|
}).where(
|
||||||
db.and_(
|
db.and_(
|
||||||
@@ -435,10 +468,10 @@ class DashboardClients:
|
|||||||
)
|
)
|
||||||
conn.execute(
|
conn.execute(
|
||||||
self.dashboardClientsPasswordResetLinkTable.insert().values({
|
self.dashboardClientsPasswordResetLinkTable.insert().values({
|
||||||
"ResetToken": newToken,
|
"ResetToken": tokenDigest,
|
||||||
"ClientID": ClientID,
|
"ClientID": ClientID,
|
||||||
"CreatedDate": datetime.datetime.now(),
|
"CreatedDate": now,
|
||||||
"ExpiryDate": datetime.datetime.now() + datetime.timedelta(minutes=30)
|
"ExpiryDate": now + datetime.timedelta(minutes=30)
|
||||||
})
|
})
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -446,13 +479,14 @@ class DashboardClients:
|
|||||||
|
|
||||||
def ValidateClientPasswordResetToken(self, ClientID, Token):
|
def ValidateClientPasswordResetToken(self, ClientID, Token):
|
||||||
c = self.GetClient(ClientID)
|
c = self.GetClient(ClientID)
|
||||||
if c is None:
|
if c is None or not isinstance(Token, str) or not Token or len(Token) > 128:
|
||||||
return False
|
return False
|
||||||
|
tokenDigest = hashlib.sha256(Token.encode("utf-8")).hexdigest()
|
||||||
with self.engine.connect() as conn:
|
with self.engine.connect() as conn:
|
||||||
t = conn.execute(
|
t = conn.execute(
|
||||||
self.dashboardClientsPasswordResetLinkTable.select().where(
|
self.dashboardClientsPasswordResetLinkTable.select().where(
|
||||||
db.and_(self.dashboardClientsPasswordResetLinkTable.c.ClientID == ClientID,
|
db.and_(self.dashboardClientsPasswordResetLinkTable.c.ClientID == ClientID,
|
||||||
self.dashboardClientsPasswordResetLinkTable.c.ResetToken == Token,
|
self.dashboardClientsPasswordResetLinkTable.c.ResetToken == tokenDigest,
|
||||||
self.dashboardClientsPasswordResetLinkTable.c.ExpiryDate > datetime.datetime.now())
|
self.dashboardClientsPasswordResetLinkTable.c.ExpiryDate > datetime.datetime.now())
|
||||||
|
|
||||||
)
|
)
|
||||||
@@ -460,13 +494,16 @@ class DashboardClients:
|
|||||||
return t is not None
|
return t is not None
|
||||||
|
|
||||||
def RevokeClientPasswordResetToken(self, ClientID, Token):
|
def RevokeClientPasswordResetToken(self, ClientID, Token):
|
||||||
|
if not isinstance(Token, str) or len(Token) > 128:
|
||||||
|
return False
|
||||||
|
tokenDigest = hashlib.sha256(Token.encode("utf-8")).hexdigest()
|
||||||
with self.engine.begin() as conn:
|
with self.engine.begin() as conn:
|
||||||
conn.execute(
|
conn.execute(
|
||||||
self.dashboardClientsPasswordResetLinkTable.update().values({
|
self.dashboardClientsPasswordResetLinkTable.update().values({
|
||||||
"ExpiryDate": datetime.datetime.now()
|
"ExpiryDate": datetime.datetime.now()
|
||||||
}).where(
|
}).where(
|
||||||
db.and_(self.dashboardClientsPasswordResetLinkTable.c.ClientID == ClientID,
|
db.and_(self.dashboardClientsPasswordResetLinkTable.c.ClientID == ClientID,
|
||||||
self.dashboardClientsPasswordResetLinkTable.c.ResetToken == Token)
|
self.dashboardClientsPasswordResetLinkTable.c.ResetToken == tokenDigest)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
return True
|
return True
|
||||||
|
|||||||
@@ -98,7 +98,6 @@ class DashboardConfig:
|
|||||||
self.dbMetadata = db.MetaData()
|
self.dbMetadata = db.MetaData()
|
||||||
self.__createAPIKeyTable()
|
self.__createAPIKeyTable()
|
||||||
self.DashboardAPIKeys = self.__getAPIKeys()
|
self.DashboardAPIKeys = self.__getAPIKeys()
|
||||||
self.APIAccessed = False
|
|
||||||
self.SetConfig("Server", "version", DashboardConfig.DashboardVersion)
|
self.SetConfig("Server", "version", DashboardConfig.DashboardVersion)
|
||||||
|
|
||||||
def EnsureDatabaseIntegrity(self, wireguardConfigurations):
|
def EnsureDatabaseIntegrity(self, wireguardConfigurations):
|
||||||
@@ -145,7 +144,9 @@ class DashboardConfig:
|
|||||||
|
|
||||||
for col_name, col_type in expected_columns.items():
|
for col_name, col_type in expected_columns.items():
|
||||||
if col_name not in existing_columns:
|
if col_name not in existing_columns:
|
||||||
type_str = col_type().compile(dialect=self.engine.dialect)
|
type_str = (
|
||||||
|
col_type if isinstance(col_type, db.types.TypeEngine) else col_type()
|
||||||
|
).compile(dialect=self.engine.dialect)
|
||||||
current_app.logger.info(f"Adding missing column '{col_name}' to table '{table_name}'")
|
current_app.logger.info(f"Adding missing column '{col_name}' to table '{table_name}'")
|
||||||
preparer = self.engine.dialect.identifier_preparer
|
preparer = self.engine.dialect.identifier_preparer
|
||||||
quoted_table = preparer.quote_identifier(table_name)
|
quoted_table = preparer.quote_identifier(table_name)
|
||||||
|
|||||||
@@ -207,6 +207,15 @@ class Peer:
|
|||||||
"I3": self.configuration.I3,
|
"I3": self.configuration.I3,
|
||||||
"I4": self.configuration.I4,
|
"I4": self.configuration.I4,
|
||||||
"I5": self.configuration.I5,
|
"I5": self.configuration.I5,
|
||||||
|
"HeaderProtectionKey": self.configuration.HeaderProtectionKey,
|
||||||
|
"ContentPaddingAddition": self.configuration.ContentPaddingAddition,
|
||||||
|
"RekeyAfterTime": self.configuration.RekeyAfterTime,
|
||||||
|
"RekeyTimeout": self.configuration.RekeyTimeout,
|
||||||
|
"RejectAfterTime": self.configuration.RejectAfterTime,
|
||||||
|
"KeepaliveTimeout": self.configuration.KeepaliveTimeout,
|
||||||
|
"MaxHandshakeAttempts": self.configuration.MaxHandshakeAttempts,
|
||||||
|
"RandomTrailers": self.configuration.RandomTrailers,
|
||||||
|
"DisableCookies": self.configuration.DisableCookies,
|
||||||
"J1": self.configuration.J1,
|
"J1": self.configuration.J1,
|
||||||
"J2": self.configuration.J2,
|
"J2": self.configuration.J2,
|
||||||
"J3": self.configuration.J3,
|
"J3": self.configuration.J3,
|
||||||
|
|||||||
@@ -126,6 +126,15 @@ class WireguardConfiguration:
|
|||||||
"I3": self.I3,
|
"I3": self.I3,
|
||||||
"I4": self.I4,
|
"I4": self.I4,
|
||||||
"I5": self.I5,
|
"I5": self.I5,
|
||||||
|
"HeaderProtectionKey": self.HeaderProtectionKey,
|
||||||
|
"ContentPaddingAddition": self.ContentPaddingAddition,
|
||||||
|
"RekeyAfterTime": self.RekeyAfterTime,
|
||||||
|
"RekeyTimeout": self.RekeyTimeout,
|
||||||
|
"RejectAfterTime": self.RejectAfterTime,
|
||||||
|
"KeepaliveTimeout": self.KeepaliveTimeout,
|
||||||
|
"MaxHandshakeAttempts": self.MaxHandshakeAttempts,
|
||||||
|
"RandomTrailers": self.RandomTrailers,
|
||||||
|
"DisableCookies": self.DisableCookies,
|
||||||
"J1": self.J1,
|
"J1": self.J1,
|
||||||
"J2": self.J2,
|
"J2": self.J2,
|
||||||
"J3": self.J3,
|
"J3": self.J3,
|
||||||
@@ -240,7 +249,7 @@ class WireguardConfiguration:
|
|||||||
self.Status = self.getStatus()
|
self.Status = self.getStatus()
|
||||||
|
|
||||||
def __dropDatabase(self):
|
def __dropDatabase(self):
|
||||||
existingTables = [self.Name, f'{self.Name}_restrict_access', f'{self.Name}_transfer', f'{self.Name}_deleted']
|
existingTables = [self.Name, f'{self.Name}_restrict_access', f'{self.Name}_transfer', f'{self.Name}_deleted', f'{self.Name}_history_endpoint']
|
||||||
try:
|
try:
|
||||||
with self.engine.begin() as conn:
|
with self.engine.begin() as conn:
|
||||||
for name in existingTables:
|
for name in existingTables:
|
||||||
@@ -1029,7 +1038,7 @@ class WireguardConfiguration:
|
|||||||
allowEdit = ["Address", "PreUp", "PostUp", "PreDown", "PostDown", "ListenPort", "Table"]
|
allowEdit = ["Address", "PreUp", "PostUp", "PreDown", "PostDown", "ListenPort", "Table"]
|
||||||
awgKeys = []
|
awgKeys = []
|
||||||
if self.Protocol == 'awg':
|
if self.Protocol == 'awg':
|
||||||
awgKeys = ["Jc", "Jmin", "Jmax", "S1", "S2", "S3", "S4", "H1", "H2", "H3", "H4", "I1", "I2", "I3", "I4", "I5", "J1", "J2", "J3", "Itime"]
|
awgKeys = ["Jc", "Jmin", "Jmax", "S1", "S2", "S3", "S4", "H1", "H2", "H3", "H4", "I1", "I2", "I3", "I4", "I5", "HeaderProtectionKey", "ContentPaddingAddition", "RekeyAfterTime", "RekeyTimeout", "RejectAfterTime", "KeepaliveTimeout", "MaxHandshakeAttempts", "RandomTrailers", "DisableCookies", "J1", "J2", "J3", "Itime"]
|
||||||
allowEdit += awgKeys
|
allowEdit += awgKeys
|
||||||
start = original.index("[Interface]")
|
start = original.index("[Interface]")
|
||||||
try:
|
try:
|
||||||
@@ -1097,6 +1106,7 @@ class WireguardConfiguration:
|
|||||||
doRenameStatement("_restrict_access")
|
doRenameStatement("_restrict_access")
|
||||||
doRenameStatement("_deleted")
|
doRenameStatement("_deleted")
|
||||||
doRenameStatement("_transfer")
|
doRenameStatement("_transfer")
|
||||||
|
doRenameStatement("_history_endpoint")
|
||||||
conn.execute(
|
conn.execute(
|
||||||
self.infoTable.update()
|
self.infoTable.update()
|
||||||
.where(self.infoTable.c.ID == self.Name)
|
.where(self.infoTable.c.ID == self.Name)
|
||||||
|
|||||||
@@ -14,4 +14,4 @@ psycopg[binary]==3.3.6
|
|||||||
PyMySQL==1.2.3
|
PyMySQL==1.2.3
|
||||||
tzlocal==5.4.5
|
tzlocal==5.4.5
|
||||||
python-jose[cryptography]==3.5.0
|
python-jose[cryptography]==3.5.0
|
||||||
pydantic==2.14.1
|
pydantic==2.14.2
|
||||||
|
|||||||
Generated
+41
-90
@@ -9,7 +9,7 @@
|
|||||||
"version": "4.3.4",
|
"version": "4.3.4",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@volar/language-server": "2.4.30",
|
"@volar/language-server": "2.4.30",
|
||||||
"@vue/language-server": "3.3.13",
|
"@vue/language-server": "3.3.14",
|
||||||
"@vuepic/vue-datepicker": "^14.0.0",
|
"@vuepic/vue-datepicker": "^14.0.0",
|
||||||
"@vueuse/core": "^15.0.0",
|
"@vueuse/core": "^15.0.0",
|
||||||
"@vueuse/shared": "^15.0.0",
|
"@vueuse/shared": "^15.0.0",
|
||||||
@@ -1132,12 +1132,12 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@volar/language-core": {
|
"node_modules/@volar/language-core": {
|
||||||
"version": "2.4.28",
|
"version": "2.4.30",
|
||||||
"resolved": "https://registry.npmjs.org/@volar/language-core/-/language-core-2.4.28.tgz",
|
"resolved": "https://registry.npmjs.org/@volar/language-core/-/language-core-2.4.30.tgz",
|
||||||
"integrity": "sha512-w4qhIJ8ZSitgLAkVay6AbcnC7gP3glYM3fYwKV3srj8m494E3xtrCv6E+bWviiK/8hs6e6t1ij1s2Endql7vzQ==",
|
"integrity": "sha512-73fjwEV8wat6aOZ6U/y/hqtE30ocrIWECg67b0txGczOMNw+MffLmvJ5fnFfN9drVUEYZzLdaNo6VAy6G6avMw==",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@volar/source-map": "2.4.28"
|
"@volar/source-map": "2.4.30"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@volar/language-server": {
|
"node_modules/@volar/language-server": {
|
||||||
@@ -1165,16 +1165,7 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@volar/language-server/node_modules/@volar/language-core": {
|
"node_modules/@volar/language-service": {
|
||||||
"version": "2.4.30",
|
|
||||||
"resolved": "https://registry.npmjs.org/@volar/language-core/-/language-core-2.4.30.tgz",
|
|
||||||
"integrity": "sha512-73fjwEV8wat6aOZ6U/y/hqtE30ocrIWECg67b0txGczOMNw+MffLmvJ5fnFfN9drVUEYZzLdaNo6VAy6G6avMw==",
|
|
||||||
"license": "MIT",
|
|
||||||
"dependencies": {
|
|
||||||
"@volar/source-map": "2.4.30"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/@volar/language-server/node_modules/@volar/language-service": {
|
|
||||||
"version": "2.4.30",
|
"version": "2.4.30",
|
||||||
"resolved": "https://registry.npmjs.org/@volar/language-service/-/language-service-2.4.30.tgz",
|
"resolved": "https://registry.npmjs.org/@volar/language-service/-/language-service-2.4.30.tgz",
|
||||||
"integrity": "sha512-w/xDsASiqC71ggCOm7sTDXDNk/l72XEptodeRC68tgZ0e5QM4hM3zAqBGC7mBctvhrpYwKfMG+t9xcUo2hEFtA==",
|
"integrity": "sha512-w/xDsASiqC71ggCOm7sTDXDNk/l72XEptodeRC68tgZ0e5QM4hM3zAqBGC7mBctvhrpYwKfMG+t9xcUo2hEFtA==",
|
||||||
@@ -1194,13 +1185,13 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@volar/language-server/node_modules/@volar/source-map": {
|
"node_modules/@volar/source-map": {
|
||||||
"version": "2.4.30",
|
"version": "2.4.30",
|
||||||
"resolved": "https://registry.npmjs.org/@volar/source-map/-/source-map-2.4.30.tgz",
|
"resolved": "https://registry.npmjs.org/@volar/source-map/-/source-map-2.4.30.tgz",
|
||||||
"integrity": "sha512-zym1ob/KwDDyN+0jGVtxwbxJSRRnUvv5HspCtz3yEfVVdCG4/dzxJktMGPAgemqRuVs81O0o/y0q3qOUErR8kg==",
|
"integrity": "sha512-zym1ob/KwDDyN+0jGVtxwbxJSRRnUvv5HspCtz3yEfVVdCG4/dzxJktMGPAgemqRuVs81O0o/y0q3qOUErR8kg==",
|
||||||
"license": "MIT"
|
"license": "MIT"
|
||||||
},
|
},
|
||||||
"node_modules/@volar/language-server/node_modules/@volar/typescript": {
|
"node_modules/@volar/typescript": {
|
||||||
"version": "2.4.30",
|
"version": "2.4.30",
|
||||||
"resolved": "https://registry.npmjs.org/@volar/typescript/-/typescript-2.4.30.tgz",
|
"resolved": "https://registry.npmjs.org/@volar/typescript/-/typescript-2.4.30.tgz",
|
||||||
"integrity": "sha512-/DgA5tgYFPfrLFuSjIMXMGHk1LQv2+P8eny6+BhGNzFJELWIW7UZlc56ZLIRFhLsPpMfIFxM8/HvOPBggrjTZg==",
|
"integrity": "sha512-/DgA5tgYFPfrLFuSjIMXMGHk1LQv2+P8eny6+BhGNzFJELWIW7UZlc56ZLIRFhLsPpMfIFxM8/HvOPBggrjTZg==",
|
||||||
@@ -1220,35 +1211,6 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@volar/language-service": {
|
|
||||||
"version": "2.4.28",
|
|
||||||
"resolved": "https://registry.npmjs.org/@volar/language-service/-/language-service-2.4.28.tgz",
|
|
||||||
"integrity": "sha512-Rh/wYCZJrI5vCwMk9xyw/Z+MsWxlJY1rmMZPsxUoJKfzIRjS/NF1NmnuEcrMbEVGja00aVpCsInJfixQTMdvLw==",
|
|
||||||
"license": "MIT",
|
|
||||||
"dependencies": {
|
|
||||||
"@volar/language-core": "2.4.28",
|
|
||||||
"vscode-languageserver-protocol": "^3.17.5",
|
|
||||||
"vscode-languageserver-textdocument": "^1.0.11",
|
|
||||||
"vscode-uri": "^3.0.8"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/@volar/source-map": {
|
|
||||||
"version": "2.4.28",
|
|
||||||
"resolved": "https://registry.npmjs.org/@volar/source-map/-/source-map-2.4.28.tgz",
|
|
||||||
"integrity": "sha512-yX2BDBqJkRXfKw8my8VarTyjv48QwxdJtvRgUpNE5erCsgEUdI2DsLbpa+rOQVAJYshY99szEcRDmyHbF10ggQ==",
|
|
||||||
"license": "MIT"
|
|
||||||
},
|
|
||||||
"node_modules/@volar/typescript": {
|
|
||||||
"version": "2.4.28",
|
|
||||||
"resolved": "https://registry.npmjs.org/@volar/typescript/-/typescript-2.4.28.tgz",
|
|
||||||
"integrity": "sha512-Ja6yvWrbis2QtN4ClAKreeUZPVYMARDYZl9LMEv1iQ1QdepB6wn0jTRxA9MftYmYa4DQ4k/DaSZpFPUfxl8giw==",
|
|
||||||
"license": "MIT",
|
|
||||||
"dependencies": {
|
|
||||||
"@volar/language-core": "2.4.28",
|
|
||||||
"path-browserify": "^1.0.1",
|
|
||||||
"vscode-uri": "^3.0.8"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/@vscode/emmet-helper": {
|
"node_modules/@vscode/emmet-helper": {
|
||||||
"version": "2.11.0",
|
"version": "2.11.0",
|
||||||
"resolved": "https://registry.npmjs.org/@vscode/emmet-helper/-/emmet-helper-2.11.0.tgz",
|
"resolved": "https://registry.npmjs.org/@vscode/emmet-helper/-/emmet-helper-2.11.0.tgz",
|
||||||
@@ -1373,12 +1335,12 @@
|
|||||||
"license": "MIT"
|
"license": "MIT"
|
||||||
},
|
},
|
||||||
"node_modules/@vue/language-core": {
|
"node_modules/@vue/language-core": {
|
||||||
"version": "3.3.13",
|
"version": "3.3.14",
|
||||||
"resolved": "https://registry.npmjs.org/@vue/language-core/-/language-core-3.3.13.tgz",
|
"resolved": "https://registry.npmjs.org/@vue/language-core/-/language-core-3.3.14.tgz",
|
||||||
"integrity": "sha512-axA0Xemn5LuUKuKWob0/kVq7xQ2mJJM6VqA9Exvt35nM9yRC31goWVve/G/Zb2ZCLsXC8FHYjjfXlnshknSCew==",
|
"integrity": "sha512-kRB+3hHg0c+BdD1XLAvwjVMQd5pC05zijSlPDRI3ERvC/s04JlRs5upy2KjeMg/9m9oD5zuMVh9yVvkKfZqoJg==",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@volar/language-core": "2.4.28",
|
"@volar/language-core": "2.4.30",
|
||||||
"@vue/compiler-dom": "^3.5.0",
|
"@vue/compiler-dom": "^3.5.0",
|
||||||
"@vue/shared": "^3.5.0",
|
"@vue/shared": "^3.5.0",
|
||||||
"alien-signals": "^3.2.1",
|
"alien-signals": "^3.2.1",
|
||||||
@@ -1400,16 +1362,22 @@
|
|||||||
"vscode-languageserver-textdocument": "^1.0.12"
|
"vscode-languageserver-textdocument": "^1.0.12"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
"node_modules/@vue/language-plugin-pug/node_modules/@volar/source-map": {
|
||||||
|
"version": "2.4.28",
|
||||||
|
"resolved": "https://registry.npmjs.org/@volar/source-map/-/source-map-2.4.28.tgz",
|
||||||
|
"integrity": "sha512-yX2BDBqJkRXfKw8my8VarTyjv48QwxdJtvRgUpNE5erCsgEUdI2DsLbpa+rOQVAJYshY99szEcRDmyHbF10ggQ==",
|
||||||
|
"license": "MIT"
|
||||||
|
},
|
||||||
"node_modules/@vue/language-server": {
|
"node_modules/@vue/language-server": {
|
||||||
"version": "3.3.13",
|
"version": "3.3.14",
|
||||||
"resolved": "https://registry.npmjs.org/@vue/language-server/-/language-server-3.3.13.tgz",
|
"resolved": "https://registry.npmjs.org/@vue/language-server/-/language-server-3.3.14.tgz",
|
||||||
"integrity": "sha512-6r7lkSxoG9KvppQIHifQ7b7SopFCLhnnRlyGjZxkf+pxiOhUhSQZ8Qzv9OXE9tu2BdIQ5Iaw+p/3Ho+QGHbppQ==",
|
"integrity": "sha512-sB/Ie3mP8J+ua7ECipTPtiov7bOtpMtJVj3rEcrxpkns1MxQN5k6pL08oTOQHFS5Ol+U7cEzO6mOu2llASdRNA==",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@volar/language-server": "2.4.28",
|
"@volar/language-server": "2.4.30",
|
||||||
"@vue/language-core": "3.3.13",
|
"@vue/language-core": "3.3.14",
|
||||||
"@vue/language-service": "3.3.13",
|
"@vue/language-service": "3.3.14",
|
||||||
"@vue/typescript-plugin": "3.3.13",
|
"@vue/typescript-plugin": "3.3.14",
|
||||||
"vscode-uri": "^3.1.0"
|
"vscode-uri": "^3.1.0"
|
||||||
},
|
},
|
||||||
"bin": {
|
"bin": {
|
||||||
@@ -1419,31 +1387,14 @@
|
|||||||
"typescript": "*"
|
"typescript": "*"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@vue/language-server/node_modules/@volar/language-server": {
|
|
||||||
"version": "2.4.28",
|
|
||||||
"resolved": "https://registry.npmjs.org/@volar/language-server/-/language-server-2.4.28.tgz",
|
|
||||||
"integrity": "sha512-NqcLnE5gERKuS4PUFwlhMxf6vqYo7hXtbMFbViXcbVkbZ905AIVWhnSo0ZNBC2V127H1/2zP7RvVOVnyITFfBw==",
|
|
||||||
"license": "MIT",
|
|
||||||
"dependencies": {
|
|
||||||
"@volar/language-core": "2.4.28",
|
|
||||||
"@volar/language-service": "2.4.28",
|
|
||||||
"@volar/typescript": "2.4.28",
|
|
||||||
"path-browserify": "^1.0.1",
|
|
||||||
"request-light": "^0.7.0",
|
|
||||||
"vscode-languageserver": "^9.0.1",
|
|
||||||
"vscode-languageserver-protocol": "^3.17.5",
|
|
||||||
"vscode-languageserver-textdocument": "^1.0.11",
|
|
||||||
"vscode-uri": "^3.0.8"
|
|
||||||
}
|
|
||||||
},
|
|
||||||
"node_modules/@vue/language-service": {
|
"node_modules/@vue/language-service": {
|
||||||
"version": "3.3.13",
|
"version": "3.3.14",
|
||||||
"resolved": "https://registry.npmjs.org/@vue/language-service/-/language-service-3.3.13.tgz",
|
"resolved": "https://registry.npmjs.org/@vue/language-service/-/language-service-3.3.14.tgz",
|
||||||
"integrity": "sha512-HmRQz3bEZ0k8wfrydgPCNlnLxW4dHqATb01oQ4pr+tftHE6HxacknrAlzReIbPSZ4Y5d4r/s0AfpUnHtYoDZjA==",
|
"integrity": "sha512-KJKIcuDJcLWpRTbm2N3Lc+Ri+/9mp7OnWwEBWJit7at8ultnYV09pvTTzh8rpDniEAoTIBt+Blli/b4n07HqDA==",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@volar/language-service": "2.4.28",
|
"@volar/language-service": "2.4.30",
|
||||||
"@vue/language-core": "3.3.13",
|
"@vue/language-core": "3.3.14",
|
||||||
"@vue/shared": "^3.5.0",
|
"@vue/shared": "^3.5.0",
|
||||||
"path-browserify": "^1.0.1",
|
"path-browserify": "^1.0.1",
|
||||||
"volar-service-css": "0.0.71",
|
"volar-service-css": "0.0.71",
|
||||||
@@ -1506,16 +1457,16 @@
|
|||||||
"license": "MIT"
|
"license": "MIT"
|
||||||
},
|
},
|
||||||
"node_modules/@vue/typescript-plugin": {
|
"node_modules/@vue/typescript-plugin": {
|
||||||
"version": "3.3.13",
|
"version": "3.3.14",
|
||||||
"resolved": "https://registry.npmjs.org/@vue/typescript-plugin/-/typescript-plugin-3.3.13.tgz",
|
"resolved": "https://registry.npmjs.org/@vue/typescript-plugin/-/typescript-plugin-3.3.14.tgz",
|
||||||
"integrity": "sha512-L/ht0WIIB5GOPYx0ooWoVQztsI/v1h7lW2/ND0YBuoBYHTteGPfRFzM5j0/uD1nf/rYezqWHhNDDmww2Co53KA==",
|
"integrity": "sha512-+PUukA0VmMDWqNcuGEhoW6aoc1vgMHGkOMVVdYjgDV1jdJJPqqMIPHy23GHM1Lb+VHZqiGIrchvhqg6kDjQpqw==",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@volar/typescript": "2.4.28",
|
"@volar/typescript": "2.4.30",
|
||||||
"@vue/language-core": "3.3.13",
|
"@vue/language-core": "3.3.14",
|
||||||
"@vue/shared": "^3.5.0",
|
"@vue/shared": "^3.5.0",
|
||||||
"path-browserify": "^1.0.1",
|
"path-browserify": "^1.0.1",
|
||||||
"vue-component-meta": "3.3.13"
|
"vue-component-meta": "3.3.14"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/@vuepic/vue-datepicker": {
|
"node_modules/@vuepic/vue-datepicker": {
|
||||||
@@ -7882,13 +7833,13 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"node_modules/vue-component-meta": {
|
"node_modules/vue-component-meta": {
|
||||||
"version": "3.3.13",
|
"version": "3.3.14",
|
||||||
"resolved": "https://registry.npmjs.org/vue-component-meta/-/vue-component-meta-3.3.13.tgz",
|
"resolved": "https://registry.npmjs.org/vue-component-meta/-/vue-component-meta-3.3.14.tgz",
|
||||||
"integrity": "sha512-VnqcGTxB4n56qWfsuroOL+cEvjkV8uEffGy57bqlzePAQKQMLBXAjIKIntyngunmMnxWHMLzkYgRxdx9I1H/hg==",
|
"integrity": "sha512-OQT0AVGbFjmo/aIsyrNN8M3zR3D7U3SNyQPzVlotl89dxIdhhy95wYALiiFrHkBWyvTLRxMRQ3cqkbOMHEh8DQ==",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@volar/typescript": "2.4.28",
|
"@volar/typescript": "2.4.30",
|
||||||
"@vue/language-core": "3.3.13",
|
"@vue/language-core": "3.3.14",
|
||||||
"path-browserify": "^1.0.1"
|
"path-browserify": "^1.0.1"
|
||||||
},
|
},
|
||||||
"peerDependencies": {
|
"peerDependencies": {
|
||||||
|
|||||||
@@ -13,7 +13,7 @@
|
|||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@volar/language-server": "2.4.30",
|
"@volar/language-server": "2.4.30",
|
||||||
"@vue/language-server": "3.3.13",
|
"@vue/language-server": "3.3.14",
|
||||||
"@vuepic/vue-datepicker": "^14.0.0",
|
"@vuepic/vue-datepicker": "^14.0.0",
|
||||||
"@vueuse/core": "^15.0.0",
|
"@vueuse/core": "^15.0.0",
|
||||||
"@vueuse/shared": "^15.0.0",
|
"@vueuse/shared": "^15.0.0",
|
||||||
|
|||||||
@@ -197,7 +197,7 @@ const deleteConfigurationModal = ref(false)
|
|||||||
v-model="data[key]"
|
v-model="data[key]"
|
||||||
:id="'configuration_' + key">
|
:id="'configuration_' + key">
|
||||||
</div>
|
</div>
|
||||||
<div v-for="key in ['Jc', 'Jmin', 'Jmax', 'S1', 'S2', 'S3', 'S4', 'H1', 'H2', 'H3', 'H4', 'I1', 'I2', 'I3', 'I4', 'I5']"
|
<div v-for="key in ['Jc', 'Jmin', 'Jmax', 'S1', 'S2', 'S3', 'S4', 'H1', 'H2', 'H3', 'H4', 'I1', 'I2', 'I3', 'I4', 'I5', 'HeaderProtectionKey', 'ContentPaddingAddition', 'RekeyAfterTime', 'RekeyTimeout', 'RejectAfterTime', 'KeepaliveTimeout', 'MaxHandshakeAttempts', 'RandomTrailers', 'DisableCookies']"
|
||||||
v-if="configurationInfo.Protocol === 'awg'">
|
v-if="configurationInfo.Protocol === 'awg'">
|
||||||
<label :for="'configuration_' + key" class="form-label">
|
<label :for="'configuration_' + key" class="form-label">
|
||||||
<small class="text-muted">
|
<small class="text-muted">
|
||||||
|
|||||||
@@ -101,6 +101,14 @@ export default {
|
|||||||
<samp>{{Peer.allowed_ip}}</samp>
|
<samp>{{Peer.allowed_ip}}</samp>
|
||||||
</small>
|
</small>
|
||||||
</div>
|
</div>
|
||||||
|
<div :class="{'d-flex gap-2 align-items-center' : dashboardStore.Configuration.Server.dashboard_peer_list_display === 'list'}">
|
||||||
|
<small class="text-muted">
|
||||||
|
<LocaleText t="Endpoint"></LocaleText>
|
||||||
|
</small>
|
||||||
|
<small class="d-block">
|
||||||
|
<samp>{{Peer.endpoint && Peer.endpoint !== 'N/A' ? Peer.endpoint : '(none)'}}</samp>
|
||||||
|
</small>
|
||||||
|
</div>
|
||||||
<div class="d-flex align-items-center gap-1"
|
<div class="d-flex align-items-center gap-1"
|
||||||
:class="{'ms-auto': dashboardStore.Configuration.Server.dashboard_peer_list_display === 'list'}"
|
:class="{'ms-auto': dashboardStore.Configuration.Server.dashboard_peer_list_display === 'list'}"
|
||||||
>
|
>
|
||||||
|
|||||||
@@ -88,6 +88,16 @@ defineEmits(['close'])
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div style="word-break: break-all" class="col-12 col-lg-6">
|
||||||
|
<div class="card rounded-3 bg-transparent h-100">
|
||||||
|
<div class="card-body py-2 d-flex flex-column justify-content-center">
|
||||||
|
<p class="mb-0 text-muted"><small>
|
||||||
|
<LocaleText t="Endpoint"></LocaleText>
|
||||||
|
</small></p>
|
||||||
|
<samp>{{selectedPeer.endpoint && selectedPeer.endpoint !== 'N/A' ? selectedPeer.endpoint : '(none)'}}</samp>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
<div style="word-break: break-all" class="col-12 col-lg-6">
|
<div style="word-break: break-all" class="col-12 col-lg-6">
|
||||||
<div class="card rounded-3 bg-transparent h-100">
|
<div class="card rounded-3 bg-transparent h-100">
|
||||||
<div class="card-body py-2 d-flex flex-column justify-content-center">
|
<div class="card-body py-2 d-flex flex-column justify-content-center">
|
||||||
|
|||||||
@@ -191,6 +191,12 @@ const searchPeers = computed(() => {
|
|||||||
wireguardConfigurationStore.Filter.ShowAllPeersWhenHiddenTags || (!wireguardConfigurationStore.Filter.ShowAllPeersWhenHiddenTags && taggedPeers.value.includes(x.id))
|
wireguardConfigurationStore.Filter.ShowAllPeersWhenHiddenTags || (!wireguardConfigurationStore.Filter.ShowAllPeersWhenHiddenTags && taggedPeers.value.includes(x.id))
|
||||||
));
|
));
|
||||||
|
|
||||||
|
if (dashboardStore.Configuration.Server.dashboard_sort === "traffic"){
|
||||||
|
return result.sort((a, b) => {
|
||||||
|
return (b.total_data + b.cumu_data) - (a.total_data + a.cumu_data)
|
||||||
|
}).slice(0, showPeersCount.value);
|
||||||
|
}
|
||||||
|
|
||||||
if (dashboardStore.Configuration.Server.dashboard_sort === "restricted"){
|
if (dashboardStore.Configuration.Server.dashboard_sort === "restricted"){
|
||||||
return result.sort((a, b) => {
|
return result.sort((a, b) => {
|
||||||
if ( a[dashboardStore.Configuration.Server.dashboard_sort]
|
if ( a[dashboardStore.Configuration.Server.dashboard_sort]
|
||||||
|
|||||||
@@ -24,6 +24,7 @@ export default {
|
|||||||
status: GetLocale("Status"),
|
status: GetLocale("Status"),
|
||||||
name: GetLocale("Name"),
|
name: GetLocale("Name"),
|
||||||
allowed_ip: GetLocale("Allowed IPs"),
|
allowed_ip: GetLocale("Allowed IPs"),
|
||||||
|
traffic: GetLocale("Total Usage"),
|
||||||
restricted: GetLocale("Restricted")
|
restricted: GetLocale("Restricted")
|
||||||
},
|
},
|
||||||
interval: {
|
interval: {
|
||||||
|
|||||||
@@ -130,6 +130,7 @@ export default {
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<button
|
<button
|
||||||
|
type="button"
|
||||||
:disabled="!this.passwordValid"
|
:disabled="!this.passwordValid"
|
||||||
class="ms-auto btn bg-success-subtle text-success-emphasis border-1 border-success-subtle rounded-3 shadow-sm" @click="this.useValidation()">
|
class="ms-auto btn bg-success-subtle text-success-emphasis border-1 border-success-subtle rounded-3 shadow-sm" @click="this.useValidation()">
|
||||||
<i class="bi bi-save2-fill me-2"></i>
|
<i class="bi bi-save2-fill me-2"></i>
|
||||||
|
|||||||
@@ -49,11 +49,20 @@ export default {
|
|||||||
H2: 0,
|
H2: 0,
|
||||||
H3: 0,
|
H3: 0,
|
||||||
H4: 0,
|
H4: 0,
|
||||||
I1: "0",
|
I1: "",
|
||||||
I2: "0",
|
I2: "",
|
||||||
I3: "0",
|
I3: "",
|
||||||
I4: "0",
|
I4: "",
|
||||||
I5: "0"
|
I5: "",
|
||||||
|
HeaderProtectionKey: "",
|
||||||
|
ContentPaddingAddition: "0-64",
|
||||||
|
RekeyAfterTime: "100-140",
|
||||||
|
RekeyTimeout: "4-7",
|
||||||
|
RejectAfterTime: "160-200",
|
||||||
|
KeepaliveTimeout: "8-12",
|
||||||
|
MaxHandshakeAttempts: "14-20",
|
||||||
|
RandomTrailers: "on",
|
||||||
|
DisableCookies: "on"
|
||||||
},
|
},
|
||||||
numberOfAvailableIPs: "0",
|
numberOfAvailableIPs: "0",
|
||||||
error: false,
|
error: false,
|
||||||
@@ -72,9 +81,15 @@ export default {
|
|||||||
this.newConfiguration[key] = this.rand(1, 2**31);
|
this.newConfiguration[key] = this.rand(1, 2**31);
|
||||||
});
|
});
|
||||||
|
|
||||||
// Initialize I1 to I5 as "0"
|
// Initialize HeaderProtectionKey
|
||||||
['I1', 'I2', 'I3', 'I4', 'I5'].forEach(key => {
|
let headerProtectionKey = new Uint8Array(32);
|
||||||
this.newConfiguration[key] = "0";
|
window.crypto.getRandomValues(headerProtectionKey);
|
||||||
|
this.newConfiguration.HeaderProtectionKey = btoa(String.fromCharCode(...headerProtectionKey));
|
||||||
|
|
||||||
|
// S1-S4 are recommended be the same to work with RandomTrailers and must 12 or more to work with HeaderProtectionKey
|
||||||
|
let constantS = 12 + this.rand(1, 2**5);
|
||||||
|
['S1', 'S2', 'S3', 'S4'].forEach(key => {
|
||||||
|
this.newConfiguration[key] = constantS;
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
@@ -388,7 +403,7 @@ export default {
|
|||||||
|
|
||||||
<div class="card rounded-3"
|
<div class="card rounded-3"
|
||||||
v-if="this.newConfiguration.Protocol === 'awg'"
|
v-if="this.newConfiguration.Protocol === 'awg'"
|
||||||
v-for="key in ['Jc', 'Jmin', 'Jmax', 'S1', 'S2', 'S3', 'S4', 'H1', 'H2', 'H3', 'H4', 'I1', 'I2', 'I3', 'I4', 'I5']">
|
v-for="key in ['Jc', 'Jmin', 'Jmax', 'S1', 'S2', 'S3', 'S4', 'H1', 'H2', 'H3', 'H4', 'I1', 'I2', 'I3', 'I4', 'I5', 'HeaderProtectionKey', 'ContentPaddingAddition', 'RekeyAfterTime', 'RekeyTimeout', 'RejectAfterTime', 'KeepaliveTimeout', 'MaxHandshakeAttempts', 'RandomTrailers', 'DisableCookies']">
|
||||||
<div class="card-header">{{ key }}</div>
|
<div class="card-header">{{ key }}</div>
|
||||||
<div class="card-body">
|
<div class="card-body">
|
||||||
<input type="text"
|
<input type="text"
|
||||||
|
|||||||
Generated
+4
-4
@@ -8,7 +8,7 @@
|
|||||||
"name": "client",
|
"name": "client",
|
||||||
"version": "v1.0.1",
|
"version": "v1.0.1",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"axios": "^1.20.0",
|
"axios": "^1.21.0",
|
||||||
"bootstrap": "^5.3.8",
|
"bootstrap": "^5.3.8",
|
||||||
"bootstrap-icons": "^1.13.2",
|
"bootstrap-icons": "^1.13.2",
|
||||||
"dayjs": "^1.11.23",
|
"dayjs": "^1.11.23",
|
||||||
@@ -1230,9 +1230,9 @@
|
|||||||
"license": "MIT"
|
"license": "MIT"
|
||||||
},
|
},
|
||||||
"node_modules/axios": {
|
"node_modules/axios": {
|
||||||
"version": "1.20.0",
|
"version": "1.21.0",
|
||||||
"resolved": "https://registry.npmjs.org/axios/-/axios-1.20.0.tgz",
|
"resolved": "https://registry.npmjs.org/axios/-/axios-1.21.0.tgz",
|
||||||
"integrity": "sha512-r8aOh8j9cGKpgQAqpzrUHnSIc6a59Y3Xf/cv8sy1DrHCkZHzQGEuoq1tARk6qSyDdtQGSDgpb9kFlruzPvrgwg==",
|
"integrity": "sha512-YCzXMB53Q9PZBsh7yN7wtapit4WepwcHS2fP8QhGsBxSz5YtgYobV7GGlWlAJi+RxfU77GQTQi2DSLUma42EYA==",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"follow-redirects": "^1.16.0",
|
"follow-redirects": "^1.16.0",
|
||||||
|
|||||||
@@ -9,7 +9,7 @@
|
|||||||
"preview": "vite preview"
|
"preview": "vite preview"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"axios": "^1.20.0",
|
"axios": "^1.21.0",
|
||||||
"bootstrap": "^5.3.8",
|
"bootstrap": "^5.3.8",
|
||||||
"bootstrap-icons": "^1.13.2",
|
"bootstrap-icons": "^1.13.2",
|
||||||
"dayjs": "^1.11.23",
|
"dayjs": "^1.11.23",
|
||||||
|
|||||||
@@ -29,12 +29,8 @@ const requestToken = async (e) => {
|
|||||||
}
|
}
|
||||||
|
|
||||||
const code = ref("")
|
const code = ref("")
|
||||||
const parseCode = () => {
|
|
||||||
code.value = code.value.replace(/\D/i, "")
|
|
||||||
code.value = code.value.slice(0, 6)
|
|
||||||
}
|
|
||||||
const codeReady = computed(() => {
|
const codeReady = computed(() => {
|
||||||
return /^[0-9]{6}$/.test(code.value)
|
return code.value.trim().length > 0
|
||||||
})
|
})
|
||||||
const codeValidated = ref(false)
|
const codeValidated = ref(false)
|
||||||
const validateCode = async (e) => {
|
const validateCode = async (e) => {
|
||||||
@@ -42,13 +38,13 @@ const validateCode = async (e) => {
|
|||||||
loading.value = true
|
loading.value = true
|
||||||
let codeValidation = await axiosPost("/api/resetPassword/validateResetToken", {
|
let codeValidation = await axiosPost("/api/resetPassword/validateResetToken", {
|
||||||
Email: email.value,
|
Email: email.value,
|
||||||
Token: code.value
|
Token: code.value.trim()
|
||||||
})
|
})
|
||||||
loading.value = false
|
loading.value = false
|
||||||
if (codeValidation.status){
|
if (codeValidation.status){
|
||||||
codeValidated.value = true
|
codeValidated.value = true
|
||||||
}else{
|
}else{
|
||||||
store.newNotification("Your verification code is either invalid or expired", "danger")
|
store.newNotification("Your reset token is either invalid or expired", "danger")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -63,7 +59,7 @@ const resetPassword = async (e) => {
|
|||||||
loading.value = true;
|
loading.value = true;
|
||||||
let reset = await axiosPost("/api/resetPassword", {
|
let reset = await axiosPost("/api/resetPassword", {
|
||||||
Email: email.value,
|
Email: email.value,
|
||||||
Token: code.value,
|
Token: code.value.trim(),
|
||||||
Password: password.value,
|
Password: password.value,
|
||||||
ConfirmPassword: confirmPassword.value
|
ConfirmPassword: confirmPassword.value
|
||||||
})
|
})
|
||||||
@@ -71,6 +67,8 @@ const resetPassword = async (e) => {
|
|||||||
store.newNotification("Password reset! Now you can sign in with your new password", "success")
|
store.newNotification("Password reset! Now you can sign in with your new password", "success")
|
||||||
|
|
||||||
await router.push('/signin')
|
await router.push('/signin')
|
||||||
|
}else{
|
||||||
|
store.newNotification(reset.message || "Password reset failed", "danger")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
@@ -98,7 +96,7 @@ const resetPassword = async (e) => {
|
|||||||
autocomplete="email"
|
autocomplete="email"
|
||||||
autofocus
|
autofocus
|
||||||
class="form-control rounded-3 border-0" id="email" placeholder="email">
|
class="form-control rounded-3 border-0" id="email" placeholder="email">
|
||||||
<label for="email" class="d-flex">
|
<label for="token" class="d-flex">
|
||||||
<i class="bi bi-person-circle me-2"></i>
|
<i class="bi bi-person-circle me-2"></i>
|
||||||
Email
|
Email
|
||||||
</label>
|
</label>
|
||||||
@@ -122,7 +120,7 @@ const resetPassword = async (e) => {
|
|||||||
</a>
|
</a>
|
||||||
<div class="text-center">
|
<div class="text-center">
|
||||||
<h1 class="display-4">Almost there</h1>
|
<h1 class="display-4">Almost there</h1>
|
||||||
<p class="text-muted">Enter the code you received below to retrieve a reset your password</p>
|
<p class="text-muted">Enter the reset token you received below to reset your password</p>
|
||||||
<p class="text-muted" v-if="resendCountdown > 0">Didn't get the code? Maybe check your Spam/Junk mailbox. You can get another code in {{ resendCountdown }} seconds.</p>
|
<p class="text-muted" v-if="resendCountdown > 0">Didn't get the code? Maybe check your Spam/Junk mailbox. You can get another code in {{ resendCountdown }} seconds.</p>
|
||||||
<a role="button"
|
<a role="button"
|
||||||
:class="{disabled: loading}"
|
:class="{disabled: loading}"
|
||||||
@@ -131,17 +129,17 @@ const resetPassword = async (e) => {
|
|||||||
<form class="mt-4 d-flex flex-column gap-3" @submit="e => validateCode(e)">
|
<form class="mt-4 d-flex flex-column gap-3" @submit="e => validateCode(e)">
|
||||||
<div class="form-floating">
|
<div class="form-floating">
|
||||||
<input type="text"
|
<input type="text"
|
||||||
inputmode="numeric"
|
|
||||||
required
|
required
|
||||||
:disabled="loading"
|
:disabled="loading"
|
||||||
v-model="code"
|
v-model="code"
|
||||||
@keyup="parseCode()"
|
autocomplete="off"
|
||||||
autocomplete="one-time-code"
|
autocapitalize="off"
|
||||||
|
spellcheck="false"
|
||||||
autofocus
|
autofocus
|
||||||
class="form-control rounded-3 border-0" id="token" placeholder="token">
|
class="form-control rounded-3 border-0" id="token" placeholder="token">
|
||||||
<label for="email" class="d-flex">
|
<label for="token" class="d-flex">
|
||||||
<i class="bi bi-person-circle me-2"></i>
|
<i class="bi bi-person-circle me-2"></i>
|
||||||
6 Digits Verification Code
|
Password Reset Token
|
||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
<button
|
<button
|
||||||
|
|||||||
+45
-9
@@ -393,12 +393,12 @@ _checkNode(){
|
|||||||
then
|
then
|
||||||
printf "[WGDashboard] %s Node.js and npm are still not installed, halting script now.\n" "$heavy_crossmark"
|
printf "[WGDashboard] %s Node.js and npm are still not installed, halting script now.\n" "$heavy_crossmark"
|
||||||
printf "%s\n" "$helpMsg"
|
printf "%s\n" "$helpMsg"
|
||||||
kill $TOP_PID
|
return 1
|
||||||
elif ! _isNodeVersionSupported
|
elif ! _isNodeVersionSupported
|
||||||
then
|
then
|
||||||
printf "[WGDashboard] %s Found Node.js %s, but the frontend requires Node.js 20.19+ or 22.12+. Halting install now.\n" "$heavy_crossmark" "$(node --version)"
|
printf "[WGDashboard] %s Found Node.js %s, but the frontend requires Node.js 20.19+ or 22.12+. Halting install now.\n" "$heavy_crossmark" "$(node --version)"
|
||||||
printf "%s\n" "$helpMsg"
|
printf "%s\n" "$helpMsg"
|
||||||
kill $TOP_PID
|
return 1
|
||||||
else
|
else
|
||||||
printf "[WGDashboard] %s Node.js %s and npm %s are installed\n" "$heavy_checkmark" "$(node --version)" "$(npm --version)"
|
printf "[WGDashboard] %s Node.js %s and npm %s are installed\n" "$heavy_checkmark" "$(node --version)" "$(npm --version)"
|
||||||
fi
|
fi
|
||||||
@@ -406,19 +406,50 @@ _checkNode(){
|
|||||||
|
|
||||||
_compileFrontend(){
|
_compileFrontend(){
|
||||||
_logSection "Compiling Frontend"
|
_logSection "Compiling Frontend"
|
||||||
_checkNode
|
if ! _checkNode; then
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
|
||||||
local dir
|
local staging_root live_dir backup_dir dir output_dir index
|
||||||
for dir in "${frontend_dirs[@]}"; do
|
local frontend_output_dirs=("WGDashboardAdmin" "WGDashboardClient")
|
||||||
|
staging_root=$(mktemp -d "$PWD/static/.dist-staging.XXXXXX") || return 1
|
||||||
|
live_dir="$PWD/static/dist"
|
||||||
|
backup_dir="${staging_root}.previous"
|
||||||
|
|
||||||
|
for index in "${!frontend_dirs[@]}"; do
|
||||||
|
dir="${frontend_dirs[$index]}"
|
||||||
|
output_dir="$staging_root/${frontend_output_dirs[$index]}"
|
||||||
printf "[WGDashboard] %s Compiling frontend in %s\n" "$install" "$dir"
|
printf "[WGDashboard] %s Compiling frontend in %s\n" "$install" "$dir"
|
||||||
if ! ( cd "$dir" && npm ci && npm run build ) &>> ./log/install.txt
|
if ! ( cd "$dir" && npm ci && npm run build -- --outDir "$output_dir" --emptyOutDir ) &>> ./log/install.txt
|
||||||
then
|
then
|
||||||
printf "[WGDashboard] %s Failed to compile frontend in %s, halting script now.\n" "$heavy_crossmark" "$dir"
|
printf "[WGDashboard] %s Failed to compile frontend in %s, halting script now.\n" "$heavy_crossmark" "$dir"
|
||||||
printf "%s\n" "$helpMsg"
|
printf "%s\n" "$helpMsg"
|
||||||
kill $TOP_PID
|
rm -rf "$staging_root"
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
|
if [[ ! -f "$staging_root/WGDashboardAdmin/index.html" || ! -f "$staging_root/WGDashboardClient/client.html" ]]; then
|
||||||
|
printf "[WGDashboard] %s Frontend build did not produce the expected entry files.\n" "$heavy_crossmark"
|
||||||
|
rm -rf "$staging_root"
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [[ -e "$live_dir" ]] && ! mv "$live_dir" "$backup_dir"; then
|
||||||
|
printf "[WGDashboard] %s Could not preserve the current frontend bundle.\n" "$heavy_crossmark"
|
||||||
|
rm -rf "$staging_root"
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
if ! mv "$staging_root" "$live_dir"; then
|
||||||
|
printf "[WGDashboard] %s Could not install the new frontend bundle.\n" "$heavy_crossmark"
|
||||||
|
if [[ -e "$backup_dir" ]]; then
|
||||||
|
mv "$backup_dir" "$live_dir"
|
||||||
|
fi
|
||||||
|
rm -rf "$staging_root"
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
rm -rf "$backup_dir"
|
||||||
|
|
||||||
printf "[WGDashboard] %s Frontend is compiled\n" "$heavy_checkmark"
|
printf "[WGDashboard] %s Frontend is compiled\n" "$heavy_checkmark"
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -456,7 +487,9 @@ install_wgd(){
|
|||||||
_installPythonVenv
|
_installPythonVenv
|
||||||
_installPythonPip
|
_installPythonPip
|
||||||
_checkWireguard
|
_checkWireguard
|
||||||
_compileFrontend
|
if ! _compileFrontend; then
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
sudo chmod -R 755 /etc/wireguard/
|
sudo chmod -R 755 /etc/wireguard/
|
||||||
|
|
||||||
_check_and_set_venv
|
_check_and_set_venv
|
||||||
@@ -601,7 +634,10 @@ update_wgd() {
|
|||||||
printf "[WGDashboard] Downloading %s from GitHub..." "$new_ver"
|
printf "[WGDashboard] Downloading %s from GitHub..." "$new_ver"
|
||||||
{ date; git stash; git pull https://github.com/WGDashboard/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
|
chmod +x ./wgd.sh
|
||||||
sudo ./wgd.sh install
|
if ! sudo ./wgd.sh install; then
|
||||||
|
printf "[WGDashboard] %s Update installation failed. Check ./log/install.txt; the previous frontend bundle was preserved when possible.\n" "$heavy_crossmark"
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
printf "[WGDashboard] Update completed!\n"
|
printf "[WGDashboard] Update completed!\n"
|
||||||
rm wgd.sh.old
|
rm wgd.sh.old
|
||||||
else
|
else
|
||||||
|
|||||||
Reference in New Issue
Block a user