Compare commits

..

3 Commits

3 changed files with 5 additions and 41 deletions

View File

@ -118,7 +118,7 @@ def logout():
flash("bye binch", 'info') flash("bye binch", 'info')
return redirect(url_for('login')) return redirect(url_for('login'))
@app.route('/upload', methods=['GET', 'POST']) @app.route('/upload/', methods=['GET', 'POST'])
@app.route('/upload/<path:path>', methods=['GET', 'POST']) @app.route('/upload/<path:path>', methods=['GET', 'POST'])
@login_required @login_required
def upload(path=None): def upload(path=None):
@ -129,6 +129,9 @@ def upload(path=None):
if not is_secure_path(os.path.join(app.config['SERVE_DIR'], path)): if not is_secure_path(os.path.join(app.config['SERVE_DIR'], path)):
abort(400) abort(400)
if not os.path.exists(os.path.join(app.config['SERVE_DIR'], path)):
abort(404)
if request.method == 'GET': if request.method == 'GET':
return render_template('upload.html') return render_template('upload.html')
else: else:

View File

@ -1,39 +0,0 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, minimum-scale=1, initial-scale=1, user-scalable=yes">
<title>it's not piracy i swear</title>
<meta name="description" content="ftp but worse">
<link href="/static/style.css" type="text/css" rel="stylesheet" />
</head>
<body>
<div id="mainwrapper">
<div id="contentarea">
{% for file, size in files %}
<a class="nostyle itemwrapper" href="/files/{{ file }}" download>
<div class="item">
<p class="item-name">{{ file }}</p>
<p class="item-size">{{ size }}</p>
</div>
</a>
{% else %}
<p id="nofileshead">
It's fucking nothing!
</p>
<p id="nofilesdisc">
No files avalible yet. Come back later, eh?
</p>
{% endfor %}
</div>
</div>
<div id="waifuwrapper">
<img id="waifu-lazyflexhack" src="/static/obligitorywaifu.png"></img>
<!-- <div id="waifu-spacesaver"></div> -->
</div>
<img id="waifu" src="/static/obligitorywaifu.png"></img>
</body>
</html>

View File

@ -25,7 +25,7 @@
<i class="material-icons">person_add</i> <i class="material-icons">person_add</i>
</a> </a>
{% endif %} {% endif %}
{% if current_user.can_upload and path is not none %} {% if current_user.can_upload and path is defined %}
<a class="nostyle iconbutton" href="{{ url_for('upload', path=path) }}" title="Upload to current directory"> <a class="nostyle iconbutton" href="{{ url_for('upload', path=path) }}" title="Upload to current directory">
<i class="material-icons">cloud_upload</i> <i class="material-icons">cloud_upload</i>
</a> </a>