]> git.mxchange.org Git - friendica.git/commitdiff
Funkwhale context file moved
authorMichael <heluecht@pirati.ca>
Sat, 23 Jul 2022 23:10:47 +0000 (23:10 +0000)
committerMichael <heluecht@pirati.ca>
Sat, 23 Jul 2022 23:10:47 +0000 (23:10 +0000)
funkwhale.audio.jsonld [deleted file]
src/Protocol/ActivityPub/Processor.php
src/Protocol/ActivityPub/Queue.php
src/Worker/FetchMissingActivity.php
static/funkwhale.audio.jsonld [new file with mode: 0644]

diff --git a/funkwhale.audio.jsonld b/funkwhale.audio.jsonld
deleted file mode 100644 (file)
index 75da1a8..0000000
+++ /dev/null
@@ -1,63 +0,0 @@
-{
-  "@context": {
-    "id": "@id",
-    "type": "@type",
-    "as": "https://www.w3.org/ns/activitystreams#",
-    "schema": "http://schema.org#",
-    "fw": "https://funkwhale.audio/ns#",
-    "xsd": "http://www.w3.org/2001/XMLSchema#",
-    "Album": "fw:Album",
-    "Track": "fw:Track",
-    "Artist": "fw:Artist",
-    "Library": "fw:Library",
-    "bitrate": {
-      "@id": "fw:bitrate",
-      "@type": "xsd:nonNegativeInteger"
-    },
-    "size": {
-      "@id": "fw:size",
-      "@type": "xsd:nonNegativeInteger"
-    },
-    "position": {
-      "@id": "fw:position",
-      "@type": "xsd:nonNegativeInteger"
-    },
-    "disc": {
-      "@id": "fw:disc",
-      "@type": "xsd:nonNegativeInteger"
-    },
-    "library": {
-      "@id": "fw:library",
-      "@type": "@id"
-    },
-    "track": {
-      "@id": "fw:track",
-      "@type": "@id"
-    },
-    "cover": {
-      "@id": "fw:cover",
-      "@type": "as:Link"
-    },
-    "album": {
-      "@id": "fw:album",
-      "@type": "@id"
-    },
-    "artists": {
-      "@id": "fw:artists",
-      "@type": "@id",
-      "@container": "@list"
-    },
-    "released": {
-      "@id": "fw:released",
-      "@type": "xsd:date"
-    },
-    "musicbrainzId": "fw:musicbrainzId",
-    "license": {
-      "@id": "fw:license",
-      "@type": "@id"
-    },
-    "copyright": "fw:copyright",
-    "category": "sc:category",
-    "language": "sc:inLanguage"
-  }
-}
index 1a7458c0e43cc604a27c8005953c56b4c8e313a1..aa169ab028b31c508f06b27da8d60de08ed1e6eb 100644 (file)
@@ -935,7 +935,7 @@ class Processor
                                Logger::info('Item insertion successful', ['user' => $item['uid'], 'item_id' => $item_id]);
                                $success = true;
                        } else {
-                               Logger::notice('Item insertion aborted', ['user' => $item['uid']]);
+                               Logger::notice('Item insertion aborted', ['uri' => $item['uri'], 'uid' => $item['uid']]);
                        }
 
                        if ($item['uid'] == 0) {
index 6d0bed3e1ce8f0ca7734c9a04009b26f16877a3d..d150f9f9cc439f69dd4278927ec70bb15b15f9bd 100644 (file)
@@ -179,7 +179,9 @@ class Queue
         */
        public static function clear()
        {
-               DBA::delete('inbox-entry', ["`wid` IS NULL AND `received` < ?", DateTimeFormat::utc('now - 4 hours')]);
+               // We delete all entries that aren't associated with a worker entry after seven days.
+               // The other entries are deleted when the worker deferred for too long.
+               DBA::delete('inbox-entry', ["`wid` IS NULL AND `received` < ?", DateTimeFormat::utc('now - 7 days')]);
        }
 
        /**
@@ -190,7 +192,7 @@ class Queue
         */
        public static function processReplyByUri(string $uri)
        {
-               $entries = DBA::select('inbox-entry', ['id'], ['in-reply-to-id' => $uri], ['order' => ['id' => true]]);
+               $entries = DBA::select('inbox-entry', ['id'], ["`in-reply-to-id` = ? AND `object-id` != ?", $uri, $uri]);
                while ($entry = DBA::fetch($entries)) {
                        self::process($entry['id']);
                }
index 1a2818c3ccbd534b8e4f76af0c3b7e31cad6aff5..6cb832c779b0051348b161c5d57d9680bfb61324 100644 (file)
@@ -42,6 +42,7 @@ class FetchMissingActivity
                        Queue::processReplyByUri($url);
                } elseif (!Worker::defer()) {
                        Logger::info('Activity could not be fetched', ['url' => $url]);
+                       // @todo performe recursive deletion of all entries
                } else {
                        Logger::info('Fetching deferred', ['url' => $url]);
                }
diff --git a/static/funkwhale.audio.jsonld b/static/funkwhale.audio.jsonld
new file mode 100644 (file)
index 0000000..75da1a8
--- /dev/null
@@ -0,0 +1,63 @@
+{
+  "@context": {
+    "id": "@id",
+    "type": "@type",
+    "as": "https://www.w3.org/ns/activitystreams#",
+    "schema": "http://schema.org#",
+    "fw": "https://funkwhale.audio/ns#",
+    "xsd": "http://www.w3.org/2001/XMLSchema#",
+    "Album": "fw:Album",
+    "Track": "fw:Track",
+    "Artist": "fw:Artist",
+    "Library": "fw:Library",
+    "bitrate": {
+      "@id": "fw:bitrate",
+      "@type": "xsd:nonNegativeInteger"
+    },
+    "size": {
+      "@id": "fw:size",
+      "@type": "xsd:nonNegativeInteger"
+    },
+    "position": {
+      "@id": "fw:position",
+      "@type": "xsd:nonNegativeInteger"
+    },
+    "disc": {
+      "@id": "fw:disc",
+      "@type": "xsd:nonNegativeInteger"
+    },
+    "library": {
+      "@id": "fw:library",
+      "@type": "@id"
+    },
+    "track": {
+      "@id": "fw:track",
+      "@type": "@id"
+    },
+    "cover": {
+      "@id": "fw:cover",
+      "@type": "as:Link"
+    },
+    "album": {
+      "@id": "fw:album",
+      "@type": "@id"
+    },
+    "artists": {
+      "@id": "fw:artists",
+      "@type": "@id",
+      "@container": "@list"
+    },
+    "released": {
+      "@id": "fw:released",
+      "@type": "xsd:date"
+    },
+    "musicbrainzId": "fw:musicbrainzId",
+    "license": {
+      "@id": "fw:license",
+      "@type": "@id"
+    },
+    "copyright": "fw:copyright",
+    "category": "sc:category",
+    "language": "sc:inLanguage"
+  }
+}