mirror of
https://github.com/donaldzou/WGDashboard.git
synced 2025-06-28 01:06:58 +00:00
Fixed runJob
This commit is contained in:
parent
40d3548c82
commit
e69e7ff3c1
@ -95,7 +95,7 @@ class DashboardClients:
|
|||||||
if checkPwd:
|
if checkPwd:
|
||||||
session['Email'] = Email
|
session['Email'] = Email
|
||||||
session['ClientID'] = existingClient.get("ClientID")
|
session['ClientID'] = existingClient.get("ClientID")
|
||||||
return True, self.DashboardClientsTOTP.GenerateToken(existingClient.get("ClientID"))
|
return True, self.DashboardClientsTOTP.GenerateToken(existingClient.get("ClientID"))
|
||||||
return False, "Email or Password is incorrect"
|
return False, "Email or Password is incorrect"
|
||||||
|
|
||||||
def SignIn_GetTotp(self, Token: str, UserProvidedTotp: str = None) -> tuple[bool, str] or tuple[bool, None, str]:
|
def SignIn_GetTotp(self, Token: str, UserProvidedTotp: str = None) -> tuple[bool, str] or tuple[bool, None, str]:
|
||||||
|
@ -138,6 +138,7 @@ class PeerJobs:
|
|||||||
|
|
||||||
|
|
||||||
def runJob(self):
|
def runJob(self):
|
||||||
|
print("[WGDashboard] Running scheduled jobs")
|
||||||
needToDelete = []
|
needToDelete = []
|
||||||
self.__getJobs()
|
self.__getJobs()
|
||||||
for job in self.Jobs:
|
for job in self.Jobs:
|
||||||
@ -156,24 +157,28 @@ class PeerJobs:
|
|||||||
if runAction:
|
if runAction:
|
||||||
s = False
|
s = False
|
||||||
if job.Action == "restrict":
|
if job.Action == "restrict":
|
||||||
s = c.restrictPeers([fp.id]).get_json()
|
s, msg = c.restrictPeers([fp.id])
|
||||||
elif job.Action == "delete":
|
elif job.Action == "delete":
|
||||||
s = c.deletePeers([fp.id]).get_json()
|
s, msg = c.deletePeers([fp.id])
|
||||||
|
|
||||||
if s['status'] is True:
|
if s is True:
|
||||||
self.JobLogger.log(job.JobID, s["status"],
|
self.JobLogger.log(job.JobID, s,
|
||||||
f"Peer {fp.id} from {c.Name} is successfully {job.Action}ed."
|
f"Peer {fp.id} from {c.Name} is successfully {job.Action}ed."
|
||||||
)
|
)
|
||||||
|
print(f"[WGDashboard] Peer {fp.id} from {c.Name} is successfully {job.Action}ed.")
|
||||||
needToDelete.append(job)
|
needToDelete.append(job)
|
||||||
else:
|
else:
|
||||||
self.JobLogger.log(job.JobID, s["status"],
|
print(f"[WGDashboard] Peer {fp.id} from {c.Name} is failed {job.Action}ed.")
|
||||||
|
self.JobLogger.log(job.JobID, s,
|
||||||
f"Peer {fp.id} from {c.Name} failed {job.Action}ed."
|
f"Peer {fp.id} from {c.Name} failed {job.Action}ed."
|
||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
|
print(f"[WGDashboard] Somehow can't find this peer {job.Peer} from {c.Name} failed {job.Action}ed.")
|
||||||
self.JobLogger.log(job.JobID, False,
|
self.JobLogger.log(job.JobID, False,
|
||||||
f"Somehow can't find this peer {job.Peer} from {c.Name} failed {job.Action}ed."
|
f"Somehow can't find this peer {job.Peer} from {c.Name} failed {job.Action}ed."
|
||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
|
print(f"[WGDashboard] Somehow can't find this peer {job.Peer} from {c.Name} failed {job.Action}ed.")
|
||||||
self.JobLogger.log(job.JobID, False,
|
self.JobLogger.log(job.JobID, False,
|
||||||
f"Somehow can't find this peer {job.Peer} from {job.Configuration} failed {job.Action}ed."
|
f"Somehow can't find this peer {job.Peer} from {job.Configuration} failed {job.Action}ed."
|
||||||
)
|
)
|
||||||
|
@ -4,9 +4,9 @@ import NotificationList from "@/components/Notification/notificationList.vue";
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<div data-bs-theme="dark" class="text-body bg-body w-100 h-100">
|
<div data-bs-theme="dark" class="text-body bg-body vw-100 vh-100 bg-body-tertiary">
|
||||||
<div class="d-flex vh-100 vw-100 p-sm-4 overflow-y-scroll">
|
<div class="d-flex vh-100 vw-100 p-sm-4 overflow-y-scroll">
|
||||||
<div class="mx-auto my-sm-auto bg-body-tertiary rounded-4 shadow-sm position-relative"
|
<div class="mx-auto my-sm-auto position-relative"
|
||||||
id="listContainer"
|
id="listContainer"
|
||||||
style="width: 700px">
|
style="width: 700px">
|
||||||
<Suspense>
|
<Suspense>
|
||||||
|
@ -76,13 +76,12 @@
|
|||||||
|
|
||||||
.app-enter-active,
|
.app-enter-active,
|
||||||
.app-leave-active {
|
.app-leave-active {
|
||||||
|
transition: all 0.4s cubic-bezier(0.82, 0.58, 0.17, 1);
|
||||||
transition: all 0.3s cubic-bezier(0.82, 0.58, 0.17, 1);
|
|
||||||
}
|
}
|
||||||
.app-enter-from,
|
.app-enter-from,
|
||||||
.app-leave-to{
|
.app-leave-to{
|
||||||
opacity: 0;
|
opacity: 0;
|
||||||
filter: blur(5px);
|
filter: blur(8px);
|
||||||
}
|
}
|
||||||
|
|
||||||
.app-enter-from{
|
.app-enter-from{
|
||||||
|
@ -10,48 +10,39 @@ const showQRCode = ref(false)
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
<template>
|
<template>
|
||||||
<div class="card rounded-3 border-0">
|
<div class="card rounded-3 border shadow">
|
||||||
<div class="card-body p-3">
|
<div class="card-header border-0 align-items-center d-flex p-3 flex-column flex-sm-row gap-2">
|
||||||
<div class="row gy-3">
|
<small class="fw-bold">
|
||||||
<div class="col-sm-6 d-flex flex-column gap-3">
|
{{ props.config.name }}
|
||||||
<h6 class="fw-bold mb-0">
|
</small>
|
||||||
{{ props.config.name }}
|
<span class="badge rounded-3 shadow ms-sm-auto"
|
||||||
</h6>
|
:class="[props.config.protocol === 'wg' ? 'wireguardBg' : 'amneziawgBg' ]"
|
||||||
<div class="mt-auto">
|
v-if="props.config.protocol === 'wg'">
|
||||||
<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 class="col-sm-6 d-flex flex-column gap-3">
|
|
||||||
<div class="d-flex gap-2">
|
|
||||||
<small class="text-muted">
|
|
||||||
<i class="bi bi-bar-chart-fill me-1"></i> Protocol
|
|
||||||
</small>
|
|
||||||
<span class="badge rounded-3 shadow ms-auto"
|
|
||||||
:class="[props.config.protocol === 'wg' ? 'wireguardBg' : 'amneziawgBg' ]"
|
|
||||||
v-if="props.config.protocol === 'wg'">
|
|
||||||
{{ props.config.protocol === 'wg' ? 'WireGuard': 'AmneziaWG' }}
|
{{ props.config.protocol === 'wg' ? 'WireGuard': 'AmneziaWG' }}
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="d-flex gap-2">
|
<div class="card-body p-3">
|
||||||
<small class="text-muted">
|
<div class="row gy-2 mb-2">
|
||||||
<i class="bi bi-bar-chart-fill me-1"></i> Data Usage
|
<div class="col-sm text-center">
|
||||||
</small>
|
<small class="text-muted mb-2">
|
||||||
<small class="fw-bold flex-grow-1 text-end">
|
<i class="bi bi-bar-chart-fill me-1"></i> Data Usage
|
||||||
3.42 / 4.00 GB
|
</small>
|
||||||
</small>
|
<h6 class="fw-bold ">
|
||||||
</div>
|
3.42 / 4.00 GB
|
||||||
<div class="d-flex gap-2">
|
</h6>
|
||||||
<small class="text-muted">
|
</div>
|
||||||
<i class="bi bi-calendar me-1"></i> Valid Until
|
<div class="col-sm text-center">
|
||||||
</small>
|
<small class="text-muted mb-2">
|
||||||
<small class="fw-bold flex-grow-1 text-end">
|
<i class="bi bi-calendar me-1"></i> Valid Until
|
||||||
2025-08-31 00:00:00
|
</small>
|
||||||
</small>
|
<h6 class="fw-bold ">
|
||||||
</div>
|
3.42 / 4.00 GB
|
||||||
|
</h6>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<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>
|
||||||
<Transition name="app">
|
<Transition name="app">
|
||||||
<ConfigurationQRCode
|
<ConfigurationQRCode
|
||||||
|
@ -43,8 +43,10 @@ if (route.query.Email){
|
|||||||
|
|
||||||
<template>
|
<template>
|
||||||
<div>
|
<div>
|
||||||
<h1>Sign In</h1>
|
<div class="text-center">
|
||||||
<p>to your WGDashboard Client account</p>
|
<h1 class="display-4">Welcome back</h1>
|
||||||
|
<p class="text-muted">Sign in to access your <strong>WGDashboard Client</strong> account</p>
|
||||||
|
</div>
|
||||||
<form class="mt-4 d-flex flex-column gap-3" @submit="e => signIn(e)">
|
<form class="mt-4 d-flex flex-column gap-3" @submit="e => signIn(e)">
|
||||||
<div class="form-floating">
|
<div class="form-floating">
|
||||||
<input type="text"
|
<input type="text"
|
||||||
@ -82,7 +84,7 @@ if (route.query.Email){
|
|||||||
:disabled="!formFilled || loading"
|
:disabled="!formFilled || loading"
|
||||||
class="btn btn-primary rounded-3 btn-body px-3 py-2 fw-bold">
|
class="btn btn-primary rounded-3 btn-body px-3 py-2 fw-bold">
|
||||||
<span v-if="!loading" class="d-block">
|
<span v-if="!loading" class="d-block">
|
||||||
Continue <i class="ms-2 bi bi-arrow-right"></i>
|
Sign In
|
||||||
</span>
|
</span>
|
||||||
<span v-else class="d-block">
|
<span v-else class="d-block">
|
||||||
Loading...<i class="ms-2 spinner-border spinner-border-sm"></i>
|
Loading...<i class="ms-2 spinner-border spinner-border-sm"></i>
|
||||||
@ -96,7 +98,7 @@ if (route.query.Email){
|
|||||||
Don't have an account yet?
|
Don't have an account yet?
|
||||||
</span>
|
</span>
|
||||||
<RouterLink to="/signup"
|
<RouterLink to="/signup"
|
||||||
class="text-body text-decoration-none ms-auto fw-bold btn btn-sm btn-body rounded-3">
|
class="text-body text-decoration-none ms-auto fw-bold btn btn-sm btn-outline-body rounded-3">
|
||||||
Sign Up
|
Sign Up
|
||||||
</RouterLink>
|
</RouterLink>
|
||||||
</div>
|
</div>
|
||||||
|
@ -76,7 +76,7 @@ watch(formFilled, () => {
|
|||||||
<template>
|
<template>
|
||||||
<form class="d-flex flex-column gap-3" @submit="e => verify(e)">
|
<form class="d-flex flex-column gap-3" @submit="e => verify(e)">
|
||||||
<div>
|
<div>
|
||||||
<a role="button" @click="emits('clearToken')" class="btn btn-body btn-sm rounded-3">
|
<a role="button" @click="emits('clearToken')" class="btn btn-outline-body btn-sm rounded-3">
|
||||||
<i class="me-2 bi bi-chevron-left"></i> Back
|
<i class="me-2 bi bi-chevron-left"></i> Back
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
|
@ -4,6 +4,7 @@ import {v4} from "uuid"
|
|||||||
import dayjs from "dayjs";
|
import dayjs from "dayjs";
|
||||||
import {axiosGet} from "@/utilities/request.js";
|
import {axiosGet} from "@/utilities/request.js";
|
||||||
|
|
||||||
|
|
||||||
export const clientStore = defineStore('clientStore', {
|
export const clientStore = defineStore('clientStore', {
|
||||||
state: () => ({
|
state: () => ({
|
||||||
notifications: [],
|
notifications: [],
|
||||||
@ -35,6 +36,21 @@ export const clientStore = defineStore('clientStore', {
|
|||||||
const data = await axiosGet("/api/configurations")
|
const data = await axiosGet("/api/configurations")
|
||||||
if (data){
|
if (data){
|
||||||
this.configurations = data.data
|
this.configurations = data.data
|
||||||
|
this.configurations.forEach(c => {
|
||||||
|
console.log(
|
||||||
|
c.jobs.sort((x, y) => {
|
||||||
|
if (dayjs(x.CreationDate).isBefore(y.CreationDate)){
|
||||||
|
return 1
|
||||||
|
}else if (dayjs(x.CreationDate).isAfter(y.CreationDate)){
|
||||||
|
return -1
|
||||||
|
}else{
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
)
|
||||||
|
console.log(c.jobs.find(x => x.Field === 'date'))
|
||||||
|
})
|
||||||
}else{
|
}else{
|
||||||
this.newNotification("Failed to fetch configurations", "danger")
|
this.newNotification("Failed to fetch configurations", "danger")
|
||||||
}
|
}
|
||||||
|
@ -69,8 +69,10 @@ onMounted(() => {
|
|||||||
|
|
||||||
<template>
|
<template>
|
||||||
<div class="p-3 p-sm-5">
|
<div class="p-3 p-sm-5">
|
||||||
<h1>Sign Up</h1>
|
<div class="text-center">
|
||||||
<p>to use WGDashboard Client</p>
|
<h1 class="display-4">Hi, nice to meet you</h1>
|
||||||
|
<p class="text-muted">Sign up to use <strong>WGDashboard Client</strong></p>
|
||||||
|
</div>
|
||||||
<form class="mt-4 d-flex flex-column gap-3" @submit="e => signUp(e)">
|
<form class="mt-4 d-flex flex-column gap-3" @submit="e => signUp(e)">
|
||||||
<div class="form-floating">
|
<div class="form-floating">
|
||||||
<input type="text"
|
<input type="text"
|
||||||
@ -86,42 +88,48 @@ onMounted(() => {
|
|||||||
Email
|
Email
|
||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-floating">
|
<div class="row gx-3">
|
||||||
<input type="password"
|
<div class="col-6">
|
||||||
required
|
<div class="form-floating">
|
||||||
:disabled="loading"
|
<input type="password"
|
||||||
v-model="formData.Password"
|
required
|
||||||
name="password"
|
:disabled="loading"
|
||||||
autocomplete="new-password"
|
v-model="formData.Password"
|
||||||
autofocus
|
name="password"
|
||||||
class="form-control rounded-3" id="password" placeholder="password">
|
autocomplete="new-password"
|
||||||
<label for="password" class="d-flex">
|
autofocus
|
||||||
<i class="bi bi-key me-2"></i>
|
class="form-control rounded-3" id="password" placeholder="password">
|
||||||
Password
|
<label for="password" class="d-flex">
|
||||||
</label>
|
<i class="bi bi-key me-2"></i>
|
||||||
</div>
|
Password
|
||||||
<div class="form-floating">
|
</label>
|
||||||
<input type="password"
|
</div>
|
||||||
required
|
</div>
|
||||||
:disabled="loading"
|
<div class="col-6">
|
||||||
v-model="formData.ConfirmPassword"
|
<div class="form-floating">
|
||||||
name="confirm_password"
|
<input type="password"
|
||||||
autocomplete="new-password"
|
required
|
||||||
autofocus
|
:disabled="loading"
|
||||||
class="form-control rounded-3" id="confirm_password" placeholder="confirm_password">
|
v-model="formData.ConfirmPassword"
|
||||||
<label for="confirm_password" class="d-flex">
|
name="confirm_password"
|
||||||
<i class="bi bi-key me-2"></i>
|
autocomplete="new-password"
|
||||||
Confirm Password
|
autofocus
|
||||||
</label>
|
class="form-control rounded-3" id="confirm_password" placeholder="confirm_password">
|
||||||
<div id="validationServer03Feedback" class="invalid-feedback">
|
<label for="confirm_password" class="d-flex">
|
||||||
Passwords does not match
|
<i class="bi bi-key me-2"></i>
|
||||||
|
Confirm Password
|
||||||
|
</label>
|
||||||
|
<div id="validationServer03Feedback" class="invalid-feedback">
|
||||||
|
Passwords does not match
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<button
|
<button
|
||||||
:disabled="!formFilled || !validatePassword || loading"
|
:disabled="!formFilled || !validatePassword || loading"
|
||||||
class=" btn btn-primary rounded-3 btn-brand px-3 py-2">
|
class=" btn btn-primary rounded-3 btn-body px-3 py-2 fw-bold">
|
||||||
<span v-if="!loading" class="d-block">
|
<span v-if="!loading" class="d-block">
|
||||||
Continue <i class="ms-2 bi bi-arrow-right"></i>
|
Continue <i class="ms-2 bi bi-arrow-right"></i>
|
||||||
</span>
|
</span>
|
||||||
@ -137,7 +145,7 @@ onMounted(() => {
|
|||||||
<span class="text-muted">
|
<span class="text-muted">
|
||||||
Already have an account?
|
Already have an account?
|
||||||
</span>
|
</span>
|
||||||
<RouterLink to="/signin" class="text-body text-decoration-none ms-auto fw-bold btn btn-sm btn-body rounded-3">
|
<RouterLink to="/signin" class="text-body text-decoration-none ms-auto fw-bold btn btn-sm btn-outline-body rounded-3">
|
||||||
Sign In
|
Sign In
|
||||||
</RouterLink>
|
</RouterLink>
|
||||||
</div>
|
</div>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user