From f51f488567b2302ca184fd18cc5effe76bf31f5e Mon Sep 17 00:00:00 2001 From: Yusur Princeps Date: Sun, 14 Sep 2025 16:22:00 +0200 Subject: [PATCH] bump suou requirement --- freak/__init__.py | 4 +++- freak/rest/__init__.py | 17 ++++++++++++++++- pyproject.toml | 2 +- 3 files changed, 20 insertions(+), 3 deletions(-) diff --git a/freak/__init__.py b/freak/__init__.py index 7162627..5ff898b 100644 --- a/freak/__init__.py +++ b/freak/__init__.py @@ -228,7 +228,9 @@ async def error_404(body): except Exception as e: logger.error(f'Exception in find_guild_or_user: {e}') pass - print(request.host) + if app_config.server_name not in (None, request.host): + logger.warning(f'request host {request.host!r} is different from configured server name {app_config.server_name}') + return redirect('//' + app_config.server_name + request.full_path), 307 return await error_handler_for(404, 'Not found', '404.html') @app.errorhandler(405) diff --git a/freak/rest/__init__.py b/freak/rest/__init__.py index 903c055..ad4650f 100644 --- a/freak/rest/__init__.py +++ b/freak/rest/__init__.py @@ -13,7 +13,7 @@ from werkzeug.security import check_password_hash from suou.quart import add_rest from freak.accounts import LoginStatus, check_login -from freak.algorithms import topic_timeline, user_timeline +from freak.algorithms import public_timeline, topic_timeline, user_timeline from ..models import Guild, Post, User, db from .. import UserLoader, app, app_config, __version__ as freak_version, csrf @@ -222,3 +222,18 @@ async def logout(): logout_user() return '', 204 + +## HOME ## + +@bp.get('/home/feed') +@login_required +async def home_feed(): + async with db as session: + me = current_user.user + posts = await db.paginate(public_timeline()) + feed = [] + async for post in posts: + feed.append(post.feed_info()) + + return dict(feed=feed) + diff --git a/pyproject.toml b/pyproject.toml index 3acc227..dab79c6 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -19,7 +19,7 @@ dependencies = [ "libsass", "setuptools>=78.1.0", "Hypercorn", - "sakuragasaki46-suou>=0.6.0" + "suou>=0.6.1" ] requires-python = ">=3.10" classifiers = [