OStatus support removed

This commit is contained in:
Michael 2024-08-24 04:27:00 +00:00
parent eb066b258d
commit e8a3be6820
87 changed files with 773 additions and 4383 deletions

View file

@ -70,8 +70,6 @@ CREATE TABLE IF NOT EXISTS `user` (
`theme` varchar(255) NOT NULL DEFAULT '' COMMENT 'user theme preference',
`pubkey` text COMMENT 'RSA public key 4096 bit',
`prvkey` text COMMENT 'RSA private key 4096 bit',
`spubkey` text COMMENT '',
`sprvkey` text COMMENT '',
`verified` boolean NOT NULL DEFAULT '0' COMMENT 'user is verified through email',
`blocked` boolean NOT NULL DEFAULT '0' COMMENT '1 for user is blocked',
`blockwall` boolean NOT NULL DEFAULT '0' COMMENT 'Prohibit contacts to post to the profile page of the user',
@ -183,7 +181,6 @@ CREATE TABLE IF NOT EXISTS `contact` (
`remote_self` boolean NOT NULL DEFAULT '0' COMMENT '',
`rel` tinyint unsigned NOT NULL DEFAULT 0 COMMENT 'The kind of the relation between the user and the contact',
`protocol` char(4) NOT NULL DEFAULT '' COMMENT 'Protocol of the contact',
`subhub` boolean NOT NULL DEFAULT '0' COMMENT '',
`hub-verify` varbinary(383) NOT NULL DEFAULT '' COMMENT '',
`rating` tinyint NOT NULL DEFAULT 0 COMMENT 'Automatically detected feed poll frequency',
`priority` tinyint unsigned NOT NULL DEFAULT 0 COMMENT 'Feed poll priority',
@ -1345,7 +1342,6 @@ CREATE TABLE IF NOT EXISTS `post-delivery-data` (
`dfrn` mediumint NOT NULL DEFAULT 0 COMMENT 'Number of successful deliveries via DFRN',
`legacy_dfrn` mediumint NOT NULL DEFAULT 0 COMMENT 'Number of successful deliveries via legacy DFRN',
`diaspora` mediumint NOT NULL DEFAULT 0 COMMENT 'Number of successful deliveries via Diaspora',
`ostatus` mediumint NOT NULL DEFAULT 0 COMMENT 'Number of successful deliveries via OStatus',
PRIMARY KEY(`uri-id`),
FOREIGN KEY (`uri-id`) REFERENCES `item-uri` (`id`) ON UPDATE RESTRICT ON DELETE CASCADE
) DEFAULT COLLATE utf8mb4_general_ci COMMENT='Delivery data for items';
@ -1812,26 +1808,6 @@ CREATE TABLE IF NOT EXISTS `profile_field` (
FOREIGN KEY (`psid`) REFERENCES `permissionset` (`id`) ON UPDATE RESTRICT ON DELETE RESTRICT
) DEFAULT COLLATE utf8mb4_general_ci COMMENT='Custom profile fields';
--
-- TABLE push_subscriber
--
CREATE TABLE IF NOT EXISTS `push_subscriber` (
`id` int unsigned NOT NULL auto_increment COMMENT 'sequential ID',
`uid` mediumint unsigned NOT NULL DEFAULT 0 COMMENT 'User id',
`callback_url` varbinary(383) NOT NULL DEFAULT '' COMMENT '',
`topic` varchar(255) NOT NULL DEFAULT '' COMMENT '',
`nickname` varchar(255) NOT NULL DEFAULT '' COMMENT '',
`push` tinyint NOT NULL DEFAULT 0 COMMENT 'Retrial counter',
`last_update` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'Date of last successful trial',
`next_try` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'Next retrial date',
`renewed` datetime NOT NULL DEFAULT '0001-01-01 00:00:00' COMMENT 'Date of last subscription renewal',
`secret` varchar(255) NOT NULL DEFAULT '' COMMENT '',
PRIMARY KEY(`id`),
INDEX `next_try` (`next_try`),
INDEX `uid` (`uid`),
FOREIGN KEY (`uid`) REFERENCES `user` (`uid`) ON UPDATE RESTRICT ON DELETE CASCADE
) DEFAULT COLLATE utf8mb4_general_ci COMMENT='Used for OStatus: Contains feed subscribers';
--
-- TABLE register
--
@ -2010,7 +1986,6 @@ CREATE TABLE IF NOT EXISTS `user-contact` (
`remote_self` tinyint unsigned COMMENT '0 => No mirroring, 1-2 => Mirror as own post, 3 => Mirror as reshare',
`fetch_further_information` tinyint unsigned COMMENT '0 => None, 1 => Fetch information, 3 => Fetch keywords, 2 => Fetch both',
`ffi_keyword_denylist` text COMMENT '',
`subhub` boolean COMMENT '',
`hub-verify` varbinary(383) COMMENT '',
`protocol` char(4) COMMENT 'Protocol of the contact',
`rating` tinyint COMMENT 'Automatically detected feed poll frequency',
@ -3516,7 +3491,6 @@ CREATE VIEW `owner-view` AS SELECT
`contact`.`poll` AS `poll`,
`contact`.`confirm` AS `confirm`,
`contact`.`poco` AS `poco`,
`contact`.`subhub` AS `subhub`,
`contact`.`hub-verify` AS `hub-verify`,
`contact`.`last-update` AS `last-update`,
`contact`.`success_update` AS `success_update`,
@ -3565,8 +3539,6 @@ CREATE VIEW `owner-view` AS SELECT
`user`.`theme` AS `theme`,
`user`.`pubkey` AS `upubkey`,
`user`.`prvkey` AS `uprvkey`,
`user`.`sprvkey` AS `sprvkey`,
`user`.`spubkey` AS `spubkey`,
`user`.`verified` AS `verified`,
`user`.`blockwall` AS `blockwall`,
`user`.`hidewall` AS `hidewall`,
@ -3763,7 +3735,6 @@ CREATE VIEW `account-user-view` AS SELECT
`ucontact`.`readonly` AS `readonly`,
`ucontact`.`blocked` AS `blocked`,
`ucontact`.`block_reason` AS `block_reason`,
`ucontact`.`subhub` AS `subhub`,
`ucontact`.`hub-verify` AS `hub-verify`,
`ucontact`.`reason` AS `reason`,
`contact`.`notify` AS `dfrn-notify`,

View file

@ -84,7 +84,6 @@ Alternatives are presented with "|".
* network:dspr | network:diaspora - The Diaspora protocol is mainly used by Diaspora itself. Some other systems support the protocol as well like Hubzilla, Socialhome or Ganggo.
* network:feed - RSS/Atom feeds
* network:mail - Mails that had been imported via IMAP.
* network:stat | network:ostatus - The OStatus protocol is mainly used by old GNU Social installations.
* network:dscs | network:discourse - Posts that are received by the Discourse connector.
* network:tmbl | network:tumblr - Posts that are received by the Tumblr connector.
* network:bsky | network:bluesky - Posts that are received by the Bluesky connector.

View file

@ -28,23 +28,6 @@ Diaspora
Add the Diaspora 'handle' to the 'Connect/Follow' text box on your [Contacts](contacts) page.
GNU Social
---
This is described as the "federated social web" or OStatus contacts.
Please note that there are **no** privacy provisions on the OStatus network.
Any message which is delivered to **any** OStatus member is visible to anybody in the world and will negate any privacy settings that you have in effect.
These messages will also turn up in public searches.
Since OStatus communications do not use authentication, if you select the profile privacy option to hide your profile and messages from unknown viewers, OStatus members will **not** be able to receive your communications.
To connect with an OStatus member insert their profile URL or Identity address into the Connect box on your [Contacts](contacts) page.
The GNU Social connector may be used if you wish posts to appear on an OStatus site using an existing OStatus account.
It is not necessary to do this, as you may 'follow' OStatus members from Friendica and they may follow you (by placing their own Identity Address into your 'Connect' page).
Blogger, Wordpress, RSS feeds, arbitrary web pages
---

View file

@ -14,10 +14,6 @@ Please go to /admin/site/ on your system and change the following values:
This value reduces the data that is send from the server to the client. 50 is a value that doesn't influences image quality too much.
Set "OStatus conversation completion interval" to "never".
If you have many OStatus contacts then completing of conversations can take some time. Since you will miss several comments in OStatus threads, you maybe should consider the option "At post arrival" instead.
Enable "Use MySQL full text engine"
When using MyISAM (default) or InnoDB on MariaDB 10 this speeds up search.

View file

@ -21,11 +21,6 @@ Friendica will recreate your account on the new server, with your contacts and c
A message is sent to Friendica contacts, to inform them about your move:
If your contacts are running on an updated server, your details on their side will be automatically updated.
GNU Social contacts
---
Contacts on GNU Social will be archived, as we can't inform them about your move.
You should ask them to remove your contact from their lists and re-add you, and you should do the same with their contact.
Diaspora contacts
---
Newer Diaspora servers are able to process "account migration" messages.

View file

@ -20,23 +20,9 @@ Additional types are used for non standard activities.
* [Link to the specification](http://activitystrea.ms/head/activity-schema.html)
* [List of used ActivityStreams verbs and object types.](https://github.com/friendica/friendica/wiki/ActivityStreams)
Salmon
---
Salmon is used as a message exchange protocol for replies and mentions.
* [Link to the protocol summary](http://www.salmon-protocol.org/salmon-protocol-summary)
Portable Contacts
---
Portable Contacts is used for friends lists.
* [Link to the specification](https://web.archive.org/web/20160426223008/http://portablecontacts.net/draft-spec.html) (Link to archive.org)
pubsubhubbub
---
pubsubhubbub is used for OStatus.
* [Link to the specification](https://pubsubhubbub.github.io/PubSubHubbub/pubsubhubbub-core-0.4.html)

View file

@ -80,7 +80,6 @@ Database Tables
| [process](help/database/db_process) | Currently running system processes |
| [profile](help/database/db_profile) | user profiles data |
| [profile_field](help/database/db_profile_field) | Custom profile fields |
| [push_subscriber](help/database/db_push_subscriber) | Used for OStatus: Contains feed subscribers |
| [register](help/database/db_register) | registrations requiring admin approval |
| [report](help/database/db_report) | |
| [report-post](help/database/db_report-post) | Individual posts attached to a moderation report |

View file

@ -59,7 +59,6 @@ Fields
| remote_self | | boolean | NO | | 0 | |
| rel | The kind of the relation between the user and the contact | tinyint unsigned | NO | | 0 | |
| protocol | Protocol of the contact | char(4) | NO | | | |
| subhub | | boolean | NO | | 0 | |
| hub-verify | | varbinary(383) | NO | | | |
| rating | Automatically detected feed poll frequency | tinyint | NO | | 0 | |
| priority | Feed poll priority | tinyint unsigned | NO | | 0 | |

View file

@ -18,7 +18,6 @@ Fields
| dfrn | Number of successful deliveries via DFRN | mediumint | NO | | 0 | |
| legacy_dfrn | Number of successful deliveries via legacy DFRN | mediumint | NO | | 0 | |
| diaspora | Number of successful deliveries via Diaspora | mediumint | NO | | 0 | |
| ostatus | Number of successful deliveries via OStatus | mediumint | NO | | 0 | |
Indexes
------------

View file

@ -1,38 +0,0 @@
Table push_subscriber
===========
Used for OStatus: Contains feed subscribers
Fields
------
| Field | Description | Type | Null | Key | Default | Extra |
| ------------ | --------------------------------- | ------------------ | ---- | --- | ------------------- | -------------- |
| id | sequential ID | int unsigned | NO | PRI | NULL | auto_increment |
| uid | User id | mediumint unsigned | NO | | 0 | |
| callback_url | | varbinary(383) | NO | | | |
| topic | | varchar(255) | NO | | | |
| nickname | | varchar(255) | NO | | | |
| push | Retrial counter | tinyint | NO | | 0 | |
| last_update | Date of last successful trial | datetime | NO | | 0001-01-01 00:00:00 | |
| next_try | Next retrial date | datetime | NO | | 0001-01-01 00:00:00 | |
| renewed | Date of last subscription renewal | datetime | NO | | 0001-01-01 00:00:00 | |
| secret | | varchar(255) | NO | | | |
Indexes
------------
| Name | Fields |
| -------- | -------- |
| PRIMARY | id |
| next_try | next_try |
| uid | uid |
Foreign Keys
------------
| Field | Target Table | Target Field |
|-------|--------------|--------------|
| uid | [user](help/database/db_user) | uid |
Return to [database documentation](help/database)

View file

@ -25,7 +25,6 @@ Fields
| remote_self | 0 => No mirroring, 1-2 => Mirror as own post, 3 => Mirror as reshare | tinyint unsigned | YES | | NULL | |
| fetch_further_information | 0 => None, 1 => Fetch information, 3 => Fetch keywords, 2 => Fetch both | tinyint unsigned | YES | | NULL | |
| ffi_keyword_denylist | | text | YES | | NULL | |
| subhub | | boolean | YES | | NULL | |
| hub-verify | | varbinary(383) | YES | | NULL | |
| protocol | Protocol of the contact | char(4) | YES | | NULL | |
| rating | Automatically detected feed poll frequency | tinyint | YES | | NULL | |

View file

@ -27,8 +27,6 @@ Fields
| theme | user theme preference | varchar(255) | NO | | | |
| pubkey | RSA public key 4096 bit | text | YES | | NULL | |
| prvkey | RSA private key 4096 bit | text | YES | | NULL | |
| spubkey | | text | YES | | NULL | |
| sprvkey | | text | YES | | NULL | |
| verified | user is verified through email | boolean | NO | | 0 | |
| blocked | 1 for user is blocked | boolean | NO | | 0 | |
| blockwall | Prohibit contacts to post to the profile page of the user | boolean | NO | | 0 | |

View file

@ -84,7 +84,6 @@ Alternativen werden durch "|" dargestellt.
* network:dspr | network:diaspora - Das Diaspora-Protokoll wird hauptsächlich von Diaspora selbst genutzt. Ein paar andere Systeme unterstützen dieses Protokoll ebenfalls, wie Hubzilla, Socialhome or Ganggo.
* network:feed - RSS/Atom feeds
* network:mail - Mails die via IMAP importiert worden sind.
* network:stat | network:ostatus - Das OStatus-Protokoll wird hauptsächlich von alten GNU Social-Installationen genutzt.
* network:dscs | network:discourse - Beiträge, die über den Discourse connector empfangen werden.
* network:tmbl | network:tumblr - Beiträge, die über den Tumblr connector empfangen werden.
* network:bsky | network:bluesky - Beiträge, die über den Bluesky connector empfangen werden.

View file

@ -27,24 +27,6 @@ Ebenso kannst Du deren Identitäts-Adresse in der "Verbinden"-Box auf Deiner ["K
Füge die Diaspora-Identitäts-Adresse (z.B. name@diasporapod.com)auf Deiner ["Kontakte"-Seite](contacts) in das Feld "Neuen Kontakt hinzufügen" ein.
**GNU Social**
Dieses Netzwerk wird als "federated social web" bzw. "OStatus"-Kontakte bezeichnet.
Bitte beachte, dass es **keine** Einstellungen zur Privatssphäre im OStatus-Netzwerk gibt.
**Jede** Nachricht, die an eines dieser OStatus-Mitglieder verschickt wird, ist für jeden auf der Welt sichtbar; alle Privatssphäreneinstellungen verlieren ihre Wirkung.
Diese Nachrichten erscheinen ebenfalls in öffentlichen Suchergebnissen.
Da die OStatus-Kommunikation keine Authentifizierung benutzt, können OStatus-Nutzer *keine* Nachrichten empfangen, wenn Du in Deinen Privatssphäreneinstellungen "Profil und Nachrichten vor Unbekannten verbergen" wählst.
Um Dich mit einem OStatus-Mitglied zu verbinden, trage deren Profil-URL oder Identitäts-Adresse auf Deiner ["Kontakte"-Seite](contacts) in das Feld "Neuen Kontakt hinzufügen" ein.
Der GNU Social-Konnektor kann genutzt werden, wenn Du Beiträge schreiben willst, die auf einer OStatus-Seite über einen existierenden OStatus-Account erscheinen sollen.
Das ist nicht notwendig, wenn Du OStatus-Mitgliedern von Friendica aus folgst und diese Dir auch folgen, indem sie auf Deiner Kontaktseite ihre eigene Identitäts-Adresse eingeben.
**Blogger, Wordpress, RSS feeds, andere Webseiten**
Trage die URL auf Deiner ["Kontakte"-Seite](contacts) in das Feld "Neuen Kontakt hinzufügen" ein.

View file

@ -388,38 +388,14 @@ function photos_post()
foreach ($tags as $tag) {
if (strpos($tag, '@') === 0) {
$profile = '';
$contact = null;
$name = substr($tag, 1);
if ((strpos($name, '@')) || (strpos($name, 'http://'))) {
$contact = Contact::getByURL($name);
if (empty($contact)) {
$newname = $name;
$links = @Probe::lrdd($name);
if (count($links)) {
foreach ($links as $link) {
if ($link['@attributes']['rel'] === ActivityNamespace::WEBFINGERPROFILE) {
$profile = $link['@attributes']['href'];
}
if ($link['@attributes']['rel'] === 'salmon') {
$salmon = '$url:' . str_replace(',', '%sc', $link['@attributes']['href']);
if (strlen($inform)) {
$inform .= ',';
}
$inform .= $salmon;
}
}
}
$taginfo[] = [$newname, $profile, $salmon];
} else {
$newname = $name;
$tagcid = 0;
if (strrpos($newname, '+')) {
$tagcid = intval(substr($newname, strrpos($newname, '+') + 1));
} else {
$tagcid = 0;
}
if ($tagcid) {
@ -439,17 +415,17 @@ function photos_post()
);
}
}
}
if (DBA::isResult($contact)) {
$newname = $contact['name'];
$profile = $contact['url'];
if (DBA::isResult($contact)) {
$newname = $contact['name'];
$profile = $contact['url'];
$notify = 'cid:' . $contact['id'];
if (strlen($inform)) {
$inform .= ',';
}
$inform .= $notify;
$notify = 'cid:' . $contact['id'];
if (strlen($inform)) {
$inform .= ',';
}
$inform .= $notify;
}
if ($profile) {

View file

@ -53,11 +53,8 @@ class Mode
'objects',
'outbox',
'poco',
'pubsub',
'pubsubhubbub',
'receive',
'rsd_xml',
'salmon',
'statistics_json',
'xrd',
];

View file

@ -25,7 +25,6 @@ use Friendica\Model\Contact;
* @property-read int $remoteSelf
* @property-read int $fetchFurtherInformation
* @property-read string $ffiKeywordDenylist
* @property-read bool $subhub
* @property-read string $hubVerify
* @property-read string $protocol
* @property-read int $rating
@ -69,8 +68,6 @@ class LocalRelationship extends \Friendica\BaseEntity
protected $fetchFurtherInformation;
/** @var string */
protected $ffiKeywordDenylist;
/** @var bool */
protected $subhub;
/** @var string */
protected $hubVerify;
/** @var string */
@ -80,7 +77,7 @@ class LocalRelationship extends \Friendica\BaseEntity
/** @var int */
protected $priority;
public function __construct(int $userId, int $contactId, bool $blocked = false, bool $ignored = false, bool $collapsed = false, bool $hidden = false, bool $pending = false, int $rel = Contact::NOTHING, string $info = '', bool $notifyNewPosts = false, int $remoteSelf = self::MIRROR_DEACTIVATED, int $fetchFurtherInformation = self::FFI_NONE, string $ffiKeywordDenylist = '', bool $subhub = false, string $hubVerify = '', string $protocol = Protocol::PHANTOM, ?int $rating = null, ?int $priority = null)
public function __construct(int $userId, int $contactId, bool $blocked = false, bool $ignored = false, bool $collapsed = false, bool $hidden = false, bool $pending = false, int $rel = Contact::NOTHING, string $info = '', bool $notifyNewPosts = false, int $remoteSelf = self::MIRROR_DEACTIVATED, int $fetchFurtherInformation = self::FFI_NONE, string $ffiKeywordDenylist = '', string $hubVerify = '', string $protocol = Protocol::PHANTOM, ?int $rating = null, ?int $priority = null)
{
$this->userId = $userId;
$this->contactId = $contactId;
@ -95,7 +92,6 @@ class LocalRelationship extends \Friendica\BaseEntity
$this->remoteSelf = $remoteSelf;
$this->fetchFurtherInformation = $fetchFurtherInformation;
$this->ffiKeywordDenylist = $ffiKeywordDenylist;
$this->subhub = $subhub;
$this->hubVerify = $hubVerify;
$this->protocol = $protocol;
$this->rating = $rating;

View file

@ -34,7 +34,6 @@ class LocalRelationship extends BaseFactory implements ICanCreateFromTableRow
$row['remote_self'] ?? Entity\LocalRelationship::MIRROR_DEACTIVATED,
$row['fetch_further_information'] ?? Entity\LocalRelationship::FFI_NONE,
$row['ffi_keyword_denylist'] ?? '',
$row['subhub'] ?? false,
$row['hub-verify'] ?? '',
$row['protocol'] ?? Protocol::PHANTOM,
$row['rating'] ?? null,

View file

@ -89,7 +89,6 @@ class LocalRelationship extends \Friendica\BaseRepository
'remote_self' => $localRelationship->remoteSelf,
'fetch_further_information' => $localRelationship->fetchFurtherInformation,
'ffi_keyword_denylist' => $localRelationship->ffiKeywordDenylist,
'subhub' => $localRelationship->subhub,
'hub-verify' => $localRelationship->hubVerify,
'protocol' => $localRelationship->protocol,
'rating' => $localRelationship->rating,

View file

@ -48,7 +48,6 @@ class BBCode
const CONNECTORS = 4;
const TWITTER_API = 5;
const NPF = 6;
const OSTATUS = 7;
const TWITTER = 8;
const BACKLINK = 8;
const ACTIVITYPUB = 9;
@ -910,9 +909,6 @@ class BBCode
$text = ($is_quote_share ? '<hr />' : '') . $headline . '<blockquote class="shared_content" dir="auto">' . trim($content) . '</blockquote>' . "\n";
break;
case self::OSTATUS:
$text = ($is_quote_share ? '<br>' : '') . '<p>' . html_entity_decode('&#x2672; ', ENT_QUOTES, 'UTF-8') . ' @' . $author_contact['addr'] . ': ' . $content . '</p>' . "\n";
break;
case self::ACTIVITYPUB:
$author = '@<span class="vcard"><a href="' . $author_contact['url'] . '" class="url u-url mention" title="' . $author_contact['addr'] . '"><span class="fn nickname mention">' . $author_contact['addr'] . '</span></a>:</span>';
@ -1252,7 +1248,7 @@ class BBCode
* - 4: Used for WordPress, Libertree (before Markdown), pump.io and tumblr
* - 5: Unused
* - 6: Unused
* - 7: Used for dfrn, OStatus
* - 7: Used for dfrn
* - 8: Used for Twitter, WP backlink text setting
* - 9: ActivityPub
*
@ -1283,7 +1279,7 @@ class BBCode
* - 4: Used for WordPress, Libertree (before Markdown), pump.io and tumblr
* - 5: Unused
* - 6: Unused
* - 7: Used for dfrn, OStatus
* - 7: Used for dfrn
* - 8: Used for Twitter, WP backlink text setting
* - 9: ActivityPub
*
@ -1971,7 +1967,7 @@ class BBCode
'@<a href="$2">$3</a>',
$text
);
} elseif (in_array($simple_html, [self::OSTATUS, self::ACTIVITYPUB])) {
} elseif (in_array($simple_html, [self::ACTIVITYPUB])) {
$text = preg_replace(
"/([@!])\[url\=(.*?)\](.*?)\[\/url\]/ism",
'<span class="h-card"><a href="$2" class="u-url mention">$1<span>$3</span></a></span>',
@ -2017,7 +2013,7 @@ class BBCode
$text
);
if (in_array($simple_html, [self::OSTATUS, self::TWITTER, self::BLUESKY])) {
if (in_array($simple_html, [self::TWITTER, self::BLUESKY])) {
$text = preg_replace_callback("/([^#@!])\[url\=([^\]]*)\](.*?)\[\/url\]/ism", [self::class, 'expandLinksCallback'], $text);
//$text = preg_replace("/[^#@!]\[url\=([^\]]*)\](.*?)\[\/url\]/ism", ' $2 [url]$1[/url]', $text);
$text = preg_replace("/\[bookmark\=([^\]]*)\](.*?)\[\/bookmark\]/ism", ' $2 [url]$1[/url]', $text);
@ -2075,7 +2071,7 @@ class BBCode
// Red compatibility, though the link can't be authenticated on Friendica
$text = preg_replace("/\[zrl\=(.*?)\](.*?)\[\/zrl\]/ism", '[url=$1]$2[/url]', $text);
if (in_array($simple_html, [self::INTERNAL, self::EXTERNAL, self::DIASPORA, self::OSTATUS, self::MASTODON_API, self::TWITTER_API, self::ACTIVITYPUB])) {
if (in_array($simple_html, [self::INTERNAL, self::EXTERNAL, self::DIASPORA, self::MASTODON_API, self::TWITTER_API, self::ACTIVITYPUB])) {
$text = self::shortenLinkDescription($text, $simple_html);
} else {
$text = self::unifyLinks($text);

View file

@ -119,10 +119,6 @@ class Plaintext
$abstract = BBCode::getAbstract($item['body'], Protocol::TWITTER);
break;
case BBCode::OSTATUS:
$abstract = BBCode::getAbstract($item['body'], Protocol::STATUSNET);
break;
case BBCode::BLUESKY:
$abstract = BBCode::getAbstract($item['body'], Protocol::BLUESKY);
break;

View file

@ -88,17 +88,13 @@ class Widget
public static function unavailableNetworks(): array
{
// Always hide content from these networks
$networks = [Protocol::PHANTOM, Protocol::FACEBOOK, Protocol::APPNET, Protocol::TWITTER, Protocol::ZOT];
$networks = [Protocol::PHANTOM, Protocol::FACEBOOK, Protocol::APPNET, Protocol::TWITTER, Protocol::ZOT, Protocol::OSTATUS, Protocol::STATUSNET];
Addon::loadAddons();
if (!Addon::isEnabled("discourse")) {
$networks[] = Protocol::DISCOURSE;
}
if (!Addon::isEnabled("statusnet")) {
$networks[] = Protocol::STATUSNET;
}
if (!Addon::isEnabled("pumpio")) {
$networks[] = Protocol::PUMPIO;
}
@ -107,10 +103,6 @@ class Widget
$networks[] = Protocol::TUMBLR;
}
if (DI::config()->get("system", "ostatus_disabled")) {
$networks[] = Protocol::OSTATUS;
}
if (!DI::config()->get("system", "diaspora_enabled")) {
$networks[] = Protocol::DIASPORA;
}

View file

@ -59,7 +59,7 @@ class ContactBlock
'hidden' => false,
'archive' => false,
'failed' => false,
'network' => [Protocol::DFRN, Protocol::ACTIVITYPUB, Protocol::OSTATUS, Protocol::DIASPORA, Protocol::FEED],
'network' => [Protocol::DFRN, Protocol::ACTIVITYPUB, Protocol::DIASPORA, Protocol::FEED],
]);
$contacts_title = DI::l10n()->t('No contacts');

View file

@ -8,14 +8,10 @@
namespace Friendica\Core;
use Friendica\Database\DBA;
use Friendica\Model\Item;
use Friendica\Model\User;
use Friendica\Network\HTTPException;
use Friendica\Protocol\Activity;
use Friendica\Protocol\ActivityPub;
use Friendica\Protocol\Diaspora;
use Friendica\Protocol\OStatus;
use Friendica\Protocol\Salmon;
/**
* Manage compatibility with federated networks
@ -28,24 +24,24 @@ class Protocol
const DIASPORA = 'dspr'; // Diaspora, Hubzilla, Socialhome, Ganggo
const FEED = 'feed'; // RSS/Atom feeds with no known "post/notify" protocol
const MAIL = 'mail'; // IMAP/POP
const OSTATUS = 'stat'; // GNU Social and other OStatus implementations
const NATIVE_SUPPORT = [self::DFRN, self::DIASPORA, self::OSTATUS, self::FEED, self::MAIL, self::ACTIVITYPUB];
const NATIVE_SUPPORT = [self::DFRN, self::DIASPORA, self::FEED, self::MAIL, self::ACTIVITYPUB];
const FEDERATED = [self::DFRN, self::DIASPORA, self::OSTATUS, self::ACTIVITYPUB];
const FEDERATED = [self::DFRN, self::DIASPORA, self::ACTIVITYPUB];
const SUPPORT_PRIVATE = [self::DFRN, self::DIASPORA, self::MAIL, self::ACTIVITYPUB, self::PUMPIO];
// Supported through a connector
const DIASPORA2 = 'dspc'; // Diaspora connector
const PUMPIO = 'pump'; // pump.io
const STATUSNET = 'stac'; // Statusnet connector
const TWITTER = 'twit'; // Twitter
const DISCOURSE = 'dscs'; // Discourse
const TUMBLR = 'tmbl'; // Tumblr
const BLUESKY = 'bsky'; // Bluesky
// Dead protocols
const OSTATUS = 'stat'; // GNU Social and other OStatus implementations
const STATUSNET = 'stac'; // Statusnet connector
const APPNET = 'apdn'; // app.net - Dead protocol
const FACEBOOK = 'face'; // Facebook API - Not working anymore, API is closed
const GPLUS = 'goog'; // Google+ - Dead in 2019
@ -124,27 +120,10 @@ class Protocol
$protocol = $protocol ?? $contact['protocol'];
if (in_array($protocol, [Protocol::OSTATUS, Protocol::DFRN])) {
// create a follow slap
$item = [
'verb' => Activity::FOLLOW,
'gravity' => Item::GRAVITY_ACTIVITY,
'follow' => $contact['url'],
'body' => '',
'title' => '',
'guid' => '',
'uri-id' => 0,
];
$slap = OStatus::salmon($item, $owner);
if (!empty($contact['notify'])) {
Salmon::slapper($owner, $contact['notify'], $slap);
}
} elseif ($protocol == Protocol::DIASPORA) {
if ($protocol == self::DIASPORA) {
$contact = Diaspora::sendShare($owner, $contact);
Logger::notice('share returns: ' . $contact);
} elseif ($protocol == Protocol::ACTIVITYPUB) {
} elseif (in_array($protocol, [self::ACTIVITYPUB, self::DFRN])) {
$activity_id = ActivityPub\Transmitter::activityIDFromContact($contact['id']);
if (empty($activity_id)) {
// This really should never happen
@ -175,33 +154,13 @@ class Protocol
}
$protocol = $contact['network'];
if (($protocol == Protocol::DFRN) && !empty($contact['protocol'])) {
if (($protocol == self::DFRN) && !empty($contact['protocol'])) {
$protocol = $contact['protocol'];
}
if (in_array($protocol, [Protocol::OSTATUS, Protocol::DFRN])) {
// create an unfollow slap
$item = [
'verb' => Activity::O_UNFOLLOW,
'gravity' => Item::GRAVITY_ACTIVITY,
'follow' => $contact['url'],
'body' => '',
'title' => '',
'guid' => '',
'uri-id' => 0,
];
$slap = OStatus::salmon($item, $owner);
if (empty($contact['notify'])) {
Logger::notice('OStatus/DFRN Contact is missing notify, we quit here', ['id' => $contact['id']]);
return null;
}
return Salmon::slapper($owner, $contact['notify'], $slap) === 0;
} elseif ($protocol == Protocol::DIASPORA) {
if ($protocol == self::DIASPORA) {
return Diaspora::sendUnshare($owner, $contact) > 0;
} elseif ($protocol == Protocol::ACTIVITYPUB) {
} elseif (in_array($protocol, [self::ACTIVITYPUB, self::DFRN])) {
return ActivityPub\Transmitter::sendContactUndo($contact['url'], $contact['id'], $owner);
}
@ -232,11 +191,11 @@ class Protocol
}
$protocol = $contact['network'];
if ($protocol == Protocol::DFRN && !empty($contact['protocol'])) {
if ($protocol == self::DFRN && !empty($contact['protocol'])) {
$protocol = $contact['protocol'];
}
if ($protocol == Protocol::ACTIVITYPUB) {
if ($protocol == self::ACTIVITYPUB) {
return ActivityPub\Transmitter::sendContactReject($contact['url'], $contact['hub-verify'], $owner);
}

View file

@ -72,7 +72,7 @@ class DBStructure
$old_tables = ['fserver', 'gcign', 'gcontact', 'gcontact-relation', 'gfollower' ,'glink', 'item-delivery-data',
'item-activity', 'item-content', 'item_id', 'participation', 'poll', 'poll_result', 'queue', 'retriever_rule',
'deliverq', 'dsprphotoq', 'ffinder', 'sign', 'spam', 'term', 'user-item', 'thread', 'item', 'challenge',
'auth_codes', 'tokens', 'clients', 'profile_check', 'host', 'conversation', 'fcontact', 'addon'];
'auth_codes', 'tokens', 'clients', 'profile_check', 'host', 'conversation', 'fcontact', 'addon', 'push_subscriber'];
$tables = DBA::selectToArray('INFORMATION_SCHEMA.TABLES', ['TABLE_NAME'],
['TABLE_SCHEMA' => DBA::databaseName(), 'TABLE_TYPE' => 'BASE TABLE']);

View file

@ -788,10 +788,8 @@ class Contact
'url' => DI::baseUrl() . '/profile/' . $user['nickname'],
'nurl' => Strings::normaliseLink(DI::baseUrl() . '/profile/' . $user['nickname']),
'addr' => $user['nickname'] . '@' . substr(DI::baseUrl(), strpos(DI::baseUrl(), '://') + 3),
'request' => DI::baseUrl() . '/dfrn_request/' . $user['nickname'],
'notify' => DI::baseUrl() . '/dfrn_notify/' . $user['nickname'],
'poll' => DI::baseUrl() . '/dfrn_poll/' . $user['nickname'],
'confirm' => DI::baseUrl() . '/dfrn_confirm/' . $user['nickname'],
'notify' => DI::baseUrl() . '/dfrn_notify/' . $user['nickname'],
'poll' => DI::baseUrl() . '/feed/' . $user['nickname'],
'name-date' => DateTimeFormat::utcNow(),
'uri-date' => DateTimeFormat::utcNow(),
'avatar-date' => DateTimeFormat::utcNow(),
@ -873,10 +871,8 @@ class Contact
'nurl' => Strings::normaliseLink($url),
'uri-id' => ItemURI::getIdByURI($url),
'addr' => $user['nickname'] . '@' . substr(DI::baseUrl(), strpos(DI::baseUrl(), '://') + 3),
'request' => DI::baseUrl() . '/dfrn_request/' . $user['nickname'],
'notify' => DI::baseUrl() . '/dfrn_notify/' . $user['nickname'],
'poll' => DI::baseUrl() . '/dfrn_poll/' . $user['nickname'],
'confirm' => DI::baseUrl() . '/dfrn_confirm/' . $user['nickname'],
'poll' => DI::baseUrl() . '/feed/' . $user['nickname'],
];
$avatar = Photo::selectFirst(['resource-id', 'type'], ['uid' => $uid, 'profile' => true]);
@ -2532,22 +2528,6 @@ class Contact
}
self::update($fields, $condition);
// We mustn't set the update fields for OStatus contacts since they are updated in OnePoll
$condition['network'] = Protocol::OSTATUS;
// If the contact failed, propagate the update fields to all contacts
if (empty($fields['failed'])) {
unset($fields['last-update']);
unset($fields['success_update']);
unset($fields['failure_update']);
}
if (empty($fields)) {
return;
}
self::update($fields, $condition);
}
/**
@ -3065,11 +3045,6 @@ class Contact
/**
* Takes a $uid and a url/handle and adds a new contact
*
* Currently if the contact is DFRN, interactive needs to be true, to redirect to the
* dfrn_request page.
*
* Otherwise this can be used to bulk add StatusNet contacts, Twitter contacts, etc.
*
* Returns an array
* $return['success'] boolean true if successful
* $return['message'] error text if success is false.
@ -3170,35 +3145,24 @@ class Contact
return $result;
}
if ($protocol === Protocol::OSTATUS && DI::config()->get('system', 'ostatus_disabled')) {
$result['message'] .= DI::l10n()->t('The profile address specified belongs to a network which has been disabled on this site.') . '<br />';
$ret['notify'] = '';
}
if (!$ret['notify']) {
$result['message'] .= DI::l10n()->t('Limited profile. This person will be unable to receive direct/personal notifications from you.') . '<br />';
}
$writeable = ((($protocol === Protocol::OSTATUS) && ($ret['notify'])) ? 1 : 0);
$subhub = (($protocol === Protocol::OSTATUS) ? true : false);
$hidden = (($protocol === Protocol::MAIL) ? 1 : 0);
$hidden = ($protocol === Protocol::MAIL);
$pending = false;
if (($protocol == Protocol::ACTIVITYPUB) && isset($ret['manually-approve'])) {
$pending = (bool)$ret['manually-approve'];
}
if (in_array($protocol, [Protocol::MAIL, Protocol::DIASPORA, Protocol::ACTIVITYPUB])) {
$writeable = 1;
}
$writeable = in_array($protocol, [Protocol::MAIL, Protocol::DIASPORA, Protocol::ACTIVITYPUB]);
if (DBA::isResult($contact)) {
// update contact
$new_relation = (in_array($contact['rel'], [self::FOLLOWER, self::FRIEND]) ? self::FRIEND : self::SHARING);
$fields = ['rel' => $new_relation, 'subhub' => $subhub, 'readonly' => false, 'network' => $ret['network']];
$fields = ['rel' => $new_relation, 'readonly' => false, 'network' => $ret['network']];
if ($contact['pending'] && !empty($contact['hub-verify'])) {
ActivityPub\Transmitter::sendContactAccept($contact['url'], $contact['hub-verify'], $uid);
@ -3236,7 +3200,6 @@ class Contact
'blocked' => 0,
'readonly' => 0,
'pending' => $pending,
'subhub' => $subhub
]);
}
@ -3258,11 +3221,6 @@ class Contact
// Update the avatar
self::updateAvatar($contact_id, $ret['photo']);
// pull feed and consume it, which should subscribe to the hub.
if ($contact['network'] == Protocol::OSTATUS) {
Worker::add(Worker::PRIORITY_HIGH, 'OnePoll', $contact_id, 'force');
}
if ($probed) {
GServer::updateFromProbeArray($ret);
self::updateFromProbeArray($contact_id, $ret);
@ -3733,10 +3691,6 @@ class Contact
$networks[] = Protocol::DIASPORA;
}
if (!DI::config()->get('system', 'ostatus_disabled')) {
$networks[] = Protocol::OSTATUS;
}
$condition = [
'network' => $networks,
'server-failed' => false,

View file

@ -284,7 +284,7 @@ class Relation
return false;
}
if (!in_array($contact['network'], [Protocol::ACTIVITYPUB, Protocol::DFRN, Protocol::OSTATUS])) {
if (!in_array($contact['network'], [Protocol::ACTIVITYPUB, Protocol::DFRN])) {
$apcontact = APContact::getByURL($url, false);
if (empty($apcontact)) {
Logger::info('No discovery - The contact does not seem to speak ActivityPub.', ['id' => $contact['id'], 'url' => $url, 'network' => $contact['network']]);
@ -369,7 +369,6 @@ class Relation
Logger::info('Collecting suggestions', ['uid' => $uid, 'cid' => $cid, 'start' => $start, 'limit' => $limit]);
$diaspora = DI::config()->get('system', 'diaspora_enabled') ? Protocol::DIASPORA : Protocol::ACTIVITYPUB;
$ostatus = !DI::config()->get('system', 'ostatus_disabled') ? Protocol::OSTATUS : Protocol::ACTIVITYPUB;
// The query returns contacts where contacts interacted with whom the given user follows.
// Contacts who already are in the user's contact table are ignored.
@ -377,12 +376,12 @@ class Relation
(SELECT `cid` FROM `contact-relation` WHERE `relation-cid` = ?)
AND NOT `cid` IN (SELECT `id` FROM `contact` WHERE `uid` = ? AND `nurl` IN
(SELECT `nurl` FROM `contact` WHERE `uid` = ? AND `rel` IN (?, ?))) AND `id` = `cid`)
AND NOT `hidden` AND `network` IN (?, ?, ?, ?)
AND NOT `hidden` AND `network` IN (?, ?, ?)
AND NOT `uri-id` IN (SELECT `uri-id` FROM `account-suggestion` WHERE `uri-id` = `contact`.`uri-id` AND `uid` = ?)",
$cid,
0,
$uid, Contact::FRIEND, Contact::SHARING,
Protocol::ACTIVITYPUB, Protocol::DFRN, $diaspora, $ostatus, $uid
Protocol::ACTIVITYPUB, Protocol::DFRN, $diaspora, $uid
], [
'order' => ['last-item' => true],
'limit' => $totallimit,
@ -408,10 +407,10 @@ class Relation
(SELECT `relation-cid` FROM `contact-relation` WHERE `cid` = ?)
AND NOT `cid` IN (SELECT `id` FROM `contact` WHERE `uid` = ? AND `nurl` IN
(SELECT `nurl` FROM `contact` WHERE `uid` = ? AND `rel` IN (?, ?))) AND `id` = `cid`)
AND NOT `hidden` AND `network` IN (?, ?, ?, ?)
AND NOT `hidden` AND `network` IN (?, ?, ?)
AND NOT `uri-id` IN (SELECT `uri-id` FROM `account-suggestion` WHERE `uri-id` = `contact`.`uri-id` AND `uid` = ?)",
$cid, 0, $uid, Contact::FRIEND, Contact::SHARING,
Protocol::ACTIVITYPUB, Protocol::DFRN, $diaspora, $ostatus, $uid],
Protocol::ACTIVITYPUB, Protocol::DFRN, $diaspora, $uid],
['order' => ['last-item' => true], 'limit' => $totallimit]
);
@ -429,10 +428,10 @@ class Relation
// The query returns contacts that follow the given user but aren't followed by that user.
$results = DBA::select('contact', [],
["`nurl` IN (SELECT `nurl` FROM `contact` WHERE `uid` = ? AND `rel` = ?)
AND NOT `hidden` AND `uid` = ? AND `network` IN (?, ?, ?, ?)
AND NOT `hidden` AND `uid` = ? AND `network` IN (?, ?, ?)
AND NOT `uri-id` IN (SELECT `uri-id` FROM `account-suggestion` WHERE `uri-id` = `contact`.`uri-id` AND `uid` = ?)",
$uid, Contact::FOLLOWER, 0,
Protocol::ACTIVITYPUB, Protocol::DFRN, $diaspora, $ostatus, $uid],
Protocol::ACTIVITYPUB, Protocol::DFRN, $diaspora, $uid],
['order' => ['last-item' => true], 'limit' => $totallimit]
);
@ -450,10 +449,10 @@ class Relation
// The query returns any contact that isn't followed by that user.
$results = DBA::select('contact', [],
["NOT `nurl` IN (SELECT `nurl` FROM `contact` WHERE `uid` = ? AND `rel` IN (?, ?) AND `nurl` = `nurl`)
AND NOT `hidden` AND `uid` = ? AND `network` IN (?, ?, ?, ?)
AND NOT `hidden` AND `uid` = ? AND `network` IN (?, ?, ?)
AND NOT `uri-id` IN (SELECT `uri-id` FROM `account-suggestion` WHERE `uri-id` = `contact`.`uri-id` AND `uid` = ?)",
$uid, Contact::FRIEND, Contact::SHARING, 0,
Protocol::ACTIVITYPUB, Protocol::DFRN, $diaspora, $ostatus, $uid],
Protocol::ACTIVITYPUB, Protocol::DFRN, $diaspora, $uid],
['order' => ['last-item' => true], 'limit' => $totallimit]
);

View file

@ -16,7 +16,7 @@ class Conversation
const PARCEL_ACTIVITYPUB = 0;
const PARCEL_DFRN = 1; // Deprecated
const PARCEL_DIASPORA = 2;
const PARCEL_SALMON = 3;
const PARCEL_SALMON = 3; // @deprecated since version 2024.09
const PARCEL_FEED = 4; // Deprecated
const PARCEL_SPLIT_CONVERSATION = 6; // @deprecated since version 2022.09
const PARCEL_LEGACY_DFRN = 7; // @deprecated since version 2021.09

View file

@ -2617,11 +2617,6 @@ class GServer
return;
}
// We don't want to mark a server as OStatus when it had been marked with any other protocol before
if ($protocol == Post\DeliveryData::OSTATUS) {
return;
}
// If the server is marked as ActivityPub then we won't change it to anything different
if ($old == Post\DeliveryData::ACTIVITYPUB) {
return;

View file

@ -602,16 +602,6 @@ class Item
Logger::notice('duplicated item with the same guid found.', $condition);
return true;
}
} elseif ($item['network'] == Protocol::OSTATUS) {
// Check for an existing post with the same content. There seems to be a problem with OStatus.
$condition = [
"`body` = ? AND `network` = ? AND `created` = ? AND `contact-id` = ? AND `uid` = ?",
$item['body'], $item['network'], $item['created'], $item['contact-id'], $item['uid']
];
if (Post::exists($condition)) {
Logger::notice('duplicated item with the same body found.', $item);
return true;
}
}
/*
@ -705,13 +695,12 @@ class Item
{
if (empty($item['network']) || in_array($item['network'], Protocol::FEDERATED)) {
$condition = [
'`uri-id` = ? AND `uid` = ? AND `network` IN (?, ?, ?, ?)',
'`uri-id` = ? AND `uid` = ? AND `network` IN (?, ?, ?)',
$item['uri-id'],
$item['uid'],
Protocol::ACTIVITYPUB,
Protocol::DIASPORA,
Protocol::DFRN,
Protocol::OSTATUS
Protocol::DFRN
];
$existing = Post::selectFirst(['id', 'network'], $condition);
if (DBA::isResult($existing)) {
@ -908,7 +897,7 @@ class Item
/*
* Do we already have this item?
* We have to check several networks since Friendica posts could be repeated
* via OStatus (maybe Diaspora as well)
* via Diaspora.
*/
$duplicate = self::getDuplicateID($item);
if ($duplicate) {

View file

@ -29,7 +29,7 @@ class DeliveryData
const DFRN = 2;
const LEGACY_DFRN = 3; // @deprecated since version 2021.09
const DIASPORA = 4;
const OSTATUS = 5;
const OSTATUS = 5; // @deprecated since version 2024.09
const MAIL = 6;
/**
@ -83,9 +83,6 @@ class DeliveryData
case self::DIASPORA:
$increments[] = "`diaspora` = `diaspora` + 1";
break;
case self::OSTATUS:
$increments[] = "`ostatus` = `ostatus` + 1";
break;
}
return DBA::update('post-delivery-data', $increments, ['uri-id' => $uri_id]);

View file

@ -30,8 +30,8 @@ class Engagement
const ALTERNATIVES = ['source:news' => 'source:service', 'source:relay' => 'source:application',
'media:picture' => 'media:image', 'media:photo' => 'media:image',
'network:activitypub' => 'network:apub', 'network:friendica' => 'network:dfrn',
'network:diaspora' => 'network:dspr', 'network:ostatus' => 'network:stat',
'network:discourse' => 'network:dscs', 'network:tumblr' => 'network:tmbl', 'network:bluesky' => 'network:bsky'];
'network:diaspora' => 'network:dspr', 'network:discourse' => 'network:dscs',
'network:tumblr' => 'network:tmbl', 'network:bluesky' => 'network:bsky'];
const MEDIA_NONE = 0;
const MEDIA_IMAGE = 1;
const MEDIA_VIDEO = 2;

View file

@ -1,174 +0,0 @@
<?php
// Copyright (C) 2010-2024, the Friendica project
// SPDX-FileCopyrightText: 2010-2024 the Friendica project
//
// SPDX-License-Identifier: AGPL-3.0-or-later
namespace Friendica\Model;
use Friendica\Core\Logger;
use Friendica\Core\Worker;
use Friendica\Database\DBA;
use Friendica\Util\DateTimeFormat;
use GuzzleHttp\Psr7\Uri;
class PushSubscriber
{
/**
* Send subscription notifications for the given user
*
* @param integer $uid User ID
* @param int $default_priority
* @return void
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/
public static function publishFeed(int $uid, int $default_priority = Worker::PRIORITY_HIGH)
{
$condition = ['push' => 0, 'uid' => $uid];
DBA::update('push_subscriber', ['push' => 1, 'next_try' => DBA::NULL_DATETIME], $condition);
self::requeue($default_priority);
}
/**
* start workers to transmit the feed data
*
* @param int $default_priority
* @return void
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/
public static function requeue(int $default_priority = Worker::PRIORITY_HIGH)
{
// We'll push to each subscriber that has push > 0,
// i.e. there has been an update (set in notifier.php).
$subscribers = DBA::select('push_subscriber', ['id', 'push', 'callback_url', 'nickname'], ["`push` > 0 AND `next_try` < ?", DateTimeFormat::utcNow()]);
while ($subscriber = DBA::fetch($subscribers)) {
// We always handle retries with low priority
if ($subscriber['push'] > 1) {
$priority = Worker::PRIORITY_LOW;
} else {
$priority = $default_priority;
}
Logger::info('Publish feed to ' . $subscriber['callback_url'] . ' for ' . $subscriber['nickname'] . ' with priority ' . $priority);
Worker::add($priority, 'PubSubPublish', (int)$subscriber['id']);
}
DBA::close($subscribers);
}
/**
* Renew the feed subscription
*
* @param integer $uid User ID
* @param string $nick Priority for push workers
* @param integer $subscribe Subscribe (Unsubscribe = false)
* @param string $hub_callback Callback address
* @param string $hub_topic Feed topic
* @param string $hub_secret Subscription secret
* @return void
* @throws \Exception
*/
public static function renew(int $uid, string $nick, int $subscribe, string $hub_callback, string $hub_topic, string $hub_secret)
{
// fetch the old subscription if it exists
$subscriber = DBA::selectFirst('push_subscriber', ['last_update', 'push'], ['callback_url' => $hub_callback]);
// delete old subscription if it exists
DBA::delete('push_subscriber', ['callback_url' => $hub_callback]);
if ($subscribe) {
// if we are just updating an old subscription, keep the
// old values for last_update but reset the push
if (DBA::isResult($subscriber)) {
$last_update = $subscriber['last_update'];
$push_flag = min($subscriber['push'], 1);
} else {
$last_update = DateTimeFormat::utcNow();
$push_flag = 0;
}
// subscribe means adding the row to the table
$fields = ['uid' => $uid, 'callback_url' => $hub_callback,
'topic' => $hub_topic, 'nickname' => $nick, 'push' => $push_flag,
'last_update' => $last_update, 'renewed' => DateTimeFormat::utcNow(),
'secret' => $hub_secret];
DBA::insert('push_subscriber', $fields);
Logger::notice("Successfully subscribed [$hub_callback] for $nick");
} else {
Logger::notice("Successfully unsubscribed [$hub_callback] for $nick");
// we do nothing here, since the row was already deleted
}
}
/**
* Delay the push subscriber