浏览代码

Update AP Inbox

Daniel Supernault 4 年之前
父节点
当前提交
8444d2dc50
共有 1 个文件被更改,包括 13 次插入9 次删除
  1. 13 9
      app/Util/ActivityPub/Inbox.php

+ 13 - 9
app/Util/ActivityPub/Inbox.php

@@ -139,6 +139,19 @@ class Inbox
     public function handleCreateActivity()
     public function handleCreateActivity()
     {
     {
         $activity = $this->payload['object'];
         $activity = $this->payload['object'];
+        $actor = $this->actorFirstOrCreate($this->payload['actor']);
+        if(!$actor || $actor->domain == null) {
+            return;
+        }
+        $to = $activity['to'];
+        $cc = $activity['cc'];
+        if(count($to) == 1 && 
+            count($cc) == 0 && 
+            parse_url($to[0], PHP_URL_HOST) == config('pixelfed.domain.app')
+        ) {
+            $this->handleDirectMessage();
+            return;
+        }
         if(!$this->verifyNoteAttachment()) {
         if(!$this->verifyNoteAttachment()) {
             return;
             return;
         }
         }
@@ -172,15 +185,6 @@ class Inbox
         if(!$actor || $actor->domain == null) {
         if(!$actor || $actor->domain == null) {
             return;
             return;
         }
         }
-        $to = $activity['to'];
-        $cc = $activity['cc'];
-        if(count($to) == 1 && 
-           count($cc) == 0 && 
-           parse_url($to[0], PHP_URL_HOST) == config('pixelfed.domain.app')
-        ) {
-            $this->handleDirectMessage();
-            return;
-        }
 
 
         if($actor->followers()->count() == 0) {
         if($actor->followers()->count() == 0) {
             return;
             return;