Ignore certain messages. Prevent duplicate updates being saved
rodzic
ccdcca3dae
commit
325f43fc70
12
index.php
12
index.php
|
@ -296,6 +296,12 @@
|
||||||
// Some servers are very chatty. They send lots of irrelevant messages.
|
// Some servers are very chatty. They send lots of irrelevant messages.
|
||||||
// Before even bothering to validate them, we can delete them.
|
// Before even bothering to validate them, we can delete them.
|
||||||
|
|
||||||
|
// This server doesn't handle Add, Remove, or Reject
|
||||||
|
// See https://www.w3.org/wiki/ActivityPub/Primer
|
||||||
|
if ( "Add" == $inbox_type || "Remove" == $inbox_type || "Reject" == $inbox_type ) {
|
||||||
|
die();
|
||||||
|
}
|
||||||
|
|
||||||
// Messages from accounts which aren't being followed.
|
// Messages from accounts which aren't being followed.
|
||||||
// Some servers send delete messages about users we don't follow.
|
// Some servers send delete messages about users we don't follow.
|
||||||
// Lemmy sends messages even after unfollowing or blocking a channel
|
// Lemmy sends messages even after unfollowing or blocking a channel
|
||||||
|
@ -335,6 +341,7 @@
|
||||||
$reply = false;
|
$reply = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// As long as one of these is true, the server will process it
|
||||||
if ( !$reply && !$from_following && !$from_follower ) {
|
if ( !$reply && !$from_following && !$from_follower ) {
|
||||||
// Don't bother processing it at all.
|
// Don't bother processing it at all.
|
||||||
die();
|
die();
|
||||||
|
@ -1750,11 +1757,6 @@ HTML;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// If the message is valid, save the message in `/data/inbox/`
|
|
||||||
$uuid = uuid( $message );
|
|
||||||
$filename = $uuid . "." . urlencode( $type ) . ".json";
|
|
||||||
file_put_contents( $directories["inbox"] . "/{$filename}", json_encode( $message ) );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// "One to stun, two to kill, three to make sure"
|
// "One to stun, two to kill, three to make sure"
|
||||||
|
|
Ładowanie…
Reference in New Issue