from flask import ( request, jsonify, current_app, render_template, send_file, Blueprint ) from acks.views import basic_auth from .quest_manager import ( load_quests, get_quest_details, get_quest_archive ) quest_views = Blueprint( 'quest_manager', __name__, template_folder='templates', url_prefix='/quest' ) @quest_views.route('/list') @basic_auth.required def quest_list(): quests = load_quests() return render_template('quest_list.html', quest_map=quests) @quest_views.route('/detail//') @basic_auth.required def quest_detail(level, quest_name): quest = get_quest_details(level, quest_name) return render_template('quest_detail.html', quest=quest) @quest_views.route('/detail///download') @basic_auth.required def quest_download(level, quest_name): archive = get_quest_archive(level, quest_name) return send_file(archive, attachment_filename="acks_{0}.zip".format(quest_name), as_attachment=True)