diff --git a/.github/workflows/qodana_code_quality.yml b/.github/workflows/qodana_code_quality.yml deleted file mode 100644 index 7bdf543b..00000000 --- a/.github/workflows/qodana_code_quality.yml +++ /dev/null @@ -1,28 +0,0 @@ -name: Qodana -on: - workflow_dispatch: - pull_request: - push: - branches: # Specify your branches here - - main # The 'main' branch - - v4.2-dev - -jobs: - qodana: - runs-on: ubuntu-latest - permissions: - contents: write - pull-requests: write - checks: write - steps: - - uses: actions/checkout@v3 - with: - ref: ${{ github.event.pull_request.head.sha }} # to check out the actual pull request commit, not the merge commit - fetch-depth: 0 # a full history is required for pull request analysis - - name: 'Qodana Scan' - uses: JetBrains/qodana-action@v2024.3 - with: - pr-mode: false - env: - QODANA_TOKEN: ${{ secrets.QODANA_TOKEN_2090978292 }} - QODANA_ENDPOINT: 'https://qodana.cloud' diff --git a/README.md b/README.md index 3a1b0263..1140ab9d 100644 --- a/README.md +++ b/README.md @@ -12,12 +12,9 @@
-
-
-
-
-
+
+
+
@@ -37,20 +34,35 @@
This project is not affiliate to the official WireGuard Project
- +Join our Discord Server for quick help, or you wanna chat about this project!
Alternatively, you can also reach out at our Matrix.org Chatroom :)
- Matrix.org Chatroom + Matrix.org Chatroom +
+
+ You can support via
+
+ or, visit our merch store and support us by purchasing a merch +
+
-
\ No newline at end of file
+
diff --git a/docker/entrypoint.sh b/docker/entrypoint.sh
index 6396525b..85427e32 100644
--- a/docker/entrypoint.sh
+++ b/docker/entrypoint.sh
@@ -7,7 +7,7 @@ trap 'stop_service' SIGTERM
stop_service() {
echo "[WGDashboard] Stopping WGDashboard..."
- bash ./wgd.sh stop
+ /bin/bash ./wgd.sh stop
exit 0
}
@@ -18,51 +18,68 @@ ensure_installation() {
# When using a custom directory to store the files, this part moves over and makes sure the installation continues.
echo "Quick-installing..."
+ # Make the wgd.sh script executable.
chmod +x "${WGDASH}"/src/wgd.sh
cd "${WGDASH}"/src || exit
+ # Github issue: https://github.com/donaldzou/WGDashboard/issues/723
+ echo "Checking for stale pids..."
+ if [[ -f ${WGDASH}/src/gunicorn.pid ]]; then
+ echo "Found stale pid, removing..."
+ rm ${WGDASH}/src/gunicorn.pid
+ fi
+
+ # Removing clear shell command from the wgd.sh script to enhance docker logging.
echo "Removing clear command from wgd.sh for better Docker logging."
sed -i '/clear/d' ./wgd.sh
+ # Create the databases directory if it does not exist yet.
if [ ! -d "/data/db" ]; then
echo "Creating database dir"
mkdir /data/db
fi
+ # Linking the database on the persistent directory location to where WGDashboard expects.
if [ ! -d "${WGDASH}/src/db" ]; then
ln -s /data/db "${WGDASH}/src/db"
fi
+ # Create the wg-dashboard.ini file if it does not exist yet.
if [ ! -f "${config_file}" ]; then
echo "Creating wg-dashboard.ini file"
touch "${config_file}"
fi
+ # Link the wg-dashboard.ini file from the persistent directory to where WGDashboard expects it.
if [ ! -f "${WGDASH}/src/wg-dashboard.ini" ]; then
ln -s "${config_file}" "${WGDASH}/src/wg-dashboard.ini"
fi
+ # Create the Python virtual environment.
python3 -m venv "${WGDASH}"/src/venv
. "${WGDASH}/src/venv/bin/activate"
+ # Due to this pip dependency being available as a system package we can just move it to the venv.
echo "Moving PIP dependency from ephemerality to runtime environment: psutil"
mv /usr/lib/python3.12/site-packages/psutil* "${WGDASH}"/src/venv/lib/python3.12/site-packages
+ # Due to this pip dependency being available as a system package we can just move it to the venv.
echo "Moving PIP dependency from ephemerality to runtime environment: bcrypt"
mv /usr/lib/python3.12/site-packages/bcrypt* "${WGDASH}"/src/venv/lib/python3.12/site-packages
- ./wgd.sh install
+ # Use the bash interpreter to install WGDashboard according to the wgd.sh script.
+ /bin/bash ./wgd.sh install
echo "Looks like the installation succeeded. Moving on."
# This first step is to ensure the wg0.conf file exists, and if not, then its copied over from the ephemeral container storage.
- # This is done so WGDashboard it works out of the box
+ # This is done so WGDashboard it works out of the box, it also sets a randomly generated private key.
if [ ! -f "/etc/wireguard/wg0.conf" ]; then
echo "Standard wg0 Configuration file not found, grabbing template."
cp -a "/configs/wg0.conf.template" "/etc/wireguard/wg0.conf"
- echo "Setting a secure private key." # SORRY 4 BE4 - Daan
+ echo "Setting a secure private key."
local privateKey
privateKey=$(wg genkey)
@@ -106,6 +123,7 @@ set_envvars() {
sed -i "s/^peer_global_dns = .*/peer_global_dns = ${global_dns}/" "${config_file}"
fi
+ # Checking the current set public IP and changing it if it has changed.
current_public_ip=$(grep "remote_endpoint = " "${config_file}" | awk '{print $NF}')
if [ "${public_ip}" == "" ]; then
default_ip=$(curl -s ifconfig.me)
@@ -118,6 +136,7 @@ set_envvars() {
echo "Public-IP is correct, moving on."
fi
+ # Checking the current WGDashboard web port and changing if needed.
current_wgd_port=$(grep "app_port = " "${config_file}" | awk '{print $NF}')
if [ "${current_wgd_port}" == "${wgd_port}" ]; then
echo "Current WGD port is set correctly, moving on."
@@ -131,15 +150,18 @@ set_envvars() {
start_core() {
printf "\n---------------------- STARTING CORE -----------------------\n"
+ # Due to some instances complaining about this, making sure its there every time.
mkdir -p /dev/net
mknod /dev/net/tun c 10 200
chmod 600 /dev/net/tun
+ # Actually starting WGDashboard
echo "Activating Python venv and executing the WireGuard Dashboard service."
- bash ./wgd.sh start
+ /bin/bash ./wgd.sh start
}
ensure_blocking() {
+ # Wait a second before continuing, to give the python program some time to get ready.
sleep 1s
echo -e "\nEnsuring container continuation."
@@ -151,9 +173,12 @@ ensure_blocking() {
# Only tail the logs if they are found
if [ -n "$latestErrLog" ]; then
tail -f "$latestErrLog" &
+
+ # Wait for the tail process to end.
wait $!
else
echo "No log files found to tail. Something went wrong, exiting..."
+ exit 1
fi
}
diff --git a/src/dashboard.py b/src/dashboard.py
index a8d7035a..9ce1eb63 100644
--- a/src/dashboard.py
+++ b/src/dashboard.py
@@ -25,7 +25,7 @@ from modules.PeerJob import PeerJob
from modules.SystemStatus import SystemStatus
SystemStatus = SystemStatus()
-DASHBOARD_VERSION = 'v4.2.2'
+DASHBOARD_VERSION = 'v4.2.3'
CONFIGURATION_PATH = os.getenv('CONFIGURATION_PATH', '.')
DB_PATH = os.path.join(CONFIGURATION_PATH, 'db')
@@ -180,6 +180,7 @@ class PeerJobs:
def runJob(self):
needToDelete = []
+ self.__getJobs()
for job in self.Jobs:
c = WireguardConfigurations.get(job.Configuration)
if c is not None:
@@ -432,7 +433,6 @@ class WireguardConfiguration:
original = [l.rstrip("\n") for l in f.readlines()]
try:
start = original.index("[Interface]")
-
# Clean
for i in range(start, len(original)):
if original[i] == "[Peer]":
@@ -445,7 +445,7 @@ class WireguardConfiguration:
setattr(self, key, False)
else:
setattr(self, key, "")
-
+
# Set
for i in range(start, len(original)):
if original[i] == "[Peer]":
@@ -459,7 +459,10 @@ class WireguardConfiguration:
setattr(self, key, StringToBoolean(value))
else:
if len(getattr(self, key)) > 0:
- setattr(self, key, f"{getattr(self, key)}, {value}")
+ if key not in ["PostUp", "PostDown", "PreUp", "PreDown"]:
+ setattr(self, key, f"{getattr(self, key)}, {value}")
+ else:
+ setattr(self, key, f"{getattr(self, key)}; {value}")
else:
setattr(self, key, value)
except ValueError as e:
@@ -470,11 +473,12 @@ class WireguardConfiguration:
self.Status = self.getStatus()
def __dropDatabase(self):
- existingTables = sqlSelect(f"SELECT name FROM sqlite_master WHERE type='table' AND name LIKE '{self.Name}%'").fetchall()
+ existingTables = [self.Name, f'{self.Name}_restrict_access', f'{self.Name}_transfer', f'{self.Name}_deleted']
+ # existingTables = sqlSelect(f"SELECT name FROM sqlite_master WHERE type='table' AND name LIKE '{self.Name}%'").fetchall()
for t in existingTables:
- sqlUpdate("DROP TABLE '%s'" % t['name'])
+ sqlUpdate("DROP TABLE '%s'" % t)
- existingTables = sqlSelect(f"SELECT name FROM sqlite_master WHERE type='table' AND name LIKE '{self.Name}%'").fetchall()
+ # existingTables = sqlSelect(f"SELECT name FROM sqlite_master WHERE type='table' AND name LIKE '{self.Name}%'").fetchall()
def createDatabase(self, dbName = None):
if dbName is None:
@@ -804,6 +808,9 @@ class WireguardConfiguration:
return ResponseObject(False, "Failed to save configuration through WireGuard")
self.getPeers()
+
+ if numOfDeletedPeers == 0 and numOfFailedToDeletePeers == 0:
+ return ResponseObject(False, "No peer(s) to delete found", responseCode=404)
if numOfDeletedPeers == len(listOfPublicKeys):
return ResponseObject(True, f"Deleted {numOfDeletedPeers} peer(s)")
@@ -945,7 +952,8 @@ class WireguardConfiguration:
},
"ConnectedPeers": len(list(filter(lambda x: x.status == "running", self.Peers))),
"TotalPeers": len(self.Peers),
- "Protocol": self.Protocol
+ "Protocol": self.Protocol,
+ "Table": self.Table,
}
def backupConfigurationFile(self) -> tuple[bool, dict[str, str]]:
@@ -1047,7 +1055,7 @@ class WireguardConfiguration:
dataChanged = False
with open(self.configPath, 'r') as f:
original = [l.rstrip("\n") for l in f.readlines()]
- allowEdit = ["Address", "PreUp", "PostUp", "PreDown", "PostDown", "ListenPort"]
+ allowEdit = ["Address", "PreUp", "PostUp", "PreDown", "PostDown", "ListenPort", "Table"]
if self.Protocol == 'awg':
allowEdit += ["Jc", "Jmin", "Jmax", "S1", "S2", "H1", "H2", "H3", "H4"]
start = original.index("[Interface]")
@@ -1204,15 +1212,15 @@ AmneziaWG Configuration
"""
class AmneziaWireguardConfiguration(WireguardConfiguration):
def __init__(self, name: str = None, data: dict = None, backup: dict = None, startup: bool = False):
- self.Jc = 0
- self.Jmin = 0
- self.Jmax = 0
- self.S1 = 0
- self.S2 = 0
- self.H1 = 1
- self.H2 = 2
- self.H3 = 3
- self.H4 = 4
+ self.Jc = ""
+ self.Jmin = ""
+ self.Jmax = ""
+ self.S1 = ""
+ self.S2 = ""
+ self.H1 = ""
+ self.H2 = ""
+ self.H3 = ""
+ self.H4 = ""
super().__init__(name, data, backup, startup, wg=False)
@@ -1237,6 +1245,7 @@ class AmneziaWireguardConfiguration(WireguardConfiguration):
},
"ConnectedPeers": len(list(filter(lambda x: x.status == "running", self.Peers))),
"TotalPeers": len(self.Peers),
+ "Table": self.Table,
"Protocol": self.Protocol,
"Jc": self.Jc,
"Jmin": self.Jmin,
@@ -2463,11 +2472,11 @@ def API_deletePeers(configName: str) -> ResponseObject:
peers = data['peers']
if configName in WireguardConfigurations.keys():
if len(peers) == 0:
- return ResponseObject(False, "Please specify one or more peers")
+ return ResponseObject(False, "Please specify one or more peers", status_code=400)
configuration = WireguardConfigurations.get(configName)
return configuration.deletePeers(peers)
- return ResponseObject(False, "Configuration does not exist")
+ return ResponseObject(False, "Configuration does not exist", status_code=404)
@app.post(f'{APP_PREFIX}/api/restrictPeers/${R(e,!0)}`}br(e){return"An error occurred:
"+R(n.message+"",!0)+"";return t?Promise.resolve(s):s}if(t)return Promise.reject(n);throw n}}}const A=new Ot;function k(a,e){return A.parse(a,e)}k.options=k.setOptions=function(a){return A.setOptions(a),k.defaults=A.defaults,$e(k.defaults),k};k.getDefaults=te;k.defaults=L;k.use=function(...a){return A.use(...a),k.defaults=A.defaults,$e(k.defaults),k};k.walkTokens=function(a,e){return A.walkTokens(a,e)};k.parseInline=A.parseInline;k.Parser=T;k.parser=T.parse;k.Renderer=Q;k.TextRenderer=ce;k.Lexer=v;k.lexer=v.lex;k.Tokenizer=j;k.Hooks=H;k.parse=k;k.options;k.setOptions;k.use;k.walkTokens;k.parseInline;T.parse;v.lex;const jt={key:"header",class:"shadow"},Qt={class:"p-3 d-flex gap-2 flex-column"},Wt={class:"d-flex text-body"},Ut={class:"d-flex flex-column align-items-start gap-1"},Ft={class:"mb-0"},Vt={class:"mb-0"},Xt={class:"list-group"},Jt={href:"https://donaldzou.github.io/WGDashboard-Documentation/",target:"_blank",class:"list-group-item list-group-item-action d-flex align-items-center"},Yt={target:"_blank",role:"button",href:"https://discord.gg/72TwzjeuWm",class:"list-group-item list-group-item-action d-flex align-items-center"},Kt={__name:"agentModal",emits:["close"],setup(a,{emit:e}){const t=e,n=ee();return(s,r)=>(x(),S("div",{class:X(["agentContainer m-2 rounded-3 d-flex flex-column text-body",{enabled:Ee(n).HelpAgent.Enable}])},[d(we,{name:"agent-message"},{default:y(()=>[c("div",jt,[c("div",Qt,[c("div",Wt,[c("div",Ut,[c("h5",Ft,[d(C,{t:"Help"})])]),c("a",{role:"button",class:"ms-auto text-body",onClick:r[0]||(r[0]=i=>t("close"))},r[1]||(r[1]=[c("h5",{class:"mb-0"},[c("i",{class:"bi bi-x-lg"})],-1)]))]),c("p",Vt,[d(C,{t:"You can visit our: "})]),c("div",Xt,[c("a",Jt,[r[2]||(r[2]=c("i",{class:"bi bi-book-fill"},null,-1)),d(C,{class:"ms-auto",t:"Official Documentation"})]),c("a",Yt,[r[3]||(r[3]=c("i",{class:"bi bi-discord"},null,-1)),d(C,{class:"ms-auto",t:"Discord Server"})])])])])]),_:1})],2))}},en=K(Kt,[["__scopeId","data-v-694cfad1"]]),tn={name:"navbar",components:{HelpModal:lt,LocaleText:C,AgentModal:en},setup(){const a=De(),e=ee();return{wireguardConfigurationsStore:a,dashboardConfigurationStore:e}},data(){return{updateAvailable:!1,updateMessage:"Checking for update...",updateUrl:"",openHelpModal:!1,openAgentModal:!1}},computed:{getActiveCrossServer(){if(this.dashboardConfigurationStore.ActiveServerConfiguration)return new URL(this.dashboardConfigurationStore.CrossServerConfiguration.ServerList[this.dashboardConfigurationStore.ActiveServerConfiguration].host)}},mounted(){qe("/api/getDashboardUpdate",{},a=>{a.status?(a.data&&(this.updateAvailable=!0,this.updateUrl=a.data),this.updateMessage=a.message):(this.updateMessage=Ge("Failed to check available update"),console.log(`Failed to get update: ${a.message}`))})}},nn=["data-bs-theme"],sn={id:"sidebarMenu",class:"bg-body-tertiary sidebar border h-100 rounded-3 shadow overflow-y-scroll"},rn={class:"sidebar-sticky"},on={class:"text-white text-center m-0 py-3 mb-2 btn-brand"},ln={key:0,class:"ms-auto"},an={class:"nav flex-column px-2 gap-1"},cn={class:"nav-item"},un={class:"nav-item"},hn={class:"nav-item"},pn={class:"sidebar-heading px-3 mt-3 mb-1 text-muted text-center"},dn={class:"nav flex-column px-2 gap-1"},gn={class:"nav-item"},fn={class:"sidebar-heading px-3 mt-3 mb-1 text-muted text-center"},kn={class:"nav flex-column px-2 gap-1"},bn={class:"nav-item"},mn={class:"nav-item"},xn={class:"nav-item"},wn={class:"nav flex-column px-2 mb-3"},_n={class:"nav-item"},yn={class:"nav-item",style:{"font-size":"0.8rem"}},$n=["href"],Sn={class:"nav-link text-muted rounded-3"},vn={key:1,class:"nav-link text-muted rounded-3"};function Tn(a,e,t,n,s,r){const i=z("LocaleText"),o=z("RouterLink"),l=z("HelpModal"),u=z("AgentModal");return x(),S("div",{class:X(["col-md-3 col-lg-2 d-md-block p-2 navbar-container",{active:this.dashboardConfigurationStore.ShowNavBar}]),"data-bs-theme":n.dashboardConfigurationStore.Configuration.Server.dashboard_theme},[c("nav",sn,[c("div",rn,[c("div",on,[e[5]||(e[5]=c("h5",{class:"mb-0"}," WGDashboard ",-1)),r.getActiveCrossServer!==void 0?(x(),S("small",ln,[e[4]||(e[4]=c("i",{class:"bi bi-hdd-rack-fill me-2"},null,-1)),I(E(r.getActiveCrossServer.host),1)])):D("",!0)]),c("ul",an,[c("li",cn,[d(o,{class:"nav-link rounded-3",to:"/","exact-active-class":"active"},{default:y(()=>[e[6]||(e[6]=c("i",{class:"bi bi-house me-2"},null,-1)),d(i,{t:"Home"})]),_:1})]),c("li",un,[d(o,{class:"nav-link rounded-3",to:"/settings","exact-active-class":"active"},{default:y(()=>[e[7]||(e[7]=c("i",{class:"bi bi-gear me-2"},null,-1)),d(i,{t:"Settings"})]),_:1})]),c("li",hn,[c("a",{class:"nav-link rounded-3",role:"button",onClick:e[0]||(e[0]=h=>s.openAgentModal=!0)},[e[8]||(e[8]=c("i",{class:"bi bi-question-circle me-2"},null,-1)),d(i,{t:"Help"})])])]),e[11]||(e[11]=c("hr",{class:"text-body my-2"},null,-1)),c("h6",pn,[d(i,{t:"WireGuard Configurations"})]),c("ul",dn,[(x(!0),S(_e,null,ye(this.wireguardConfigurationsStore.Configurations,h=>(x(),S("li",gn,[d(o,{to:"/configuration/"+h.Name+"/peers",class:"nav-link nav-conf-link rounded-3","active-class":"active"},{default:y(()=>[c("span",{class:X(["dot me-2",{active:h.Status}])},null,2),I(" "+E(h.Name),1)]),_:2},1032,["to"])]))),256))]),e[12]||(e[12]=c("hr",{class:"text-body my-2"},null,-1)),c("h6",fn,[d(i,{t:"Tools"})]),c("ul",kn,[c("li",bn,[d(o,{to:"/system_status",class:"nav-link rounded-3","active-class":"active"},{default:y(()=>[d(i,{t:"System Status"})]),_:1})]),c("li",mn,[d(o,{to:"/ping",class:"nav-link rounded-3","active-class":"active"},{default:y(()=>[d(i,{t:"Ping"})]),_:1})]),c("li",xn,[d(o,{to:"/traceroute",class:"nav-link rounded-3","active-class":"active"},{default:y(()=>[d(i,{t:"Traceroute"})]),_:1})])]),e[13]||(e[13]=c("hr",{class:"text-body my-2"},null,-1)),c("ul",wn,[c("li",_n,[c("a",{class:"nav-link text-danger rounded-3",onClick:e[1]||(e[1]=h=>this.dashboardConfigurationStore.signOut()),role:"button",style:{"font-weight":"bold"}},[e[9]||(e[9]=c("i",{class:"bi bi-box-arrow-left me-2"},null,-1)),d(i,{t:"Sign Out"})])]),c("li",yn,[this.updateAvailable?(x(),S("a",{key:0,href:this.updateUrl,class:"text-decoration-none rounded-3",target:"_blank"},[c("small",Sn,[d(i,{t:this.updateMessage},null,8,["t"]),e[10]||(e[10]=I(" (")),d(i,{t:"Current Version:"}),I(" "+E(n.dashboardConfigurationStore.Configuration.Server.version)+") ",1)])],8,$n)):(x(),S("small",vn,[d(i,{t:this.updateMessage},null,8,["t"]),I(" ("+E(n.dashboardConfigurationStore.Configuration.Server.version)+") ",1)]))])])])]),d(J,{name:"zoom"},{default:y(()=>[this.openHelpModal?(x(),q(l,{key:0,onClose:e[2]||(e[2]=h=>{s.openHelpModal=!1})})):D("",!0)]),_:1}),d(J,{name:"slideIn"},{default:y(()=>[this.openAgentModal?(x(),q(u,{key:0,onClose:e[3]||(e[3]=h=>s.openAgentModal=!1)})):D("",!0)]),_:1})],10,nn)}const Rn=K(tn,[["render",Tn],["__scopeId","data-v-58e71749"]]),Cn={name:"index",components:{Message:He,Navbar:Rn},async setup(){return{dashboardConfigurationStore:ee()}},computed:{getMessages(){return this.dashboardConfigurationStore.Messages.filter(a=>a.show)}}},zn=["data-bs-theme"],An={class:"row h-100"},Ln={class:"col-md-9 col-lg-10 overflow-y-scroll mb-0 pt-2"},In={class:"messageCentre text-body position-absolute d-flex"};function Pn(a,e,t,n,s,r){const i=z("Navbar"),o=z("RouterView"),l=z("Message");return x(),S("div",{class:"container-fluid flex-grow-1 main","data-bs-theme":this.dashboardConfigurationStore.Configuration.Server.dashboard_theme},[c("div",An,[d(i),c("main",Ln,[(x(),q(Ze,null,{default:y(()=>[d(o,null,{default:y(({Component:u})=>[d(J,{name:"fade2",mode:"out-in",appear:""},{default:y(()=>[(x(),q(Ne(u)))]),_:2},1024)]),_:1})]),_:1})),c("div",In,[d(we,{name:"message",tag:"div",class:"position-relative flex-sm-grow-0 flex-grow-1 d-flex align-items-end ms-sm-auto flex-column gap-2"},{default:y(()=>[(x(!0),S(_e,null,ye(r.getMessages.slice().reverse(),u=>(x(),q(l,{message:u,key:u.id},null,8,["message"]))),128))]),_:1})])])])],8,zn)}const qn=K(Cn,[["render",Pn],["__scopeId","data-v-0c6a5068"]]);export{qn as default}; +Please report this to https://github.com/markedjs/marked.`,e){const s="
An error occurred:
"+R(n.message+"",!0)+"";return t?Promise.resolve(s):s}if(t)return Promise.reject(n);throw n}}}const A=new Ot;function k(a,e){return A.parse(a,e)}k.options=k.setOptions=function(a){return A.setOptions(a),k.defaults=A.defaults,$e(k.defaults),k};k.getDefaults=te;k.defaults=L;k.use=function(...a){return A.use(...a),k.defaults=A.defaults,$e(k.defaults),k};k.walkTokens=function(a,e){return A.walkTokens(a,e)};k.parseInline=A.parseInline;k.Parser=T;k.parser=T.parse;k.Renderer=Q;k.TextRenderer=ce;k.Lexer=v;k.lexer=v.lex;k.Tokenizer=j;k.Hooks=H;k.parse=k;k.options;k.setOptions;k.use;k.walkTokens;k.parseInline;T.parse;v.lex;const jt={key:"header",class:"shadow"},Qt={class:"p-3 d-flex gap-2 flex-column"},Wt={class:"d-flex text-body"},Ut={class:"d-flex flex-column align-items-start gap-1"},Ft={class:"mb-0"},Vt={class:"mb-0"},Xt={class:"list-group"},Jt={href:"https://donaldzou.github.io/WGDashboard-Documentation/",target:"_blank",class:"list-group-item list-group-item-action d-flex align-items-center"},Yt={target:"_blank",role:"button",href:"https://discord.gg/72TwzjeuWm",class:"list-group-item list-group-item-action d-flex align-items-center"},Kt={__name:"agentModal",emits:["close"],setup(a,{emit:e}){const t=e,n=ee();return(s,r)=>(x(),S("div",{class:X(["agentContainer m-2 rounded-3 d-flex flex-column text-body",{enabled:Ee(n).HelpAgent.Enable}])},[d(we,{name:"agent-message"},{default:y(()=>[c("div",jt,[c("div",Qt,[c("div",Wt,[c("div",Ut,[c("h5",Ft,[d(C,{t:"Help"})])]),c("a",{role:"button",class:"ms-auto text-body",onClick:r[0]||(r[0]=i=>t("close"))},r[1]||(r[1]=[c("h5",{class:"mb-0"},[c("i",{class:"bi bi-x-lg"})],-1)]))]),c("p",Vt,[d(C,{t:"You can visit our: "})]),c("div",Xt,[c("a",Jt,[r[2]||(r[2]=c("i",{class:"bi bi-book-fill"},null,-1)),d(C,{class:"ms-auto",t:"Official Documentation"})]),c("a",Yt,[r[3]||(r[3]=c("i",{class:"bi bi-discord"},null,-1)),d(C,{class:"ms-auto",t:"Discord Server"})])])])])]),_:1})],2))}},en=K(Kt,[["__scopeId","data-v-a76f42bd"]]),tn={name:"navbar",components:{HelpModal:lt,LocaleText:C,AgentModal:en},setup(){const a=De(),e=ee();return{wireguardConfigurationsStore:a,dashboardConfigurationStore:e}},data(){return{updateAvailable:!1,updateMessage:"Checking for update...",updateUrl:"",openHelpModal:!1,openAgentModal:!1}},computed:{getActiveCrossServer(){if(this.dashboardConfigurationStore.ActiveServerConfiguration)return new URL(this.dashboardConfigurationStore.CrossServerConfiguration.ServerList[this.dashboardConfigurationStore.ActiveServerConfiguration].host)}},mounted(){qe("/api/getDashboardUpdate",{},a=>{a.status?(a.data&&(this.updateAvailable=!0,this.updateUrl=a.data),this.updateMessage=a.message):(this.updateMessage=Ge("Failed to check available update"),console.log(`Failed to get update: ${a.message}`))})}},nn=["data-bs-theme"],sn={id:"sidebarMenu",class:"bg-body-tertiary sidebar border h-100 rounded-3 shadow overflow-y-scroll"},rn={class:"sidebar-sticky"},on={class:"text-white text-center m-0 py-3 mb-2 btn-brand"},ln={key:0,class:"ms-auto"},an={class:"nav flex-column px-2 gap-1"},cn={class:"nav-item"},un={class:"nav-item"},hn={class:"nav-item"},pn={class:"sidebar-heading px-3 mt-3 mb-1 text-muted text-center"},dn={class:"nav flex-column px-2 gap-1"},gn={class:"nav-item"},fn={class:"sidebar-heading px-3 mt-3 mb-1 text-muted text-center"},kn={class:"nav flex-column px-2 gap-1"},bn={class:"nav-item"},mn={class:"nav-item"},xn={class:"nav-item"},wn={class:"nav flex-column px-2 mb-3"},_n={class:"nav-item"},yn={class:"nav-item",style:{"font-size":"0.8rem"}},$n=["href"],Sn={class:"nav-link text-muted rounded-3"},vn={key:1,class:"nav-link text-muted rounded-3"};function Tn(a,e,t,n,s,r){const i=z("LocaleText"),o=z("RouterLink"),l=z("HelpModal"),u=z("AgentModal");return x(),S("div",{class:X(["col-md-3 col-lg-2 d-md-block p-2 navbar-container",{active:this.dashboardConfigurationStore.ShowNavBar}]),"data-bs-theme":n.dashboardConfigurationStore.Configuration.Server.dashboard_theme},[c("nav",sn,[c("div",rn,[c("div",on,[e[5]||(e[5]=c("h5",{class:"mb-0"}," WGDashboard ",-1)),r.getActiveCrossServer!==void 0?(x(),S("small",ln,[e[4]||(e[4]=c("i",{class:"bi bi-hdd-rack-fill me-2"},null,-1)),I(E(r.getActiveCrossServer.host),1)])):D("",!0)]),c("ul",an,[c("li",cn,[d(o,{class:"nav-link rounded-3",to:"/","exact-active-class":"active"},{default:y(()=>[e[6]||(e[6]=c("i",{class:"bi bi-house me-2"},null,-1)),d(i,{t:"Home"})]),_:1})]),c("li",un,[d(o,{class:"nav-link rounded-3",to:"/settings","exact-active-class":"active"},{default:y(()=>[e[7]||(e[7]=c("i",{class:"bi bi-gear me-2"},null,-1)),d(i,{t:"Settings"})]),_:1})]),c("li",hn,[c("a",{class:"nav-link rounded-3",role:"button",onClick:e[0]||(e[0]=h=>s.openAgentModal=!0)},[e[8]||(e[8]=c("i",{class:"bi bi-question-circle me-2"},null,-1)),d(i,{t:"Help"})])])]),e[11]||(e[11]=c("hr",{class:"text-body my-2"},null,-1)),c("h6",pn,[d(i,{t:"WireGuard Configurations"})]),c("ul",dn,[(x(!0),S(_e,null,ye(this.wireguardConfigurationsStore.Configurations,h=>(x(),S("li",gn,[d(o,{to:"/configuration/"+h.Name+"/peers",class:"nav-link nav-conf-link rounded-3","active-class":"active"},{default:y(()=>[c("span",{class:X(["dot me-2",{active:h.Status}])},null,2),I(" "+E(h.Name),1)]),_:2},1032,["to"])]))),256))]),e[12]||(e[12]=c("hr",{class:"text-body my-2"},null,-1)),c("h6",fn,[d(i,{t:"Tools"})]),c("ul",kn,[c("li",bn,[d(o,{to:"/system_status",class:"nav-link rounded-3","active-class":"active"},{default:y(()=>[d(i,{t:"System Status"})]),_:1})]),c("li",mn,[d(o,{to:"/ping",class:"nav-link rounded-3","active-class":"active"},{default:y(()=>[d(i,{t:"Ping"})]),_:1})]),c("li",xn,[d(o,{to:"/traceroute",class:"nav-link rounded-3","active-class":"active"},{default:y(()=>[d(i,{t:"Traceroute"})]),_:1})])]),e[13]||(e[13]=c("hr",{class:"text-body my-2"},null,-1)),c("ul",wn,[c("li",_n,[c("a",{class:"nav-link text-danger rounded-3",onClick:e[1]||(e[1]=h=>this.dashboardConfigurationStore.signOut()),role:"button",style:{"font-weight":"bold"}},[e[9]||(e[9]=c("i",{class:"bi bi-box-arrow-left me-2"},null,-1)),d(i,{t:"Sign Out"})])]),c("li",yn,[this.updateAvailable?(x(),S("a",{key:0,href:this.updateUrl,class:"text-decoration-none rounded-3",target:"_blank"},[c("small",Sn,[d(i,{t:this.updateMessage},null,8,["t"]),e[10]||(e[10]=I(" (")),d(i,{t:"Current Version:"}),I(" "+E(n.dashboardConfigurationStore.Configuration.Server.version)+") ",1)])],8,$n)):(x(),S("small",vn,[d(i,{t:this.updateMessage},null,8,["t"]),I(" ("+E(n.dashboardConfigurationStore.Configuration.Server.version)+") ",1)]))])])])]),d(J,{name:"zoom"},{default:y(()=>[this.openHelpModal?(x(),q(l,{key:0,onClose:e[2]||(e[2]=h=>{s.openHelpModal=!1})})):D("",!0)]),_:1}),d(J,{name:"slideIn"},{default:y(()=>[this.openAgentModal?(x(),q(u,{key:0,onClose:e[3]||(e[3]=h=>s.openAgentModal=!1)})):D("",!0)]),_:1})],10,nn)}const Rn=K(tn,[["render",Tn],["__scopeId","data-v-58e71749"]]),Cn={name:"index",components:{Message:He,Navbar:Rn},async setup(){return{dashboardConfigurationStore:ee()}},computed:{getMessages(){return this.dashboardConfigurationStore.Messages.filter(a=>a.show)}}},zn=["data-bs-theme"],An={class:"row h-100"},Ln={class:"col-md-9 col-lg-10 overflow-y-scroll mb-0 pt-2"},In={class:"messageCentre text-body position-absolute d-flex"};function Pn(a,e,t,n,s,r){const i=z("Navbar"),o=z("RouterView"),l=z("Message");return x(),S("div",{class:"container-fluid flex-grow-1 main","data-bs-theme":this.dashboardConfigurationStore.Configuration.Server.dashboard_theme},[c("div",An,[d(i),c("main",Ln,[(x(),q(Ze,null,{default:y(()=>[d(o,null,{default:y(({Component:u})=>[d(J,{name:"fade2",mode:"out-in",appear:""},{default:y(()=>[(x(),q(Ne(u)))]),_:2},1024)]),_:1})]),_:1})),c("div",In,[d(we,{name:"message",tag:"div",class:"position-relative flex-sm-grow-0 flex-grow-1 d-flex align-items-end ms-sm-auto flex-column gap-2"},{default:y(()=>[(x(!0),S(_e,null,ye(r.getMessages.slice().reverse(),u=>(x(),q(l,{message:u,key:u.id},null,8,["message"]))),128))]),_:1})])])])],8,zn)}const qn=K(Cn,[["render",Pn],["__scopeId","data-v-0c6a5068"]]);export{qn as default}; diff --git a/src/static/app/dist/assets/index-CQK2bMfy.js b/src/static/app/dist/assets/index-myupzXki.js similarity index 99% rename from src/static/app/dist/assets/index-CQK2bMfy.js rename to src/static/app/dist/assets/index-myupzXki.js index 3f437853..b202ea95 100644 --- a/src/static/app/dist/assets/index-CQK2bMfy.js +++ b/src/static/app/dist/assets/index-myupzXki.js @@ -1,4 +1,4 @@ -import{P as Ws,Q as Vs,R as Ue,U as Hn,r as Wn,o as Vn,V as Nn,H as jn,X as Xe,Y as $n,Z as Ns}from"./index-C00IVglr.js";/*! +import{P as Ws,Q as Vs,R as Ue,U as Hn,r as Wn,o as Vn,V as Nn,H as jn,X as Xe,Y as $n,Z as Ns}from"./index-DZliHkQD.js";/*! * @kurkle/color v0.3.2 * https://github.com/kurkle/color#readme * (c) 2023 Jukka Kurkela diff --git a/src/static/app/dist/assets/localeText-BUK20hPB.js b/src/static/app/dist/assets/localeText-DG9SnJT8.js similarity index 76% rename from src/static/app/dist/assets/localeText-BUK20hPB.js rename to src/static/app/dist/assets/localeText-DG9SnJT8.js index 362e9c96..a9bd3bf3 100644 --- a/src/static/app/dist/assets/localeText-BUK20hPB.js +++ b/src/static/app/dist/assets/localeText-DG9SnJT8.js @@ -1 +1 @@ -import{_ as e,G as t,a as o,c as a,t as c}from"./index-C00IVglr.js";const s={name:"localeText",props:{t:""},computed:{getLocaleText(){return t(this.t)}}};function n(r,p,l,_,i,x){return o(),a("span",null,c(this.getLocaleText),1)}const u=e(s,[["render",n]]);export{u as L}; +import{_ as e,G as t,a as o,c as a,t as c}from"./index-DZliHkQD.js";const s={name:"localeText",props:{t:""},computed:{getLocaleText(){return t(this.t)}}};function n(r,p,l,_,i,x){return o(),a("span",null,c(this.getLocaleText),1)}const u=e(s,[["render",n]]);export{u as L}; diff --git a/src/static/app/dist/assets/message-DJFYcYl4.js b/src/static/app/dist/assets/message-DZx7QSKr.js similarity index 84% rename from src/static/app/dist/assets/message-DJFYcYl4.js rename to src/static/app/dist/assets/message-DZx7QSKr.js index a861cba6..42c7ca4e 100644 --- a/src/static/app/dist/assets/message-DJFYcYl4.js +++ b/src/static/app/dist/assets/message-DZx7QSKr.js @@ -1 +1 @@ -import{L as l}from"./localeText-BUK20hPB.js";import{d as c}from"./dayjs.min-ChFfjVGD.js";import{_ as h,a as o,c as a,b as e,d as i,w as u,f as p,t as n,j as g,n as f,k as _}from"./index-C00IVglr.js";const x={name:"message",methods:{dayjs:c,hide(){this.ct(),this.message.show=!1},show(){this.timeout=setTimeout(()=>{this.message.show=!1},5e3)},ct(){clearTimeout(this.timeout)}},components:{LocaleText:l},props:{message:Object},mounted(){this.show()},data(){return{dismiss:!1,timeout:null}}},v=["id"],b={key:0,class:"d-flex"},w={class:"fw-bold d-block",style:{"text-transform":"uppercase"}},y={class:"ms-auto"},k={key:1},T={class:"card-body d-flex align-items-center gap-3"};function M(j,s,C,L,t,m){const d=_("LocaleText");return o(),a("div",{onMouseenter:s[1]||(s[1]=r=>{t.dismiss=!0,this.ct()}),onMouseleave:s[2]||(s[2]=r=>{t.dismiss=!1,this.show()}),class:"card shadow rounded-3 position-relative message ms-auto",id:this.message.id},[e("div",{class:f([{"text-bg-danger":this.message.type==="danger","text-bg-success":this.message.type==="success","text-bg-warning":this.message.type==="warning"},"card-header pos"])},[i(g,{name:"zoom",mode:"out-in"},{default:u(()=>[t.dismiss?(o(),a("div",k,[e("small",{onClick:s[0]||(s[0]=r=>m.hide()),class:"d-block mx-auto w-100 text-center",style:{cursor:"pointer"}},[s[3]||(s[3]=e("i",{class:"bi bi-x-lg me-2"},null,-1)),i(d,{t:"Dismiss"})])])):(o(),a("div",b,[e("small",w,[i(d,{t:"FROM "}),p(" "+n(this.message.from),1)]),e("small",y,n(m.dayjs().format("hh:mm A")),1)]))]),_:1})],2),e("div",T,[e("div",null,n(this.message.content),1)])],40,v)}const z=h(x,[["render",M],["__scopeId","data-v-94c76b54"]]);export{z as M}; +import{L as l}from"./localeText-DG9SnJT8.js";import{d as c}from"./dayjs.min-PaIL06iQ.js";import{_ as h,a as o,c as a,b as e,d as i,w as u,f as p,t as n,j as g,n as f,k as _}from"./index-DZliHkQD.js";const x={name:"message",methods:{dayjs:c,hide(){this.ct(),this.message.show=!1},show(){this.timeout=setTimeout(()=>{this.message.show=!1},5e3)},ct(){clearTimeout(this.timeout)}},components:{LocaleText:l},props:{message:Object},mounted(){this.show()},data(){return{dismiss:!1,timeout:null}}},v=["id"],b={key:0,class:"d-flex"},w={class:"fw-bold d-block",style:{"text-transform":"uppercase"}},y={class:"ms-auto"},k={key:1},T={class:"card-body d-flex align-items-center gap-3"};function M(j,s,C,L,t,m){const d=_("LocaleText");return o(),a("div",{onMouseenter:s[1]||(s[1]=r=>{t.dismiss=!0,this.ct()}),onMouseleave:s[2]||(s[2]=r=>{t.dismiss=!1,this.show()}),class:"card shadow rounded-3 position-relative message ms-auto",id:this.message.id},[e("div",{class:f([{"text-bg-danger":this.message.type==="danger","text-bg-success":this.message.type==="success","text-bg-warning":this.message.type==="warning"},"card-header pos"])},[i(g,{name:"zoom",mode:"out-in"},{default:u(()=>[t.dismiss?(o(),a("div",k,[e("small",{onClick:s[0]||(s[0]=r=>m.hide()),class:"d-block mx-auto w-100 text-center",style:{cursor:"pointer"}},[s[3]||(s[3]=e("i",{class:"bi bi-x-lg me-2"},null,-1)),i(d,{t:"Dismiss"})])])):(o(),a("div",b,[e("small",w,[i(d,{t:"FROM "}),p(" "+n(this.message.from),1)]),e("small",y,n(m.dayjs().format("hh:mm A")),1)]))]),_:1})],2),e("div",T,[e("div",null,n(this.message.content),1)])],40,v)}const z=h(x,[["render",M],["__scopeId","data-v-94c76b54"]]);export{z as M}; diff --git a/src/static/app/dist/assets/newConfiguration-CAFzjDsW.css b/src/static/app/dist/assets/newConfiguration-CAFzjDsW.css new file mode 100644 index 00000000..89c9495e --- /dev/null +++ b/src/static/app/dist/assets/newConfiguration-CAFzjDsW.css @@ -0,0 +1 @@ +.protocolBtnGroup a[data-v-b97242f3]{transition:all .2s ease-in-out} diff --git a/src/static/app/dist/assets/newConfiguration-CPAMxqV6.js b/src/static/app/dist/assets/newConfiguration-CPAMxqV6.js new file mode 100644 index 00000000..ed96e8fa --- /dev/null +++ b/src/static/app/dist/assets/newConfiguration-CPAMxqV6.js @@ -0,0 +1,3 @@ +import{p as P}from"./index-L60y6kc9.js";import{_ as x,W as L,r as k,g as S,D as K,A,c as l,b as t,d as a,w as U,n as v,e as b,m as p,y as h,t as g,f as w,F as y,h as _,k as C,a as d}from"./index-DZliHkQD.js";import{L as I}from"./localeText-DG9SnJT8.js";const N=s=>{const e=s.split(` +`),i={};for(let c of e){if(c==="[Peer]")break;if(c.length>0){let n=c.replace(" = ","=");n.indexOf("=")>-1&&(n=[n.slice(0,n.indexOf("=")),n.slice(n.indexOf("=")+1)],n[0]==="ListenPort"?i[n[0]]=parseInt(n[1]):i[n[0]]=n[1])}}return i},O=s=>{const e=s.split(` +`),i=[];let c=-1;const n=e.indexOf("[Peer]");if(n===-1)return!1;for(let u=n;u