mirror of
https://git.pleroma.social/pleroma/relay.git
synced 2024-11-22 14:38:00 +00:00
rework person_check and rename it to actor_type_check
This commit is contained in:
parent
f49bc0ae90
commit
5407027af8
|
@ -10,14 +10,12 @@ if typing.TYPE_CHECKING:
|
||||||
from .views.activitypub import ActorView
|
from .views.activitypub import ActorView
|
||||||
|
|
||||||
|
|
||||||
def person_check(actor: Message, software: str | None) -> bool:
|
def actor_type_check(actor: Message, software: str | None) -> bool:
|
||||||
# pleroma and akkoma may use Person for the actor type for some reason
|
if actor.type == 'Application':
|
||||||
# akkoma changed this in 3.6.0
|
return True
|
||||||
if software in {'akkoma', 'pleroma'} and actor.id == f'https://{actor.domain}/relay':
|
|
||||||
return False
|
|
||||||
|
|
||||||
# make sure the actor is an application
|
# akkoma (< 3.6.0) and pleroma use Person for the actor type
|
||||||
if actor.type != 'Application':
|
if software in {'akkoma', 'pleroma'} and actor.id == f'https://{actor.domain}/relay':
|
||||||
return True
|
return True
|
||||||
|
|
||||||
return False
|
return False
|
||||||
|
@ -88,7 +86,7 @@ async def handle_follow(view: ActorView, conn: Connection) -> None:
|
||||||
return
|
return
|
||||||
|
|
||||||
# reject if the actor is not an instance actor
|
# reject if the actor is not an instance actor
|
||||||
if person_check(view.actor, software):
|
if actor_type_check(view.actor, software):
|
||||||
logging.verbose('Non-application actor tried to follow: %s', view.actor.id)
|
logging.verbose('Non-application actor tried to follow: %s', view.actor.id)
|
||||||
|
|
||||||
view.app.push_message(
|
view.app.push_message(
|
||||||
|
|
Loading…
Reference in a new issue