diff --git a/app/api/alpha/routes.py b/app/api/alpha/routes.py index f26fe531..f14b7446 100644 --- a/app/api/alpha/routes.py +++ b/app/api/alpha/routes.py @@ -404,5 +404,62 @@ def alpha_emoji(): return jsonify({"error": "not_yet_implemented"}), 400 +# HTML routes +from flask import abort, render_template +from app.utils import current_theme +import os + +@bp.route('/api/alpha/', methods=['GET']) +def get_alpha(): + if not current_app.debug: + abort(404) + + template_name = "index.html" + + theme = current_theme() + if theme != '' and os.path.exists(f'app/templates/themes/{theme}/{template_name}'): + return render_template(f'themes/{theme}/{template_name}') + else: + return render_template(template_name) +@bp.route('/api/alpha/auth/login', methods=['GET']) +def get_alpha_auth_login(): + if not current_app.debug: + abort(404) + + template_name = "auth/login.html" + + theme = current_theme() + if theme != '' and os.path.exists(f'app/templates/themes/{theme}/{template_name}'): + return render_template(f'themes/{theme}/{template_name}') + else: + return render_template(template_name) + + +@bp.route('/api/alpha/auth/logout', methods=['GET']) +def get_alpha_auth_logout(): + if not current_app.debug: + abort(404) + + template_name = "auth/logout.html" + + theme = current_theme() + if theme != '' and os.path.exists(f'app/templates/themes/{theme}/{template_name}'): + return render_template(f'themes/{theme}/{template_name}') + else: + return render_template(template_name) + + +@bp.route('/api/alpha/communities', methods=['GET']) +def get_alpha_communities(): + if not current_app.debug: + abort(404) + + template_name = "list_communities.html" + + theme = current_theme() + if theme != '' and os.path.exists(f'app/templates/themes/{theme}/{template_name}'): + return render_template(f'themes/{theme}/{template_name}') + else: + return render_template(template_name) diff --git a/app/templates/themes/x_api/auth/login.html b/app/templates/themes/x_api/auth/login.html new file mode 100644 index 00000000..b3798f35 --- /dev/null +++ b/app/templates/themes/x_api/auth/login.html @@ -0,0 +1,38 @@ +{% extends 'themes/' + theme() + '/base.html' %} + +{% block app_content %} +

GET /api/alpha/site

+
JSON
+ +

POST /api/alpha/user/login

+
JSON
+ +
+ +
+
+ + +
+ +
+ + +
+ +
+ + +
+ +
+ +

+ {{ _('New User?') }} {{ _('Register new account') }} +

+

+ {{ _('Forgot Your Password?') }} {{ _('Reset it') }} +

+ + +{% endblock %} diff --git a/app/templates/themes/x_api/auth/logout.html b/app/templates/themes/x_api/auth/logout.html new file mode 100644 index 00000000..f09d3703 --- /dev/null +++ b/app/templates/themes/x_api/auth/logout.html @@ -0,0 +1,5 @@ +{% extends 'themes/' + theme() + '/base.html' %} + +{% block app_content %} + +{% endblock %} diff --git a/app/templates/themes/x_api/base.html b/app/templates/themes/x_api/base.html index 80190a66..5bce7ec5 100644 --- a/app/templates/themes/x_api/base.html +++ b/app/templates/themes/x_api/base.html @@ -1,9 +1,46 @@ +{% macro render_username(user, add_domain=True) -%} + + {% if user.deleted -%} + [deleted] + {% else -%} + + {{ user.display_name() }}{% if not user.is_local() %}@{{ user.ap_domain }}{% endif %} + + {% if user.bot -%} + + {% endif -%} + {% endif -%} + +{% endmacro -%} + +{% macro render_communityname(community, add_domain=True) -%} + + + {{ community.title }}{% if not community.is_local() %}@{{ community.ap_domain }}{% endif %} + + +{% endmacro -%} + + - {% if not debug_mode %}{{ g.site.name }}{% endif %} + + + + + + + + + + + + + + {{ bootstrap.load_css() }} @@ -44,99 +81,12 @@