Compare commits
2 commits
17bdd52253
...
7590773710
| Author | SHA1 | Date | |
|---|---|---|---|
| 7590773710 | |||
| 213a48130f |
2 changed files with 14 additions and 1 deletions
|
|
@ -81,3 +81,4 @@ class UserLoader(AuthUser):
|
||||||
id: int
|
id: int
|
||||||
username: str
|
username: str
|
||||||
display_name: str
|
display_name: str
|
||||||
|
theme_color: int
|
||||||
|
|
|
||||||
|
|
@ -47,7 +47,8 @@ async def health():
|
||||||
name = app_config.app_name,
|
name = app_config.app_name,
|
||||||
post_count = await Post.count(),
|
post_count = await Post.count(),
|
||||||
user_count = await User.active_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
|
return hi
|
||||||
|
|
@ -160,6 +161,17 @@ async def _guild_info(gu: Guild):
|
||||||
badges = []
|
badges = []
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@bp.get('/guild/<b32l:gid>')
|
||||||
|
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/@<gname>')
|
@bp.get('/guild/@<gname>')
|
||||||
async def guild_info_only(gname: str):
|
async def guild_info_only(gname: str):
|
||||||
async with db as session:
|
async with db as session:
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue