mirror of
https://git.sr.ht/~tsileo/microblog.pub
synced 2024-12-22 13:14:28 +00:00
Improve lookup
This commit is contained in:
parent
6b670c74cf
commit
7c6768266c
1 changed files with 2 additions and 1 deletions
|
@ -6,10 +6,11 @@ from app.actor import Actor
|
||||||
from app.actor import RemoteActor
|
from app.actor import RemoteActor
|
||||||
from app.ap_object import RemoteObject
|
from app.ap_object import RemoteObject
|
||||||
from app.database import AsyncSession
|
from app.database import AsyncSession
|
||||||
|
from app.source import _MENTION_REGEX
|
||||||
|
|
||||||
|
|
||||||
async def lookup(db_session: AsyncSession, query: str) -> Actor | RemoteObject:
|
async def lookup(db_session: AsyncSession, query: str) -> Actor | RemoteObject:
|
||||||
if query.startswith("@"):
|
if query.startswith("@") or _MENTION_REGEX.match("@" + query):
|
||||||
query = await webfinger.get_actor_url(query) # type: ignore # None check below
|
query = await webfinger.get_actor_url(query) # type: ignore # None check below
|
||||||
|
|
||||||
if not query:
|
if not query:
|
||||||
|
|
Loading…
Reference in a new issue