From 087a9fb05507699868c11ffc5b9a5a744ea7e98a Mon Sep 17 00:00:00 2001 From: Brandon Cornejo Date: Wed, 9 Dec 2020 20:55:29 -0600 Subject: [PATCH] Wiki page --- acks/__init__.py | 4 ++++ acks/quest/views.py | 4 ++++ acks/templates/base.html | 2 +- acks/templates/wiki.html | 34 ++++++++++++++++++++++++++++++++++ acks/views.py | 10 +++++++++- 5 files changed, 52 insertions(+), 2 deletions(-) create mode 100644 acks/templates/wiki.html diff --git a/acks/__init__.py b/acks/__init__.py index 7953ce2..cc74e81 100644 --- a/acks/__init__.py +++ b/acks/__init__.py @@ -13,6 +13,10 @@ def create_app(): app.config['SQLALCHEMY_TRACK_MODIFICATIONS'] = False db.init_app(app) + # Prep basic auth + from acks.views import basic_auth + basic_auth.init_app(app) + # Load our views from acks.views import default_views app.register_blueprint(default_views) diff --git a/acks/quest/views.py b/acks/quest/views.py index a1cce18..35642fe 100644 --- a/acks/quest/views.py +++ b/acks/quest/views.py @@ -7,6 +7,7 @@ from flask import ( Blueprint ) +from acks.views import basic_auth from .quest_manager import ( load_quests, get_quest_details, @@ -22,16 +23,19 @@ quest_views = Blueprint( ) @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) diff --git a/acks/templates/base.html b/acks/templates/base.html index 534d9f1..357ed7a 100644 --- a/acks/templates/base.html +++ b/acks/templates/base.html @@ -6,7 +6,7 @@ ('.header', 'other', 'Other'), ('/npc/spells', 'spells', 'Spells'), ('/quest/list', 'questlist', 'Quests'), - ('/api/schema', 'api', 'API'), + ('/wiki', 'wiki', 'Wiki'), ] %} {% set generation_bar = [ ('/npc/party', 'npcparty', 'NPC Party'), diff --git a/acks/templates/wiki.html b/acks/templates/wiki.html new file mode 100644 index 0000000..df1cbe1 --- /dev/null +++ b/acks/templates/wiki.html @@ -0,0 +1,34 @@ +{% extends "base.html" %} +{% set active_page = "wiki" %} + +{% block title %}ACKS Judge Wiki{% endblock %} +{% block content %} +
+

Adventurer Conqueror KingWiki

+
+
+ +
+{% endblock %} + +{% block head %} + +{% endblock %} diff --git a/acks/views.py b/acks/views.py index b9fbe2d..2272a3b 100644 --- a/acks/views.py +++ b/acks/views.py @@ -1,6 +1,9 @@ -from flask import current_app, Blueprint, render_template, url_for, redirect +from flask import Blueprint, render_template, url_for, redirect +from flask_basicauth import BasicAuth + +basic_auth = BasicAuth() default_views = Blueprint('default_views', __name__, url_prefix='/') @default_views.route('/') @@ -11,6 +14,11 @@ def index(): def handbook(): return render_template('handbook.html') +@default_views.route('/wiki') +@basic_auth.required +def wiki(): + return render_template('wiki.html') + @default_views.route('/worldmap') def worldmap(): return render_template('worldmap.html')