mirror of
https://git.sr.ht/~tsileo/microblog.pub
synced 2025-06-05 21:59:23 +02:00
Improve privacy relace
This commit is contained in:
@ -15,6 +15,7 @@ from app.database import AsyncSession
|
||||
from app.models import InboxObject
|
||||
from app.models import OutboxObject
|
||||
from app.utils.url import is_url_valid
|
||||
from app.utils.url import make_abs
|
||||
|
||||
|
||||
class OpenGraphMeta(BaseModel):
|
||||
@ -46,6 +47,10 @@ def _scrap_og_meta(url: str, html: str) -> OpenGraphMeta | None:
|
||||
if "title" not in raw:
|
||||
return None
|
||||
|
||||
for maybe_rel in {"url", "image"}:
|
||||
if u := raw.get(maybe_rel):
|
||||
raw[maybe_rel] = make_abs(u, url)
|
||||
|
||||
return OpenGraphMeta.parse_obj(raw)
|
||||
|
||||
|
||||
|
Reference in New Issue
Block a user