mirror of
https://github.com/donaldzou/WGDashboard.git
synced 2025-06-28 09:16:55 +00:00
Update
This commit is contained in:
parent
c6a44bfe09
commit
85d4b8c487
@ -13,6 +13,11 @@ def ConnectionString(database) -> str or None:
|
|||||||
cn = f'mysql+mysqldb://{parser.get("Database", "username")}:{parser.get("Database", "password")}@{parser.get("Database", "host")}/{database}'
|
cn = f'mysql+mysqldb://{parser.get("Database", "username")}:{parser.get("Database", "password")}@{parser.get("Database", "host")}/{database}'
|
||||||
else:
|
else:
|
||||||
cn = f'sqlite:///{os.path.join(sqlitePath, f"{database}.db")}'
|
cn = f'sqlite:///{os.path.join(sqlitePath, f"{database}.db")}'
|
||||||
if not database_exists(cn):
|
try:
|
||||||
create_database(cn)
|
if not database_exists(cn):
|
||||||
|
create_database(cn)
|
||||||
|
except Exception as e:
|
||||||
|
print("[WGDashboard] Database error: " + str(e))
|
||||||
|
exit(1)
|
||||||
|
|
||||||
return cn
|
return cn
|
@ -85,6 +85,7 @@ class DashboardClientsPeerAssignment:
|
|||||||
self.wireguardConfigurations[a['ConfigurationName']].Peers)
|
self.wireguardConfigurations[a['ConfigurationName']].Peers)
|
||||||
for p in peer:
|
for p in peer:
|
||||||
peers.append({
|
peers.append({
|
||||||
|
'protocol': self.wireguardConfigurations[a['ConfigurationName']].Protocol,
|
||||||
'id': p.id,
|
'id': p.id,
|
||||||
'private_key': p.private_key,
|
'private_key': p.private_key,
|
||||||
'name': p.name,
|
'name': p.name,
|
||||||
|
@ -93,6 +93,18 @@
|
|||||||
transform: scale(0.97);
|
transform: scale(0.97);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.btn-outline-body{
|
||||||
|
color: #000000;
|
||||||
|
border-color: #000000 !important;
|
||||||
|
background-color: transparent;
|
||||||
|
}
|
||||||
|
|
||||||
|
[data-bs-theme=dark] .btn-outline-body{
|
||||||
|
color: #ffffff;
|
||||||
|
border-color: #ffffff !important;
|
||||||
|
background-color: transparent;
|
||||||
|
}
|
||||||
|
|
||||||
.btn-body{
|
.btn-body{
|
||||||
border-color: #000000 !important;
|
border-color: #000000 !important;
|
||||||
color: #ffffff !important;
|
color: #ffffff !important;
|
||||||
@ -119,4 +131,14 @@
|
|||||||
|
|
||||||
.form-control{
|
.form-control{
|
||||||
border-width: 0;
|
border-width: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.amneziawgBg{
|
||||||
|
background: rgb(145,199,193);
|
||||||
|
background: linear-gradient(90deg, rgba(145,199,193,1) 0%, rgba(107,95,161,1) 50%, rgba(227,142,65,1) 100%);
|
||||||
|
}
|
||||||
|
|
||||||
|
.wireguardBg{
|
||||||
|
background: rgb(125,32,32);
|
||||||
|
background: linear-gradient(90deg, rgba(125,32,32,1) 0%, rgba(255,56,56,1) 100%);
|
||||||
}
|
}
|
@ -12,36 +12,45 @@ const showQRCode = ref(false)
|
|||||||
<template>
|
<template>
|
||||||
<div class="card rounded-3 border-0">
|
<div class="card rounded-3 border-0">
|
||||||
<div class="card-body p-3">
|
<div class="card-body p-3">
|
||||||
<div class="row g-2">
|
<div class="row gy-3">
|
||||||
<div class="d-flex gap-2 col-12">
|
<div class="col-sm-6 d-flex flex-column gap-3">
|
||||||
<small class="text-muted">
|
<h6 class="fw-bold mb-0">
|
||||||
<i class="bi bi-tag me-1"></i> Name
|
|
||||||
</small>
|
|
||||||
<small class="fw-bold flex-grow-1 text-end">
|
|
||||||
{{ props.config.name }}
|
{{ props.config.name }}
|
||||||
</small>
|
</h6>
|
||||||
|
<div class="mt-auto">
|
||||||
|
<button class="btn btn-outline-body rounded-3 flex-grow-1 fw-bold w-100" @click="showQRCode = true">
|
||||||
|
<i class="bi bi-link-45deg me-2"></i><small>Connect</small>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="d-flex gap-2 col-12">
|
<div class="col-sm-6 d-flex flex-column gap-3">
|
||||||
<small class="text-muted">
|
<div class="d-flex gap-2">
|
||||||
<i class="bi bi-bar-chart-fill me-1"></i> Data Usage
|
<small class="text-muted">
|
||||||
</small>
|
<i class="bi bi-bar-chart-fill me-1"></i> Protocol
|
||||||
<small class="fw-bold flex-grow-1 text-end">
|
</small>
|
||||||
3.42 / 4.00 GB
|
<span class="badge rounded-3 shadow ms-auto"
|
||||||
</small>
|
:class="[props.config.protocol === 'wg' ? 'wireguardBg' : 'amneziawgBg' ]"
|
||||||
|
v-if="props.config.protocol === 'wg'">
|
||||||
|
{{ props.config.protocol === 'wg' ? 'WireGuard': 'AmneziaWG' }}
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
<div class="d-flex gap-2">
|
||||||
|
<small class="text-muted">
|
||||||
|
<i class="bi bi-bar-chart-fill me-1"></i> Data Usage
|
||||||
|
</small>
|
||||||
|
<small class="fw-bold flex-grow-1 text-end">
|
||||||
|
3.42 / 4.00 GB
|
||||||
|
</small>
|
||||||
|
</div>
|
||||||
|
<div class="d-flex gap-2">
|
||||||
|
<small class="text-muted">
|
||||||
|
<i class="bi bi-calendar me-1"></i> Valid Until
|
||||||
|
</small>
|
||||||
|
<small class="fw-bold flex-grow-1 text-end">
|
||||||
|
2025-08-31 00:00:00
|
||||||
|
</small>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="d-flex gap-2 col-12">
|
|
||||||
<small class="text-muted">
|
|
||||||
<i class="bi bi-calendar me-1"></i> Valid Until
|
|
||||||
</small>
|
|
||||||
<small class="fw-bold flex-grow-1 text-end">
|
|
||||||
2025-08-31 00:00:00
|
|
||||||
</small>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="mt-3 d-flex">
|
|
||||||
<button class="btn btn-body rounded-3 flex-grow-1 fw-bold" @click="showQRCode = true">
|
|
||||||
<i class="bi bi-link-45deg me-2"></i><small>Connect</small>
|
|
||||||
</button>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<Transition name="app">
|
<Transition name="app">
|
||||||
|
@ -29,11 +29,11 @@ onMounted(async () => {
|
|||||||
<strong>WGDashboard Client</strong>
|
<strong>WGDashboard Client</strong>
|
||||||
</a>
|
</a>
|
||||||
<div class="ms-auto px-3 d-flex gap-2 nav-links">
|
<div class="ms-auto px-3 d-flex gap-2 nav-links">
|
||||||
<a class=" text-body btn btn-body rounded-3 ms-auto btn-sm" aria-current="page" href="#">
|
<a class=" text-body btn btn-outline-body rounded-3 ms-auto btn-sm" aria-current="page" href="#">
|
||||||
<i class="bi bi-gear-fill me-sm-2"></i>
|
<i class="bi bi-gear-fill me-sm-2"></i>
|
||||||
<span>Settings</span>
|
<span>Settings</span>
|
||||||
</a>
|
</a>
|
||||||
<RouterLink to="/signout" class="btn btn-danger rounded-3 btn-sm" aria-current="page">
|
<RouterLink to="/signout" class="btn btn-outline-danger rounded-3 btn-sm" aria-current="page">
|
||||||
<i class="bi bi-box-arrow-left me-sm-2"></i>
|
<i class="bi bi-box-arrow-left me-sm-2"></i>
|
||||||
<span>Sign Out</span>
|
<span>Sign Out</span>
|
||||||
</RouterLink>
|
</RouterLink>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user