dodanie pobierania klucza publicznego

This commit is contained in:
Mateusz779 2023-04-25 09:21:53 +02:00
parent fe6ff3ecbf
commit b39f94aa5f
2 changed files with 16 additions and 0 deletions

10
app.py
View File

@ -155,6 +155,16 @@ def delete(image_id):
return redirect(url_for('list_images'))
@app.route('/download_key/<int:image_id>', methods=['POST'])
@login_required
def download_key(image_id):
filename = db.get_conf_image_id(image_id)
return send_file(os.path.join(
app.config['UPLOAD_FOLDER'], filename.split(".")[0]+".pub"))
@app.route("/api/getconf")
def get_image():
try:

View File

@ -13,6 +13,7 @@
<th>Token</th>
<th>Nazwa</th>
<th>IP VPN</th>
<th>Pobierz klucz</th>
<th>Usuń</th>
</tr>
</thead>
@ -22,6 +23,11 @@
<td>{{ image.token }}</td>
<td>{{ image.name }}</td>
<td>{{ image.vpn_ip }}</td>
<td>
<form action="{{ url_for('download_key', image_id=image.id) }}" method="post">
<button type="submit" class="btn">Pobierz</button>
</form>
</td>
<td>
<form action="{{ url_for('delete', image_id=image.id) }}" method="post">
<button type="submit" class="btn btn-danger">Usuń</button>