mirror of
https://gitlab.com/SIGBUS/nyaa.git
synced 2024-12-22 10:10:00 +00:00
Optimize routes (define url_prefix in Blueprints)
* /admin/* * /api/*
This commit is contained in:
parent
0bcd782695
commit
a758f5f078
|
@ -78,7 +78,7 @@ def create_app(config):
|
|||
|
||||
# Blueprints
|
||||
app.register_blueprint(template_utils_bp)
|
||||
app.register_blueprint(api_blueprint, url_prefix='/api')
|
||||
app.register_blueprint(api_blueprint)
|
||||
register_views(app)
|
||||
|
||||
return app
|
||||
|
|
|
@ -10,7 +10,7 @@ from nyaa import backend, bencode, forms, models, utils
|
|||
from nyaa.extensions import db
|
||||
from nyaa.views.torrents import _create_upload_category_choices
|
||||
|
||||
api_blueprint = flask.Blueprint('api', __name__)
|
||||
api_blueprint = flask.Blueprint('api', __name__, url_prefix='/api')
|
||||
|
||||
# #################################### API HELPERS ####################################
|
||||
|
||||
|
|
|
@ -3,10 +3,10 @@ import flask
|
|||
from nyaa import forms, models
|
||||
from nyaa.extensions import db
|
||||
|
||||
bp = flask.Blueprint('admin', __name__)
|
||||
bp = flask.Blueprint('admin', __name__, url_prefix='/admin')
|
||||
|
||||
|
||||
@bp.route('/admin/log', endpoint='log', methods=['GET'])
|
||||
@bp.route('/log', endpoint='log', methods=['GET'])
|
||||
def view_adminlog():
|
||||
if not flask.g.user or not flask.g.user.is_moderator:
|
||||
flask.abort(403)
|
||||
|
@ -20,7 +20,7 @@ def view_adminlog():
|
|||
adminlog=logs)
|
||||
|
||||
|
||||
@bp.route('/admin/reports', endpoint='reports', methods=['GET', 'POST'])
|
||||
@bp.route('/reports', endpoint='reports', methods=['GET', 'POST'])
|
||||
def view_reports():
|
||||
if not flask.g.user or not flask.g.user.is_moderator:
|
||||
flask.abort(403)
|
||||
|
|
Loading…
Reference in a new issue