mirror of
https://github.com/donaldzou/WGDashboard.git
synced 2024-11-22 15:20:09 +01:00
Merge pull request #112 from reafian/main
Added MTU and PersistentKeepalive to QR code and download files
This commit is contained in:
commit
66fc7cd91d
@ -994,7 +994,9 @@ def download(config_name):
|
|||||||
private_key = peer['private_key']
|
private_key = peer['private_key']
|
||||||
allowed_ip = peer['allowed_ip']
|
allowed_ip = peer['allowed_ip']
|
||||||
DNS = peer['DNS']
|
DNS = peer['DNS']
|
||||||
|
MTU = peer['mtu']
|
||||||
endpoint_allowed_ip = peer['endpoint_allowed_ip']
|
endpoint_allowed_ip = peer['endpoint_allowed_ip']
|
||||||
|
keepalive = peer['keepalive']
|
||||||
filename = peer['name']
|
filename = peer['name']
|
||||||
if len(filename) == 0:
|
if len(filename) == 0:
|
||||||
filename = "Untitled_Peers"
|
filename = "Untitled_Peers"
|
||||||
@ -1011,10 +1013,10 @@ def download(config_name):
|
|||||||
filename = "".join(filename.split(' '))
|
filename = "".join(filename.split(' '))
|
||||||
filename = filename + "_" + config_name
|
filename = filename + "_" + config_name
|
||||||
|
|
||||||
def generate(private_key, allowed_ip, DNS, public_key, endpoint):
|
def generate(private_key, allowed_ip, DNS, MTU, public_key, endpoint, keepalive):
|
||||||
yield "[Interface]\nPrivateKey = " + private_key + "\nAddress = " + allowed_ip + "\nDNS = " + DNS + "\n\n[Peer]\nPublicKey = " + public_key + "\nAllowedIPs = "+endpoint_allowed_ip+"\nEndpoint = " + endpoint
|
yield "[Interface]\nPrivateKey = " + private_key + "\nAddress = " + allowed_ip + "\nDNS = " + DNS + "\nMTU = " + MTU + "\n\n[Peer]\nPublicKey = " + public_key + "\nAllowedIPs = " + endpoint_allowed_ip + "\nEndpoint = " + endpoint+ "\nPersistentKeepalive = " + keepalive
|
||||||
|
|
||||||
return app.response_class(generate(private_key, allowed_ip, DNS, public_key, endpoint),
|
return app.response_class(generate(private_key, allowed_ip, DNS, MTU, public_key, endpoint, keepalive),
|
||||||
mimetype='text/conf',
|
mimetype='text/conf',
|
||||||
headers={"Content-Disposition": "attachment;filename=" + filename + ".conf"})
|
headers={"Content-Disposition": "attachment;filename=" + filename + ".conf"})
|
||||||
else:
|
else:
|
||||||
|
@ -182,7 +182,7 @@
|
|||||||
<button type="button" class="btn btn-outline-danger btn-delete-peer btn-control" id="{{i['id']}}" data-toggle="modal"><i class="bi bi-x-circle-fill"></i></button>
|
<button type="button" class="btn btn-outline-danger btn-delete-peer btn-control" id="{{i['id']}}" data-toggle="modal"><i class="bi bi-x-circle-fill"></i></button>
|
||||||
{% if i['private_key'] %}
|
{% if i['private_key'] %}
|
||||||
<div class="share_peer_btn_group" style="margin-left: auto !important; display: inline">
|
<div class="share_peer_btn_group" style="margin-left: auto !important; display: inline">
|
||||||
<button type="button" class="btn btn-outline-success btn-qrcode-peer btn-control" img_src="{{ qrcode("[Interface]\nPrivateKey = "+i['private_key']+"\nAddress = "+i['allowed_ip']+"\nDNS = "+i['DNS']+"\n\n[Peer]\nPublicKey = "+conf_data['public_key']+"\nAllowedIPs = "+i['endpoint_allowed_ip']+"\nEndpoint = "+wg_ip+":"+conf_data['listen_port']) }}">
|
<button type="button" class="btn btn-outline-success btn-qrcode-peer btn-control" img_src="{{ qrcode("[Interface]\nPrivateKey = "+i['private_key']+"\nAddress = "+i['allowed_ip']+"\nMTU = "+i['mtu']+"\nDNS = "+i['DNS']+"\n\n[Peer]\nPublicKey = "+conf_data['public_key']+"\nAllowedIPs = "+i['endpoint_allowed_ip']+"\nPersistentKeepalive = "+i['keepalive']+"\nEndpoint = "+wg_ip+":"+conf_data['listen_port']) }}">
|
||||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" style="width: 19px;" fill="#28a745"><path d="M3 11h8V3H3v8zm2-6h4v4H5V5zM3 21h8v-8H3v8zm2-6h4v4H5v-4zM13 3v8h8V3h-8zm6 6h-4V5h4v4zM13 13h2v2h-2zM15 15h2v2h-2zM13 17h2v2h-2zM17 17h2v2h-2zM19 19h2v2h-2zM15 19h2v2h-2zM17 13h2v2h-2zM19 15h2v2h-2z"/></svg>
|
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" style="width: 19px;" fill="#28a745"><path d="M3 11h8V3H3v8zm2-6h4v4H5V5zM3 21h8v-8H3v8zm2-6h4v4H5v-4zM13 3v8h8V3h-8zm6 6h-4V5h4v4zM13 13h2v2h-2zM15 15h2v2h-2zM13 17h2v2h-2zM17 17h2v2h-2zM19 19h2v2h-2zM15 19h2v2h-2zM17 13h2v2h-2zM19 15h2v2h-2z"/></svg>
|
||||||
</button>
|
</button>
|
||||||
<a href="/download/{{ conf_data['name'] }}?id={{ i['id']|urlencode }}" class="btn btn-outline-info btn-download-peer btn-control">
|
<a href="/download/{{ conf_data['name'] }}?id={{ i['id']|urlencode }}" class="btn btn-outline-info btn-download-peer btn-control">
|
||||||
|
Loading…
Reference in New Issue
Block a user