Use BASE_URL when generating {proxied,resized}_image_url

Necessary when running at a non-root path
main
Kevin Wallace 2022-11-17 21:35:02 -08:00 committed by Thomas Sileo
parent ae8029cd22
commit 3cff4e4507
1 changed files with 3 additions and 2 deletions

View File

@ -12,6 +12,7 @@ from sqlalchemy.orm import joinedload
from app import activitypub as ap from app import activitypub as ap
from app import media from app import media
from app.config import BASE_URL
from app.database import AsyncSession from app.database import AsyncSession
from app.utils.datetime import as_utc from app.utils.datetime import as_utc
from app.utils.datetime import now from app.utils.datetime import now
@ -111,14 +112,14 @@ class Actor:
if self.icon_url: if self.icon_url:
return media.proxied_media_url(self.icon_url) return media.proxied_media_url(self.icon_url)
else: else:
return "/static/nopic.png" return BASE_URL + "/static/nopic.png"
@property @property
def resized_icon_url(self) -> str: def resized_icon_url(self) -> str:
if self.icon_url: if self.icon_url:
return media.resized_media_url(self.icon_url, 50) return media.resized_media_url(self.icon_url, 50)
else: else:
return "/static/nopic.png" return BASE_URL + "/static/nopic.png"
@property @property
def tags(self) -> list[ap.RawObject]: def tags(self) -> list[ap.RawObject]: