import os 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('/') def index(): return render_template('index.html') @default_views.route('/handbook') 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') @default_views.route('/lairs') def lair_gallery(): base_path = "/srv/www/atr0phy.net/acks/img/dynamic_lairs/" base_url = "https://www.atr0phy.net/acks/img/dynamic_lairs/" animal_lairs = [] for filename in os.listdir(base_path + "animal/"): animal_lairs.append(base_url + "animal/" + filename) humanoid_lairs = [] for filename in os.listdir(base_path + "humanoid/"): humanoid_lairs.append(base_url + "humanoid/" + filename) return render_template('lair_gallery.html', animal=animal_lairs, humanoid=humanoid_lairs)