Return link page to avoid auto-downloads

This commit is contained in:
Dominik V. Salonen 2015-12-25 00:32:58 +01:00
parent b15ae0e47d
commit 2a244fca30
3 changed files with 13 additions and 4 deletions

4
run.py
View File

@ -1,5 +1,5 @@
#!/usr/bin/env python3
from flask import Flask, Response, request, redirect, url_for, send_from_directory, abort, render_template
from flask import Flask, request, redirect, url_for, send_from_directory, abort, render_template
from werkzeug import secure_filename
from threading import Thread
import logging
@ -95,7 +95,7 @@ def upload_file():
try:
if request.form["source"] == "web":
return redirect(url_for('get_file', filename=filename), code=302)
return render_template('link.html', data=data, page=config["SITE_DATA"])
except Exception:
return json.dumps(data)
else:

View File

@ -63,12 +63,12 @@ body {
animation: rise 1s ease-out;
}
.links li a {
.links li a, .fileLink {
color: inherit;
text-decoration: none;
}
.links li a:hover {
.links li a:hover, .fileLink {
text-decoration: underline;
}

9
templates/link.html Normal file
View File

@ -0,0 +1,9 @@
{% extends "shell.html" %}
{% block body %}
<h1 class="title">
Here's your link:
</h1>
<p style="text-align: center;">
<a class="fileLink" href="{{ data.url }}">{{ data.url }}</a>
</p>
{% endblock %}