From 213a48130fa438de1f560cbf81dd250260a610a9 Mon Sep 17 00:00:00 2001 From: Yusur Princeps Date: Thu, 9 Oct 2025 16:38:02 +0200 Subject: [PATCH 1/2] add /v1/guild/:id --- freak/rest/__init__.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/freak/rest/__init__.py b/freak/rest/__init__.py index 233f4b6..a62124d 100644 --- a/freak/rest/__init__.py +++ b/freak/rest/__init__.py @@ -160,6 +160,17 @@ async def _guild_info(gu: Guild): badges = [] ) +@bp.get('/guild/') +async def guild_info_id(gid: int): + async with db as session: + gu: Guild | None = (await session.execute(select(Guild).where(Guild.id == gid))).scalar() + + if gu is None: + return dict(error='Not found'), 404 + gj = await _guild_info(gu) + + return dict(guilds={f'{Snowflake(gu.id):l}': gj}) + @bp.get('/guild/@') async def guild_info_only(gname: str): async with db as session: From 7590773710c04afcc7537e1fa715c103fa76858e Mon Sep 17 00:00:00 2001 From: Yusur Princeps Date: Sat, 11 Oct 2025 19:15:28 +0200 Subject: [PATCH 2/2] add theme color to /v1/health --- freak/accounts.py | 1 + freak/rest/__init__.py | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/freak/accounts.py b/freak/accounts.py index 8951426..a6f5ab0 100644 --- a/freak/accounts.py +++ b/freak/accounts.py @@ -81,3 +81,4 @@ class UserLoader(AuthUser): id: int username: str display_name: str + theme_color: int diff --git a/freak/rest/__init__.py b/freak/rest/__init__.py index a62124d..015d78f 100644 --- a/freak/rest/__init__.py +++ b/freak/rest/__init__.py @@ -47,7 +47,8 @@ async def health(): name = app_config.app_name, post_count = await Post.count(), user_count = await User.active_count(), - me = Snowflake(current_user.id).to_b32l() if current_user else None + me = Snowflake(current_user.id).to_b32l() if current_user else None, + theme_color = current_user.theme_color if current_user else 0 ) return hi