]> git.mxchange.org Git - friendica.git/commitdiff
Config option to process the "view" activity
authorMichael <heluecht@pirati.ca>
Mon, 20 Feb 2023 06:41:28 +0000 (06:41 +0000)
committerMichael <heluecht@pirati.ca>
Mon, 20 Feb 2023 06:41:28 +0000 (06:41 +0000)
database.sql
doc/database/db_config.md [new file with mode: 0644]
src/Protocol/Activity.php
src/Protocol/ActivityPub/Receiver.php
static/dbstructure.config.php
static/defaults.config.php
update.php

index e890d7421a232e9ab313b1e272f3d50208d5943d..053f0c7279b6ad1a8116517728d569cd7b95af0d 100644 (file)
@@ -1,6 +1,6 @@
 -- ------------------------------------------
 -- Friendica 2023.03-dev (Giant Rhubarb)
--- DB_UPDATE_VERSION 1514
+-- DB_UPDATE_VERSION 1515
 -- ------------------------------------------
 
 
diff --git a/doc/database/db_config.md b/doc/database/db_config.md
new file mode 100644 (file)
index 0000000..66796ca
--- /dev/null
@@ -0,0 +1,25 @@
+Table config
+===========
+
+main configuration storage
+
+Fields
+------
+
+| Field | Description               | Type          | Null | Key | Default | Extra          |
+| ----- | ------------------------- | ------------- | ---- | --- | ------- | -------------- |
+| id    |                           | int unsigned  | NO   | PRI | NULL    | auto_increment |
+| cat   | The category of the entry | varbinary(50) | NO   |     |         |                |
+| k     | The key of the entry      | varbinary(50) | NO   |     |         |                |
+| v     |                           | mediumtext    | YES  |     | NULL    |                |
+
+Indexes
+------------
+
+| Name    | Fields         |
+| ------- | -------------- |
+| PRIMARY | id             |
+| cat_k   | UNIQUE, cat, k |
+
+
+Return to [database documentation](help/database)
index c5fca4a5cc63dac44dd80e97dcbd87ff39ea4fc3..aa322f4cf261a1ebb353461d68561c2c9c800b60 100644 (file)
@@ -171,22 +171,23 @@ final class Activity
         */
        const READ       = ActivityNamespace::ACTIVITY2 . 'read';
 
-       const O_UNFOLLOW    = ActivityNamespace::OSTATUS . '/unfollow';
-       const O_UNFAVOURITE = ActivityNamespace::OSTATUS . '/unfavorite';
-
        /**
-        * React to a post via an emoji
+        * Indicates that the actor has viewed the object.
         *
+        * @see https://www.w3.org/TR/activitystreams-vocabulary/#dfn-view
         * @var string
         */
-       const EMOJIREACT = ActivityNamespace::LITEPUB . '/emojireact';
+       const VIEW       = ActivityNamespace::ACTIVITY2 . 'view';
+
+       const O_UNFOLLOW    = ActivityNamespace::OSTATUS . '/unfollow';
+       const O_UNFAVOURITE = ActivityNamespace::OSTATUS . '/unfavorite';
 
        /**
-        * View notification from Peertube
+        * React to a post via an emoji
         *
         * @var string
         */
-       const VIEW       = ActivityNamespace::PEERTUBE . '/view';
+       const EMOJIREACT = ActivityNamespace::LITEPUB . '/emojireact';
 
        /**
         * likes (etc.) can apply to other things besides posts. Check if they are post children,
index 16257c2f95b58149e55f575423bace1c6a801478..4b8f1557b88e3aaaa29e85c01406dee915052021 100644 (file)
@@ -559,7 +559,7 @@ class Receiver
                        return true;
                }
 
-               if ($type == 'as:View') {
+               if (!DI::config()->get('system', 'process_view') && ($type == 'as:View')) {
                        Logger::info('View activities are ignored.', ['signer' => $signer, 'http_signer' => $http_signer]);
                        return true;
                }
index dcab1d0c8720095d28bc72be089b7dd25ad19b01..83c890915df78719f97a901c730b058fc1552479 100644 (file)
@@ -55,7 +55,7 @@
 use Friendica\Database\DBA;
 
 if (!defined('DB_UPDATE_VERSION')) {
-       define('DB_UPDATE_VERSION', 1514);
+       define('DB_UPDATE_VERSION', 1515);
 }
 
 return [
index bb82473fa9003c7d91c2d5dcc2e888a6f67e6f18..2c45e45e48677055e0470e7abccc11adbe3e3d3a 100644 (file)
@@ -503,6 +503,10 @@ return [
                // Sets the ImageMagick compression level for PNG images. Values range from 0 (uncompressed) to 9 (most compressed).
                'png_quality' => 8,
 
+               // process_view (Boolean)
+               // Process the "View" activity that is used by Peertube. View activities are displayed, when "emoji_activities" are enabled. 
+               'process_view' => false,
+
                // profiler (Boolean)
                // Enable internal timings to help optimize code. Needed for "rendertime" addon.
                'profiler' => false,
index 86735f864c0e8b2a9d146a95e79529aa14385b40..d6988c1d9ca48faed3e3896b634fcead42b9be4c 100644 (file)
@@ -59,6 +59,7 @@ use Friendica\Model\Photo;
 use Friendica\Model\Post;
 use Friendica\Model\Profile;
 use Friendica\Model\User;
+use Friendica\Protocol\Activity;
 use Friendica\Protocol\Delivery;
 use Friendica\Security\PermissionSet\Repository\PermissionSet;
 
@@ -1287,3 +1288,9 @@ function update_1514()
 
        return Update::SUCCESS;
 }
+
+function update_1515()
+{
+       DBA::update('verb', ['name' => Activity::VIEW], ['name' => 'https://joinpeertube.org/view']);
+       return Update::SUCCESS;
+}