diff --git a/web/templates/vpn/index.html b/web/templates/vpn/index.html index 1ad5b99..2b38e21 100644 --- a/web/templates/vpn/index.html +++ b/web/templates/vpn/index.html @@ -30,7 +30,7 @@ Nastavitve shranite (kot skrbnik) v /etc/wireguard/wg-fri.conf. VPN Vnesite poljubno oznako in kliknite Ustvari ključ. Če vklopite prvo opcijo, bo vaš računalnik čez VPN usmeril ves mrežni promet, ne le tistega, ki je namenjen strežnikom na FRI. Če izklopite drugo opcijo, bodo nekatere storitve dostopne le prek naslova IP. Če ste v dvomih, pustite privzete nastavitve.

- +
@@ -112,7 +112,7 @@ function fetch_keys() { li.innerHTML = ' ' + (new Date(key.time*1000).toISOString().split('T')[0]) + ' ' + key.key + '' + (key.active ? ' ' : ' ') + - key.comment; + key.name; li.prepend(a); keys.appendChild(li); if (key.active) @@ -128,7 +128,7 @@ window.addEventListener('load', fetch_keys); const request = document.getElementById('request'); request.addEventListener('submit', event => { event.preventDefault(); - const comment = document.getElementById('comment'); + const name = document.getElementById('name'); const key = wireguard.generateKeypair(); const settings = document.getElementById('settings'); const submit = document.getElementById('submit'); @@ -143,7 +143,7 @@ request.addEventListener('submit', event => { headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ pubkey: key.publicKey, - comment: comment.value, + name: name.value, use_dns: use_dns.checked, add_default: add_default.checked, }) diff --git a/web/templates/vpn/wg-fri.conf b/web/templates/vpn/wg-fri.conf index bbc86a1..cb294e3 100644 --- a/web/templates/vpn/wg-fri.conf +++ b/web/templates/vpn/wg-fri.conf @@ -1,5 +1,5 @@ [Interface] -# {{ timestamp }} {{ current_user['username'] }} {{ comment }} +# {{ timestamp }} {{ current_user['username'] }} {{ name }} # PublicKey = {{ pubkey }} PrivateKey = # paste private key here Address = {{ ip }} diff --git a/web/vpn.py b/web/vpn.py index d3a1521..7212de7 100644 --- a/web/vpn.py +++ b/web/vpn.py @@ -49,13 +49,13 @@ def new(): else: return flask.Response('no more available IP addresses', status=500, mimetype='text/plain') now = datetime.datetime.utcnow() - comment = re.sub('[^\w ]', '', flask.request.json.get('comment', '')) + name = re.sub('[^\w ]', '', flask.request.json.get('name', '')) ips[str(ip)] = { 'key': pubkey, 'time': now.timestamp(), 'user': flask_login.current_user.get_id(), - 'comment': comment, + 'name': name, } db.write('wireguard', ips) @@ -70,7 +70,7 @@ def new(): 'pubkey': pubkey, 'ip': str(ip), 'timestamp': now, - 'comment': comment, + 'name': name, 'add_default': flask.request.json.get('add_default', False), 'use_dns': flask.request.json.get('use_dns', True), }