forked from FrederikBaerentsen/BrickTracker
39 lines
1.0 KiB
Python
39 lines
1.0 KiB
Python
|
from flask import Blueprint, current_app, render_template
|
||
|
from flask_login import login_required
|
||
|
|
||
|
from ..configuration_list import BrickConfigurationList
|
||
|
from .exceptions import exception_handler
|
||
|
from ..socket import MESSAGES
|
||
|
|
||
|
add_page = Blueprint('add', __name__, url_prefix='/add')
|
||
|
|
||
|
|
||
|
# Add a set
|
||
|
@add_page.route('/', methods=['GET'])
|
||
|
@login_required
|
||
|
@exception_handler(__file__)
|
||
|
def add() -> str:
|
||
|
BrickConfigurationList.error_unless_is_set('REBRICKABLE_API_KEY')
|
||
|
|
||
|
return render_template(
|
||
|
'add.html',
|
||
|
path=current_app.config['SOCKET_PATH'].value,
|
||
|
namespace=current_app.config['SOCKET_NAMESPACE'].value,
|
||
|
messages=MESSAGES
|
||
|
)
|
||
|
|
||
|
|
||
|
# Bulk add sets
|
||
|
@add_page.route('/bulk', methods=['GET'])
|
||
|
@login_required
|
||
|
@exception_handler(__file__)
|
||
|
def bulk() -> str:
|
||
|
BrickConfigurationList.error_unless_is_set('REBRICKABLE_API_KEY')
|
||
|
|
||
|
return render_template(
|
||
|
'bulk.html',
|
||
|
path=current_app.config['SOCKET_PATH'].value,
|
||
|
namespace=current_app.config['SOCKET_NAMESPACE'].value,
|
||
|
messages=MESSAGES
|
||
|
)
|