diff --git a/nyaa/routes.py b/nyaa/routes.py index 0fd46a3..025d8cc 100644 --- a/nyaa/routes.py +++ b/nyaa/routes.py @@ -19,7 +19,7 @@ import config from itsdangerous import BadSignature, URLSafeSerializer from sqlalchemy.orm import joinedload -from nyaa import api_handler, app, backend, db, forms, models, torrents, utils +from nyaa import api_handler, app, backend, db, forms, models, torrents, utils, views from nyaa.search import search_db, search_elastic DEBUG_API = False @@ -452,11 +452,6 @@ def render_rss(label, query, use_elastic, magnet_links=False): return response -# @app.route('/about', methods=['GET']) -# def about(): - # return flask.render_template('about.html') - - @app.route('/login', methods=['GET', 'POST']) def login(): if flask.g.user: @@ -1006,24 +1001,17 @@ def timesince(dt, default='just now'): return default -# #################################### STATIC PAGES #################################### + +# #################################### BLUEPRINTS #################################### + +def register_blueprints(flask_app): + """ Register the blueprints using the flask_app object """ + + # API routes + flask_app.register_blueprint(api_handler.api_blueprint, url_prefix='/api') + # Site routes + flask_app.register_blueprint(views.site_bp) -@app.route('/rules', methods=['GET']) -def site_rules(): - return flask.render_template('rules.html') - - -@app.route('/help', methods=['GET']) -def site_help(): - return flask.render_template('help.html') - - -@app.route('/xmlns/nyaa', methods=['GET']) -def xmlns_nyaa(): - return flask.render_template('xmlns.html') - - -# #################################### API ROUTES #################################### - -app.register_blueprint(api_handler.api_blueprint, url_prefix='/api') +# When done, this can be moved to nyaa/__init__.py instead of importing this file +register_blueprints(app) diff --git a/nyaa/templates/layout.html b/nyaa/templates/layout.html index 8239c43..d280c21 100644 --- a/nyaa/templates/layout.html +++ b/nyaa/templates/layout.html @@ -78,8 +78,8 @@
  • RSS
  • diff --git a/nyaa/templates/rss.xml b/nyaa/templates/rss.xml index fd8e085..af58939 100644 --- a/nyaa/templates/rss.xml +++ b/nyaa/templates/rss.xml @@ -1,4 +1,4 @@ - + {{ config.SITE_NAME }} - {{ term }} - {% if not magnet_links %}Torrent File{% else %}Magnet URI{% endif %} RSS RSS Feed for {{ term }} diff --git a/nyaa/templates/view.html b/nyaa/templates/view.html index 2c917bc..dc0f199 100644 --- a/nyaa/templates/view.html +++ b/nyaa/templates/view.html @@ -191,7 +191,7 @@