You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

41 lines
1.0 KiB

4 years ago
4 years ago
4 years ago
4 years ago
  1. from flask import (
  2. request,
  3. jsonify,
  4. current_app,
  5. render_template,
  6. send_file,
  7. Blueprint
  8. )
  9. from acks.views import basic_auth
  10. from .quest_manager import (
  11. load_quests,
  12. get_quest_details,
  13. get_quest_archive
  14. )
  15. quest_views = Blueprint(
  16. 'quest_manager',
  17. __name__,
  18. template_folder='templates',
  19. url_prefix='/quest'
  20. )
  21. @quest_views.route('/list')
  22. @basic_auth.required
  23. def quest_list():
  24. quests = load_quests()
  25. return render_template('quest_list.html', quest_map=quests)
  26. @quest_views.route('/detail/<int:level>/<string:quest_name>')
  27. @basic_auth.required
  28. def quest_detail(level, quest_name):
  29. quest = get_quest_details(level, quest_name)
  30. return render_template('quest_detail.html', quest=quest)
  31. @quest_views.route('/detail/<int:level>/<string:quest_name>/download')
  32. @basic_auth.required
  33. def quest_download(level, quest_name):
  34. archive = get_quest_archive(level, quest_name)
  35. return send_file(archive, attachment_filename="acks_{0}.zip".format(quest_name), as_attachment=True)