mirror of
https://github.com/donaldzou/WGDashboard.git
synced 2025-09-08 04:31:14 +00:00
Commit
This commit is contained in:
@@ -108,13 +108,7 @@
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
<script src="https://code.jquery.com/jquery-3.5.1.min.js" integrity="sha256-9/aliU8dGd2tb6OSsuzixeV4y/faTqgFtohetphbbj0=" crossorigin="anonymous"></script>
|
||||
<script src="https://cdn.jsdelivr.net/npm/popper.js@1.16.1/dist/umd/popper.min.js"
|
||||
integrity="sha384-9/reFTGAW83EW2RDu2S0VKaIzap3H66lZH81PoYlFhbGU+6BZp6G7niu735Sk7lN"
|
||||
crossorigin="anonymous"></script>
|
||||
<script src="https://cdn.jsdelivr.net/npm/bootstrap@4.5.3/dist/js/bootstrap.min.js"
|
||||
integrity="sha384-w1Q4orYjBQndcko6MimVbzY0tgp4pWB4lZ7lr30WKz0vr/aWKhXdBNmNb5D92v7s"
|
||||
crossorigin="anonymous"></script>
|
||||
{% include "footer.html" %}
|
||||
<script>
|
||||
$(".sb-{{conf_data['name']}}-url").addClass("active");
|
||||
|
||||
@@ -129,11 +123,6 @@
|
||||
async:false,
|
||||
success: function (response){
|
||||
$("#config_body").html(response);
|
||||
$.ajax({
|
||||
url: "{{ url_for('static',filename='bootstrap4-toggle.min.js') }}",
|
||||
dataType: "script",
|
||||
cache: true
|
||||
});
|
||||
}
|
||||
})
|
||||
}
|
||||
@@ -146,19 +135,14 @@
|
||||
</script>
|
||||
<script>
|
||||
$("body").on("click", ".switch", function (){
|
||||
if ($(this).prop('checked') === true){
|
||||
if (confirm('Are you sure you want to turn off this connection?')){
|
||||
location.replace("/switch/"+$(this).attr('id'))
|
||||
}
|
||||
}
|
||||
else{
|
||||
location.replace("/switch/"+$(this).attr('id'))
|
||||
}
|
||||
$(this).siblings($(".spinner-border")).css("display", "inline-block");
|
||||
$(this).remove()
|
||||
location.replace("/switch/"+$(this).attr('id'));
|
||||
})
|
||||
|
||||
$("#save_peer").click(function(){
|
||||
if ($("#allowed_ips") != "" && $("#public_key") != ""){
|
||||
var conf = $(this).attr('conf_id')
|
||||
|
||||
$.ajax({
|
||||
method: "POST",
|
||||
url: "/add_peer/"+conf,
|
||||
|
@@ -5,16 +5,4 @@
|
||||
crossorigin="anonymous"></script>
|
||||
<script src="https://cdn.jsdelivr.net/npm/bootstrap@4.5.3/dist/js/bootstrap.min.js"
|
||||
integrity="sha384-w1Q4orYjBQndcko6MimVbzY0tgp4pWB4lZ7lr30WKz0vr/aWKhXdBNmNb5D92v7s"
|
||||
crossorigin="anonymous"></script>
|
||||
<script src="https://cdn.jsdelivr.net/gh/gitbrent/bootstrap4-toggle@3.6.1/js/bootstrap4-toggle.min.js"></script>
|
||||
<script>
|
||||
$.ajax({
|
||||
method: "GET",
|
||||
url: "/check_update_dashboard",
|
||||
success: function (response){
|
||||
if (response === "true"){
|
||||
$(".sb-update-url").append("<span class=\"dot dot-running\"></span>")
|
||||
}
|
||||
}
|
||||
})
|
||||
</script>
|
||||
crossorigin="anonymous"></script>
|
@@ -1,26 +1,27 @@
|
||||
<main role="main" class="col-md-9 ml-sm-auto col-lg-10 px-md-4 mt-4">
|
||||
<div class="info mt-4">
|
||||
<div class="row">
|
||||
<div class="col-sm">
|
||||
<div class="col">
|
||||
<small class="text-muted"><strong>CONFIGURATION</strong></small>
|
||||
<h1 class="mb-3">{{conf_data['name']}}</h1>
|
||||
</div>
|
||||
<div class="col-sm">
|
||||
<div class="col">
|
||||
<small class="text-muted"><strong>ACTION</strong></small><br>
|
||||
{# <input class="mt-2 switch" id="{{conf_data['name']}}" type="checkbox" data-toggle="toggle" {{conf_data['checked']}} data-size="sm">#}
|
||||
|
||||
{% if conf_data['checked'] == "checked" %}
|
||||
<a href="#" id="{{conf_data['name']}}" {{conf_data['checked']}} class="switch text-primary"><i class="bi bi-toggle2-on"></i> ON</a>
|
||||
{% else %}
|
||||
<a href="#" id="{{conf_data['name']}}" {{conf_data['checked']}} class="switch text-secondary"><i class="bi bi-toggle2-off"></i> OFF</a>
|
||||
{% endif %}
|
||||
<div class="spinner-border text-primary" role="status" style="display: none; margin-top: 10px">
|
||||
<span class="sr-only">Loading...</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="w-100"></div>
|
||||
<div class="col-sm">
|
||||
<div class="col">
|
||||
<small class="text-muted"><strong>STATUS</strong></small>
|
||||
<h6 style="text-transform: uppercase;">{{conf_data['status']}}<span class="dot dot-{{conf_data['status']}}"></span></h6>
|
||||
</div>
|
||||
<div class="col-sm">
|
||||
<div class="col">
|
||||
<small class="text-muted"><strong>CONNECTED PEERS</strong></small>
|
||||
<h6 style="text-transform: uppercase;">{{conf_data['running_peer']}}</h6>
|
||||
</div>
|
||||
|
@@ -5,6 +5,7 @@
|
||||
<div class="container-fluid">
|
||||
{% include "sidebar.html" %}
|
||||
<main role="main" class="col-md-9 ml-sm-auto col-lg-10 px-md-4">
|
||||
<h1 class="pb-4 mt-4">Home</h1>
|
||||
{% for i in conf%}
|
||||
<div class="card mt-3">
|
||||
<div class="card-body">
|
||||
@@ -25,10 +26,13 @@
|
||||
</div>
|
||||
<div class="col-md">
|
||||
{% if i['checked'] == "checked" %}
|
||||
<a href="#" id="{{i['conf']}}" {{i['checked']}} class="switch text-primary"><i class="bi bi-toggle2-on"></i></a>
|
||||
<a href="#" id="{{i['conf']}}" {{i['checked']}} class="switch text-primary tt"><i class="bi bi-toggle2-on"></i></a>
|
||||
{% else %}
|
||||
<a href="#" id="{{i['conf']}}" {{i['checked']}} class="switch text-secondary"><i class="bi bi-toggle2-off"></i></a>
|
||||
{% endif %}
|
||||
<div class="spinner-border text-primary" role="status" style="display: none">
|
||||
<span class="sr-only">Loading...</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@@ -40,6 +44,8 @@
|
||||
{% include "footer.html" %}
|
||||
<script>
|
||||
$('.switch').click(function() {
|
||||
$(this).siblings($(".spinner-border")).css("display", "inline-block")
|
||||
$(this).remove()
|
||||
location.replace("/switch/"+$(this).attr('id'))
|
||||
});
|
||||
$(".sb-home-url").addClass("active")
|
||||
|
@@ -22,6 +22,15 @@
|
||||
</div>
|
||||
</form>
|
||||
<hr>
|
||||
<h3>WireGuard Configuration Path</h3>
|
||||
<form action="/update_wg_conf_path" method="post" class="update_wg_conf_path">
|
||||
<div class="form-group">
|
||||
<label for="username">Path</label>
|
||||
<input type="text" class="form-control mb-4" id="wg_conf_path" name="wg_conf_path" value="{{ wg_conf_path }}">
|
||||
<button class="btn btn-danger change_path">Update Path & Restart Dashboard</button>
|
||||
</div>
|
||||
</form>
|
||||
<hr>
|
||||
<h3>Security</h3>
|
||||
<form action="/update_pwd", method="post">
|
||||
<div class="form-group">
|
||||
@@ -102,6 +111,21 @@
|
||||
$(".confirm_restart").html("Redirecting you in "+countdown+" seconds.")
|
||||
countdown--;
|
||||
},1000)
|
||||
})
|
||||
});
|
||||
|
||||
$(".change_path").click(function (){
|
||||
$(this).attr("disabled", "disabled");
|
||||
countdown = 5;
|
||||
setInterval(function (){
|
||||
if (countdown === 0){
|
||||
location.reload()
|
||||
}
|
||||
$(".change_path").html("Redirecting you in "+countdown+" seconds.")
|
||||
countdown--;
|
||||
},1000)
|
||||
$.post('/update_wg_conf_path', $('.update_wg_conf_path').serialize())
|
||||
|
||||
});
|
||||
|
||||
</script>
|
||||
</html>
|
@@ -7,7 +7,9 @@
|
||||
{% if "username" in session %}
|
||||
<li class="nav-item"><a class="nav-link sb-settings-url" href="/settings">Settings</a></li>
|
||||
{% endif %}
|
||||
<li class="nav-item"><a class="nav-link sb-update-url" href="/">Check Update</a></li>
|
||||
{% if session['update'] == "true" %}
|
||||
<li class="nav-item sb-update-li"><a class="nav-link sb-update-url" href="/">New Update Available!<span class="dot dot-running"></span></a></li>
|
||||
{% endif %}
|
||||
</ul>
|
||||
<hr>
|
||||
<h6 class="sidebar-heading d-flex justify-content-between align-items-center px-3 mt-4 mb-1 text-muted">
|
||||
@@ -24,6 +26,9 @@
|
||||
<li class="nav-item"><a class="nav-link text-danger" href="/signout" style="font-weight: bold">Sign Out</a></li>
|
||||
</ul>
|
||||
{% endif %}
|
||||
<ul class="nav flex-column">
|
||||
<li class="nav-item"><a href="https://github.com/donaldzou/wireguard-dashboard"><small class="nav-link text-muted">{{ session['dashboard_version'] }}</small></a></li>
|
||||
</ul>
|
||||
</div>
|
||||
</nav>
|
||||
</div>
|
||||
|
Reference in New Issue
Block a user