mirror of
https://git.pleroma.social/pleroma/relay.git
synced 2025-03-04 08:43:58 +00:00
fix actor type checking (fixes #45)
This commit is contained in:
parent
527afaca95
commit
760718b5dc
1 changed files with 2 additions and 4 deletions
|
@ -11,7 +11,7 @@ if typing.TYPE_CHECKING:
|
||||||
from .views.activitypub import InboxData
|
from .views.activitypub import InboxData
|
||||||
|
|
||||||
|
|
||||||
def actor_type_check(actor: Message, software: str | None) -> bool:
|
def is_application(actor: Message, software: str | None) -> bool:
|
||||||
if actor.type == "Application":
|
if actor.type == "Application":
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
@ -65,8 +65,6 @@ async def handle_follow(app: Application, data: InboxData, conn: Connection) ->
|
||||||
|
|
||||||
# reject if software used by actor is banned
|
# reject if software used by actor is banned
|
||||||
if software and conn.get_software_ban(software):
|
if software and conn.get_software_ban(software):
|
||||||
logging.verbose("Rejected banned actor: %s", data.actor.id)
|
|
||||||
|
|
||||||
app.push_message(
|
app.push_message(
|
||||||
data.shared_inbox,
|
data.shared_inbox,
|
||||||
Message.new_response(
|
Message.new_response(
|
||||||
|
@ -87,7 +85,7 @@ async def handle_follow(app: Application, data: InboxData, conn: Connection) ->
|
||||||
return
|
return
|
||||||
|
|
||||||
# reject if the actor is not an instance actor
|
# reject if the actor is not an instance actor
|
||||||
if actor_type_check(data.actor, software):
|
if not is_application(data.actor, software):
|
||||||
logging.verbose("Non-application actor tried to follow: %s", data.actor.id)
|
logging.verbose("Non-application actor tried to follow: %s", data.actor.id)
|
||||||
|
|
||||||
app.push_message(
|
app.push_message(
|
||||||
|
|
Loading…
Reference in a new issue