add API back

This commit is contained in:
Patrick Jentsch 2024-05-04 15:14:21 +02:00
parent e1cfd394fa
commit 6025a4a606
4 changed files with 16 additions and 15 deletions

View File

@ -1,4 +1,4 @@
# from apifairy import APIFairy
from apifairy import APIFairy
from config import Config
from docker import DockerClient
from flask import Flask
@ -6,7 +6,7 @@ from flask_apscheduler import APScheduler
from flask_assets import Environment
from flask_login import LoginManager
from flask_mail import Mail
# from flask_marshmallow import Marshmallow
from flask_marshmallow import Marshmallow
from flask_migrate import Migrate
from flask_paranoid import Paranoid
from flask_socketio import SocketIO
@ -14,7 +14,7 @@ from flask_sqlalchemy import SQLAlchemy
from flask_hashids import Hashids
# apifairy = APIFairy()
apifairy = APIFairy()
assets = Environment()
db = SQLAlchemy()
docker_client = DockerClient()
@ -22,7 +22,7 @@ hashids = Hashids()
login = LoginManager()
login.login_view = 'auth.login'
login.login_message = 'Please log in to access this page.'
# ma = Marshmallow()
ma = Marshmallow()
mail = Mail()
migrate = Migrate(compare_type=True)
paranoid = Paranoid()
@ -45,12 +45,12 @@ def create_app(config: Config = Config) -> Flask:
registry=app.config['NOPAQUE_DOCKER_REGISTRY']
)
# apifairy.init_app(app)
apifairy.init_app(app)
assets.init_app(app)
db.init_app(app)
hashids.init_app(app)
login.init_app(app)
# ma.init_app(app)
ma.init_app(app)
mail.init_app(app)
migrate.init_app(app, db)
paranoid.init_app(app)
@ -63,8 +63,8 @@ def create_app(config: Config = Config) -> Flask:
from .admin import bp as admin_blueprint
app.register_blueprint(admin_blueprint, url_prefix='/admin')
# from .api import bp as api_blueprint
# app.register_blueprint(api_blueprint, url_prefix='/api')
from .api import bp as api_blueprint
app.register_blueprint(api_blueprint, url_prefix='/api')
from .auth import bp as auth_blueprint
app.register_blueprint(auth_blueprint)

View File

@ -11,11 +11,11 @@
</li>
{# general items #}
{# {% if current_user.can('USE_API') %}
{% if current_user.can('USE_API') %}
<li>
<a class="waves-effect" href="{{ url_for('apifairy.docs') }}"><i class="material-icons">api</i>API</a>
</li>
{% endif %} #}
{% endif %}
<li>
<a class="waves-effect modal-trigger" href="#manual-modal"><i class="material-icons">school</i>Manual</a>
</li>

View File

@ -20,7 +20,7 @@ Flask-Hashids==1.0.3
Flask-HTTPAuth==4.8.0
Flask-Login==0.6.3
Flask-Mail==0.9.1
flask-marshmallow==1.2.1
flask-marshmallow==0.14.0
Flask-Migrate==4.0.7
Flask-Paranoid==0.3.0
Flask-SocketIO==5.3.6
@ -36,6 +36,7 @@ joblib==1.4.0
Mako==1.3.3
MarkupSafe==2.1.5
marshmallow==3.21.1
marshmallow-sqlalchemy==1.0.0
nltk==3.8.1
packaging==24.0
psycopg2==2.9.9
@ -53,7 +54,7 @@ requests==2.31.0
simple-websocket==1.0.0
six==1.16.0
SQLAlchemy==1.4.52
tqdm==4.66.2
tqdm==4.66.4
typing_extensions==4.11.0
tzlocal==5.2
urllib3==2.2.1

View File

@ -7,16 +7,16 @@ Flask==2.3.3
Flask-APScheduler
Flask-Assets
Flask-Hashids
# Flask-HTTPAuth
Flask-HTTPAuth
Flask-Login
Flask-Mail
# flask-marshmallow
flask-marshmallow==0.14.0
Flask-Migrate
Flask-Paranoid
Flask-SocketIO
Flask-SQLAlchemy==2.5.1
Flask-WTF
# marshmallow-sqlalchemy
marshmallow-sqlalchemy
nltk
psycopg2
PyJWT