Update Flask dependencies

This commit is contained in:
rubenwardy 2024-05-24 00:53:05 +01:00
parent 49a2ee5b82
commit 37b50bf409
6 changed files with 26 additions and 23 deletions

@ -23,7 +23,6 @@ from flask_babel import Babel, gettext
from flask_flatpages import FlatPages from flask_flatpages import FlatPages
from flask_flatpages.utils import pygmented_markdown from flask_flatpages.utils import pygmented_markdown
from flask_github import GitHub from flask_github import GitHub
from flask_gravatar import Gravatar
from flask_login import logout_user, current_user, LoginManager from flask_login import logout_user, current_user, LoginManager
from flask_mail import Mail from flask_mail import Mail
from flask_wtf.csrf import CSRFProtect from flask_wtf.csrf import CSRFProtect
@ -108,14 +107,6 @@ csrf = CSRFProtect(app)
mail = Mail(app) mail = Mail(app)
pages = FlatPages(app) pages = FlatPages(app)
babel = Babel() babel = Babel()
gravatar = Gravatar(app,
size=64,
rating="g",
default="retro",
force_default=False,
force_lower=False,
use_ssl=True,
base_url=None)
init_markdown(app) init_markdown(app)
login_manager = LoginManager() login_manager = LoginManager()

@ -21,7 +21,6 @@ from flask import url_for
from flask_login import UserMixin from flask_login import UserMixin
from sqlalchemy import desc, text from sqlalchemy import desc, text
from app import gravatar
from . import db from . import db
@ -233,7 +232,8 @@ class User(db.Model, UserMixin):
elif self.rank == UserRank.BOT: elif self.rank == UserRank.BOT:
return "/static/bot_avatar.png" return "/static/bot_avatar.png"
else: else:
return gravatar(self.email or f"{self.username}@content.minetest.net") from app.utils.gravatar import get_gravatar
return get_gravatar(self.email or f"{self.username}@content.minetest.net")
def check_perm(self, user, perm): def check_perm(self, user, perm):
if not user.is_authenticated: if not user.is_authenticated:

@ -13,13 +13,16 @@
# #
# You should have received a copy of the GNU Affero General Public License # You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>. # along with this program. If not, see <https://www.gnu.org/licenses/>.
import smtplib import smtplib
import typing import typing
from typing import Dict from typing import Dict
from flask import render_template, escape from flask import render_template
from flask_babel import force_locale, gettext, lazy_gettext, LazyString from flask_babel import force_locale, gettext, lazy_gettext, LazyString
from flask_mail import Message from flask_mail import Message
from markupsafe import escape
from app import mail from app import mail
from app.models import Notification, db, EmailSubscription, User from app.models import Notification, db, EmailSubscription, User
from app.rediscache import increment_key from app.rediscache import increment_key

11
app/utils/gravatar.py Normal file

@ -0,0 +1,11 @@
import hashlib
def get_gravatar(email: str):
size = 64
rating = "g"
default = "retro"
url = "https://secure.gravatar.com/avatar/"
email_hash = hashlib.md5(email.encode("utf-8")).hexdigest()
link = f"{url}{email_hash}?s={size}&d={default}&r={rating}"
return link

@ -1,7 +1,7 @@
alembic==1.10.3 alembic==1.10.3
amqp==5.1.1 amqp==5.1.1
async-timeout==4.0.2 async-timeout==4.0.2
Babel==2.12.1 Babel==2.15.0
bcrypt==4.0.1 bcrypt==4.0.1
beautifulsoup4==4.12.2 beautifulsoup4==4.12.2
billiard==3.6.4.0 billiard==3.6.4.0
@ -20,15 +20,14 @@ deep-compare==1.0.5
dnspython==2.3.0 dnspython==2.3.0
email-validator==2.0.0.post1 email-validator==2.0.0.post1
exceptiongroup==1.1.1 exceptiongroup==1.1.1
Flask==2.2.3 Flask==3.0.3
flask-babel==3.1.0 flask-babel==4.0.0
Flask-FlatPages==0.8.1 Flask-FlatPages==0.8.2
Flask-Gravatar==0.5.0 Flask-Login==0.6.3
Flask-Login==0.6.2 Flask-Mail==0.10.0
Flask-Mail==0.9.1
Flask-Migrate==4.0.4 Flask-Migrate==4.0.4
Flask-SQLAlchemy==3.0.3 Flask-SQLAlchemy==3.0.3
Flask-WTF==1.1.1 Flask-WTF==1.2.1
git-archive-all==1.23.1 git-archive-all==1.23.1
gitdb==4.0.10 gitdb==4.0.10
GitHub-Flask==3.2.0 GitHub-Flask==3.2.0
@ -37,7 +36,7 @@ greenlet==2.0.2
gunicorn==20.1.0 gunicorn==20.1.0
idna==3.4 idna==3.4
iniconfig==2.0.0 iniconfig==2.0.0
itsdangerous==2.1.2 itsdangerous==2.2.0
Jinja2==3.1.2 Jinja2==3.1.2
kombu==5.2.4 kombu==5.2.4
libsass==0.22.0 libsass==0.22.0
@ -73,7 +72,7 @@ validators==0.20.0
vine==5.0.0 vine==5.0.0
wcwidth==0.2.6 wcwidth==0.2.6
webencodings==0.5.1 webencodings==0.5.1
Werkzeug==2.2.3 Werkzeug==3.0.3
WTForms==3.0.1 WTForms==3.0.1
WTForms-SQLAlchemy==0.3 WTForms-SQLAlchemy==0.3
sentry-sdk[flask]==2.0.1 sentry-sdk[flask]==2.0.1

@ -1,6 +1,5 @@
Flask Flask
Flask-FlatPages Flask-FlatPages
Flask-Gravatar
Flask-Login Flask-Login
Flask-Migrate Flask-Migrate
Flask-SQLAlchemy Flask-SQLAlchemy