diff --git a/app/__init__.py b/app/__init__.py index e5643076..f1d7f152 100644 --- a/app/__init__.py +++ b/app/__init__.py @@ -10,7 +10,6 @@ from flask_migrate import Migrate from flask_login import LoginManager from flask_bootstrap import Bootstrap5 from flask_mail import Mail -from flask_moment import Moment from flask_babel import Babel, lazy_gettext as _l from flask_caching import Cache from celery import Celery @@ -39,7 +38,6 @@ login.login_view = 'auth.login' login.login_message = _l('Please log in to access this page.') mail = Mail() bootstrap = Bootstrap5() -moment = Moment() babel = Babel(locale_selector=get_locale) cache = Cache() celery = Celery(__name__, broker=Config.CELERY_BROKER_URL) @@ -61,7 +59,6 @@ def create_app(config_class=Config): login.init_app(app) mail.init_app(app) bootstrap.init_app(app) - moment.init_app(app) make_searchable(db.metadata) babel.init_app(app, locale_selector=get_locale) cache.init_app(app) diff --git a/app/main/routes.py b/app/main/routes.py index ab8f2655..ba1e539e 100644 --- a/app/main/routes.py +++ b/app/main/routes.py @@ -3,7 +3,6 @@ from datetime import timedelta from random import randint import flask -from flask_caching import CachedResponse from sqlalchemy.sql.operators import or_, and_ from app import db, cache @@ -15,7 +14,6 @@ from app.email import send_email from app.inoculation import inoculation from app.main import bp from flask import g, session, flash, request, current_app, url_for, redirect, make_response, jsonify -from flask_moment import moment from flask_login import current_user, login_required from flask_babel import _, get_locale from sqlalchemy import desc, text diff --git a/app/static/update_assets.sh b/app/static/update_assets.sh index 743cb938..2c9daded 100644 --- a/app/static/update_assets.sh +++ b/app/static/update_assets.sh @@ -14,8 +14,6 @@ curl -o js/markdown/downarea.js -L https://codeberg.org/PieFed/downarea2/raw/bra # https://htmx.org/ (Zero-Clause BSD) curl -o js/htmx.min.js -L https://unpkg.com/htmx.org@2.0.0 -# https://momentjs.com/ (MIT license) -curl -o js/moment-with-locales.min.js -L https://momentjs.com/downloads/moment-with-locales.min.js # ToDo: coolfieldset.js diff --git a/app/templates/admin/activities.html b/app/templates/admin/activities.html index 7a58b019..47b3ccd2 100644 --- a/app/templates/admin/activities.html +++ b/app/templates/admin/activities.html @@ -32,7 +32,7 @@ {% for activity in activities.items %} - {{ moment(activity.created_at).fromNow() }} + {{ arrow.get(activity.created_at).humanize(locale=locale) }} {{ activity.direction }} {{ activity.activity_id }} {{ activity.activity_type if activity.activity_type else '' }} diff --git a/app/templates/admin/approve_registrations.html b/app/templates/admin/approve_registrations.html index 704aa8ff..0e94347a 100644 --- a/app/templates/admin/approve_registrations.html +++ b/app/templates/admin/approve_registrations.html @@ -33,7 +33,7 @@ {{ registration.user.email }} {{ ''|safe if registration.user.verified else ''|safe }} {{ registration.answer }} - {{ moment(registration.created_at).fromNow() }} + {{ arrow.get(registration.created_at).humanize(locale=locale) }} {{ registration.user.ip_address if registration.user.ip_address }}
{{ registration.user.ip_address_country if registration.user.ip_address_country }} {{ registration.user.referrer if registration.user.referrer }} {{ _('Approve') }} @@ -71,7 +71,7 @@ {{ registration.user.email }} {{ ''|safe if registration.user.verified else ''|safe }} {{ registration.answer }} - {{ moment(registration.created_at).fromNow() }} + {{ arrow.get(registration.created_at).humanize(locale=locale) }} {{ registration.user.ip_address if registration.user.ip_address }}
{{ registration.user.ip_address_country if registration.user.ip_address_country }} {{ registration.user.referrer if registration.user.referrer }} diff --git a/app/templates/admin/edit_user.html b/app/templates/admin/edit_user.html index 1e01e49b..57be9a11 100644 --- a/app/templates/admin/edit_user.html +++ b/app/templates/admin/edit_user.html @@ -13,8 +13,8 @@
{{ form.csrf_token() }} {{ user.about_html|safe if user.about_html }} -

Created: {{ moment(user.created).format('MMMM Do YYYY, h:mm:ss a') }}

-

Last active: {{ moment(user.last_seen).format('MMMM Do YYYY, h:mm:ss a') }}

+

Created: {{ arrow.get(user.created).humanize(locale=locale) }}

+

Last active: {{ arrow.get(user.last_seen).humanize(locale=locale) }}

Email: {{ user.email }}

Matrix: {{ user.matrix_user_id if user.matrix_user_id }}

{% if user.avatar_id %} diff --git a/app/templates/admin/reports.html b/app/templates/admin/reports.html index 92775bbc..86824929 100644 --- a/app/templates/admin/reports.html +++ b/app/templates/admin/reports.html @@ -31,7 +31,7 @@ {{ report.reasons }} {{ report.description }} {{ report.type_text() }} - {{ moment(report.created_at).fromNow() }} + {{ arrow.get(report.created_at).humanize(locale=locale) }} {% if report.suspect_conversation_id %} View diff --git a/app/templates/admin/users.html b/app/templates/admin/users.html index 12bfbc99..52506884 100644 --- a/app/templates/admin/users.html +++ b/app/templates/admin/users.html @@ -37,7 +37,7 @@ {{ user.display_name() }} {% if user.is_local() %}Local{% else %}Remote{% endif %} {% if request.args.get('local_remote', '') == 'local' %} - {{ moment(user.last_seen).fromNow() }} + {{ arrow.get(user.last_seen).humanize(locale=locale) }} {% else %} {{ user.last_seen }} {% endif %} diff --git a/app/templates/admin/users_trash.html b/app/templates/admin/users_trash.html index a4e20eba..1d0d5a15 100644 --- a/app/templates/admin/users_trash.html +++ b/app/templates/admin/users_trash.html @@ -39,7 +39,7 @@ {{ user.display_name() }} {% if user.is_local() %}Local{% else %}Remote{% endif %} {% if request.args.get('local_remote', '') == 'local' %} - {{ moment(user.last_seen).fromNow() }} + {{ arrow.get(user.last_seen).humanize(locale=locale) }} {% else %} {{ user.last_seen }} {% endif %} diff --git a/app/templates/base.html b/app/templates/base.html index 53ac4b30..0f406edc 100644 --- a/app/templates/base.html +++ b/app/templates/base.html @@ -272,10 +272,6 @@ {% endblock -%} {% block scripts -%} - {% if not low_bandwidth -%} - {{ str(moment.include_moment(local_js='/static/js/moment-with-locales.min.js')).replace('