File tree Expand file tree Collapse file tree 2 files changed +13
-0
lines changed
Expand file tree Collapse file tree 2 files changed +13
-0
lines changed Original file line number Diff line number Diff line change 33from flask_login import login_required , current_user
44from auth import app
55import requests
6+ from io import BytesIO
7+ from werkzeug .wsgi import FileWrapper
68
79@app .route ('/' )
810# @login_required
@@ -63,6 +65,13 @@ def uploadpage():
6365 print ("api offline" )
6466 return flask .render_template ('upload.html' , title = 'Devcade - Upload' , gamelist = usergames )
6567
68+ @app .route ('/download/<id>' )
69+ def download (id ):
70+ r = requests .get (app .config ["DEVCADE_API_URI" ] + "games/download/" + id , stream = True )
71+ b = BytesIO (r .content )
72+ game = FileWrapper (b )
73+ return flask .Response (game , mimetype = "application/zip" , direct_passthrough = True )
74+
6675@app .route ('/admin/delete/<id>' )
6776@login_required
6877def deleteGame (id ):
Original file line number Diff line number Diff line change 11{% extends "header.html" %} {% block title %}Devcade - {{game.name}}
22{%endblock %} {% block content %}
33< div class ="card-wrapper "> {{ gamecard(game) }}</ div >
4+ < div class ="card-wrapper ">
5+ < a class ="btn btn-red " href ="/download/{{ game.id }} "> Download Game</ a >
6+ </ div >
47{% if current_user.admin or current_user.id == game.author %}
8+ < h2 > Admin stuff:</ h2 >
59< div class ="card-wrapper ">
610 < a class ="btn btn-red " href ="/edit/{{ game.id }} "> Edit</ a >
711 < a class ="btn btn-red " href ="/admin/delete/{{ game.id }} "> Delete</ a >
You can’t perform that action at this time.
0 commit comments