2021-05-04 01:32:34 -04:00
< html >
2021-08-14 23:30:05 -04:00
{% with %}
{% set title="Settings" %}
2021-09-08 12:39:25 -04:00
{% include "header.html" %}
2021-08-14 23:30:05 -04:00
{% endwith %}
2021-08-14 17:13:16 -04:00
< body >
{% include "navbar.html" %}
< div class = "container-fluid" >
{% include "sidebar.html" %}
< main role = "main" class = "col-md-9 ml-sm-auto col-lg-10 px-md-4" >
< div class = "setting-container mt-4" >
{% if message != "" %}
< div class = "alert alert-{{ status }}" role = "alert" >
{{ message }}
</ div >
{% endif %}
2021-09-08 12:39:25 -04:00
< h1 class = "" > Settings</ h1 >
< hr >
2021-08-14 17:13:16 -04:00
{% if required_auth == "true" %}
2021-09-08 12:39:25 -04:00
< div class = "card mb-3" >
< h6 class = "card-header" > Peer Default Settings</ h6 >
< div class = "card-body" >
< form action = "/update_peer_default_config" method = "post" >
< div class = "form-group" >
< div class = "row" >
< div class = "col-sm-6" >
< label for = "peer_global_DNS" > DNS</ label >
< input type = "text" class = "form-control mb-4" id = "peer_global_DNS"
name = "peer_global_DNS"
value = "{{ peer_global_DNS }}" required >
</ div >
< div class = "col-sm-6" >
< label for = "peer_endpoint_allowed_ip" > Peer Endpoint Allowed IPs</ label >
< input type = "text" class = "form-control mb-4" id = "peer_endpoint_allowed_ip"
name = "peer_endpoint_allowed_ip"
value = "{{ peer_endpoint_allowed_ip }}" required >
</ div >
< div class = "col-sm-6" >
< label for = "peer_mtu" > MTU</ label >
< input type = "text" class = "form-control mb-4" id = "peer_mtu"
name = "peer_mtu"
value = "{{ peer_mtu }}" >
</ div >
< div class = "col-sm-6" >
< label for = "peer_keep_alive" > Persistent Keepalive</ label >
< input type = "text" class = "form-control mb-4" id = "peer_keep_alive"
name = "peer_keep_alive"
value = "{{ peer_keepalive }}" >
</ div >
< div class = "col-sm-12" >
< label for = "peer_remote_endpoint" >< strong > Peer Remote Endpoint (This will be change globally, and will be apply to all peer's QR code and configuration file.)</ strong ></ label >
< input type = "text" class = "form-control mb-4" id = "peer_remote_endpoint"
name = "peer_remote_endpoint"
value = "{{ peer_remote_endpoint }}" required >
</ div >
</ div >
< button class = "btn btn-success" type = "submit" > Update Peer Default Settings</ button >
2021-08-14 17:13:16 -04:00
</ div >
2021-09-08 12:39:25 -04:00
</ form >
2021-08-14 17:13:16 -04:00
</ div >
2021-05-04 01:32:34 -04:00
</ div >
2021-09-08 12:39:25 -04:00
< hr >
< div class = "card mb-3" >
< h6 class = "card-header" > WireGuard Configuration Path</ h6 >
< div class = "card-body" >
< form action = "/update_wg_conf_path" method = "post" class = "update_wg_conf_path" >
< div class = "form-group" >
< label for = "wg_conf_path" > Path</ label >
< input type = "text" class = "form-control mb-2" id = "wg_conf_path" name = "wg_conf_path"
value = "{{ wg_conf_path }}" >
< p class = "text-muted" > Remember to remove < code > /</ code > at the end of your path. e.g < code > /etc/wireguard</ code >
</ p >
< button class = "btn btn-danger change_path" > Update Path & Restart Dashboard</ button >
</ div >
</ form >
</ div >
</ div >
< div class = "card mb-3" >
< h6 class = "card-header" > Account</ h6 >
< div class = "card-body" >
< form action = "/update_acct" method = "post" >
< div class = "form-group" >
< label for = "username" > Username</ label >
< input type = "text" class = "form-control mb-4" id = "username" name = "username"
value = "{{ session['username'] }}" required >
< button type = "submit" class = "btn btn-danger" > Update Account</ button >
</ div >
</ form >
</ div >
</ div >
< div class = "card mb-3" >
< h6 class = "card-header" > Security</ h6 >
< div class = "card-body" >
< form action = "/update_pwd" method = "post" >
< div class = "form-group" >
< label for = "currentpass" > Current Password</ label >
< input type = "password" class = "form-control mb-2" id = "currentpass" name = "currentpass" >
< label for = "newpass" > New Password</ label >
< input type = "password" class = "form-control mb-2" id = "newpass" name = "newpass" >
< label for = "repnewpass" > Repeat New Password</ label >
< input type = "password" class = "form-control mb-4" id = "repnewpass" name = "repnewpass" >
< button type = "submit" class = "btn btn-danger" > Update Password</ button >
</ div >
</ form >
</ div >
</ div >
{% endif %}
< div class = "card" >
< h6 class = "card-header" > Dashboard Configuration</ h6 >
< div class = "card-body" >
< form action = "/update_app_ip_port" method = "post" class = "update_app_ip_port" >
< div class = "form-group" >
< div class = "row" >
< div class = "col-sm" >
< label for = "app_ip" > Dashboard IP</ label >
< input type = "text" class = "form-control mb-2" id = "app_ip" name = "app_ip" value = "{{ app_ip }}" >
< p >< small class = "text-danger mb-4" > 0.0.0.0 means it can be access by anyone with your server
IP Address.</ small ></ p >
</ div >
< div class = "col-sm" >
< label for = "app_port" > Dashboard Port</ label >
< input type = "text" class = "form-control mb-4" id = "app_port" name = "app_port"
value = "{{ app_port }}" >
</ div >
</ div >
< button type = "button" class = "btn btn-danger confirm_modal" data-toggle = "modal"
data-target = "#confirmModal" > Update Configuration & Restart Dashboard
</ button >
</ div >
</ form >
</ div >
</ div >
2021-08-14 17:13:16 -04:00
</ div >
</ main >
<!-- Modal -->
< div class = "modal fade" id = "confirmModal" data-backdrop = "static" data-keyboard = "false" tabindex = "-1"
aria-labelledby = "staticBackdropLabel" aria-hidden = "true" >
< div class = "modal-dialog" >
< div class = "modal-content" >
< div class = "modal-header" >
2021-05-04 01:32:34 -04:00
< h5 class = "modal-title" id = "staticBackdropLabel" > Confirm Dashboard Configuration</ h5 >
2021-08-14 17:13:16 -04:00
</ div >
< div class = "modal-body" >
2021-05-04 01:32:34 -04:00
< small > Dashboard Original IP</ small >
< p > {{ app_ip }}</ p >
< small style = "font-weight: bold" class = "text-bold" > Dashboard New IP</ small >
< p class = "app_new_ip text-bold text-danger" style = "font-weight: bold" ></ p >
< small > Dashboard Original Port</ small >
< p > {{ app_port }}</ p >
< small style = "font-weight: bold" class = "text-bold" > Dashboard New Port</ small >
< p class = "app_new_port text-bold text-danger" style = "font-weight: bold" ></ p >
2021-08-14 17:13:16 -04:00
</ div >
< div class = "modal-footer" >
2021-05-04 01:32:34 -04:00
< button type = "button" class = "btn btn-secondary cancel_restart" data-dismiss = "modal" > Cancel</ button >
< button type = "button" class = "btn btn-danger confirm_restart" > Confirm & Restart Dashboard</ button >
</ div >
</ div >
</ div >
2021-08-14 17:13:16 -04:00
</ div >
</ div >
2021-08-24 20:15:28 -04:00
{% include "tools.html" %}
2021-08-14 17:13:16 -04:00
</ body >
2021-08-24 20:15:28 -04:00
2021-05-04 01:32:34 -04:00
{% include "footer.html" %}
< script >
$ ( ".sb-settings-url" ). addClass ( "active" )
2021-08-14 17:13:16 -04:00
$ ( ".confirm_modal" ). click ( function () {
2021-05-04 01:32:34 -04:00
$ ( ".app_new_ip" ). html ( $ ( "#app_ip" )[ 0 ]. value )
$ ( ".app_new_port" ). html ( $ ( "#app_port" )[ 0 ]. value )
})
2021-08-14 17:13:16 -04:00
$ ( ".confirm_restart" ). click ( function () {
2021-05-04 01:32:34 -04:00
$ ( ".cancel_restart" ). remove ()
countdown = 7 ;
$ . post ( '/update_app_ip_port' , $ ( '.update_app_ip_port' ). serialize ())
2021-08-14 17:13:16 -04:00
url = $ ( "#app_ip" )[ 0 ]. value + ":" + $ ( "#app_port" )[ 0 ]. value ;
2021-05-04 01:32:34 -04:00
$ ( ".confirm_restart" ). attr ( "disabled" , "disabled" )
2021-08-14 17:13:16 -04:00
setInterval ( function () {
if ( countdown === 0 ) {
window . location . replace ( "http://" + url );
2021-05-04 01:32:34 -04:00
}
2021-08-14 17:13:16 -04:00
$ ( ".confirm_restart" ). html ( "Redirecting you in " + countdown + " seconds." )
2021-05-04 01:32:34 -04:00
countdown -- ;
2021-08-14 17:13:16 -04:00
}, 1000 )
2021-05-04 21:26:40 -04:00
});
2021-08-14 17:13:16 -04:00
$ ( ".change_path" ). click ( function () {
2021-05-04 21:26:40 -04:00
$ ( this ). attr ( "disabled" , "disabled" );
countdown = 5 ;
2021-08-14 17:13:16 -04:00
setInterval ( function () {
if ( countdown === 0 ) {
2021-05-04 21:26:40 -04:00
location . reload ()
}
2021-08-14 17:13:16 -04:00
$ ( ".change_path" ). html ( "Redirecting you in " + countdown + " seconds." )
2021-05-04 21:26:40 -04:00
countdown -- ;
2021-08-14 17:13:16 -04:00
}, 1000 )
2021-05-04 21:26:40 -04:00
$ . post ( '/update_wg_conf_path' , $ ( '.update_wg_conf_path' ). serialize ())
});
2021-05-04 01:32:34 -04:00
</ script >
</ html >