From 9bad63580549358f1333dcc2c221e92dd924e4f6 Mon Sep 17 00:00:00 2001 From: rimu <3310831+rimu@users.noreply.github.com> Date: Fri, 23 Aug 2024 11:14:47 +1200 Subject: [PATCH] remove moment.js to decrease carbon usage --- app/__init__.py | 3 --- app/main/routes.py | 2 -- app/static/update_assets.sh | 2 -- app/templates/admin/activities.html | 2 +- app/templates/admin/approve_registrations.html | 4 ++-- app/templates/admin/edit_user.html | 4 ++-- app/templates/admin/reports.html | 2 +- app/templates/admin/users.html | 2 +- app/templates/admin/users_trash.html | 2 +- app/templates/base.html | 4 ---- app/templates/chat/conversation.html | 2 +- app/templates/community/community_moderate.html | 2 +- .../community/community_moderate_subscribers.html | 2 +- app/templates/community/community_modlog.html | 2 +- app/templates/community/community_wiki_revisions.html | 2 +- app/templates/list_communities.html | 2 +- app/templates/modlog.html | 2 +- app/templates/post/_post_full.html | 10 +++++----- app/templates/post/_post_reply_teaser.html | 4 ++-- app/templates/post/_post_teaser.html | 2 +- app/templates/post/continue_discussion.html | 2 +- app/templates/post/post.html | 2 +- app/templates/user/notifications.html | 2 +- app/templates/user/show_profile.html | 4 ++-- pyfedi.py | 3 ++- requirements.txt | 1 - 26 files changed, 30 insertions(+), 41 deletions(-) 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 %}