Moving themes into a themes folder (#287)

* Moving themes into a themes folder

This unifies themes under a themes folder which makes it easier to develop themes and install them.
This commit is contained in:
Kevin Chung
2017-06-18 02:13:50 -04:00
committed by GitHub
parent c344ce314b
commit 1bbd7feb23
181 changed files with 123 additions and 91 deletions

View File

@@ -2,6 +2,7 @@ import os
import re
from flask import current_app as app, render_template, request, redirect, abort, jsonify, url_for, session, Blueprint, Response, send_file
from flask.helpers import safe_join
from jinja2.exceptions import TemplateNotFound
from passlib.hash import bcrypt_sha256
@@ -45,7 +46,7 @@ def setup():
# Index page
page = Pages('index', """<div class="container main-container">
<img class="logo" src="static/original/img/logo.png" />
<img class="logo" src="themes/original/static/img/logo.png" />
<h3 class="text-center">
<p>A cool CTF platform from <a href="https://ctfd.io">ctfd.io</a></p>
<p>Follow us on social media:</p>
@@ -261,4 +262,13 @@ def file_handler(path):
else:
abort(403)
upload_folder = os.path.join(app.root_path, app.config['UPLOAD_FOLDER'])
return send_file(os.path.join(upload_folder, f.location))
return send_file(safe_join(upload_folder, f.location))
@views.route('/themes/<theme>/static/<path:path>')
def themes_handler(theme, path):
filename = safe_join(app.root_path, 'themes', theme, 'static', path)
if os.path.isfile(filename):
return send_file(filename)
else:
abort(404)