mirror of
https://github.com/friendica/friendica
synced 2024-12-23 02:40:17 +00:00
commit
844eafa47a
87 changed files with 773 additions and 4383 deletions
29
database.sql
29
database.sql
|
@ -70,8 +70,6 @@ CREATE TABLE IF NOT EXISTS `user` (
|
||||||
`theme` varchar(255) NOT NULL DEFAULT '' COMMENT 'user theme preference',
|
`theme` varchar(255) NOT NULL DEFAULT '' COMMENT 'user theme preference',
|
||||||
`pubkey` text COMMENT 'RSA public key 4096 bit',
|
`pubkey` text COMMENT 'RSA public key 4096 bit',
|
||||||
`prvkey` text COMMENT 'RSA private 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',
|
`verified` boolean NOT NULL DEFAULT '0' COMMENT 'user is verified through email',
|
||||||
`blocked` boolean NOT NULL DEFAULT '0' COMMENT '1 for user is blocked',
|
`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',
|
`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 '',
|
`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',
|
`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',
|
`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 '',
|
`hub-verify` varbinary(383) NOT NULL DEFAULT '' COMMENT '',
|
||||||
`rating` tinyint NOT NULL DEFAULT 0 COMMENT 'Automatically detected feed poll frequency',
|
`rating` tinyint NOT NULL DEFAULT 0 COMMENT 'Automatically detected feed poll frequency',
|
||||||
`priority` tinyint unsigned NOT NULL DEFAULT 0 COMMENT 'Feed poll priority',
|
`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',
|
`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',
|
`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',
|
`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`),
|
PRIMARY KEY(`uri-id`),
|
||||||
FOREIGN KEY (`uri-id`) REFERENCES `item-uri` (`id`) ON UPDATE RESTRICT ON DELETE CASCADE
|
FOREIGN KEY (`uri-id`) REFERENCES `item-uri` (`id`) ON UPDATE RESTRICT ON DELETE CASCADE
|
||||||
) DEFAULT COLLATE utf8mb4_general_ci COMMENT='Delivery data for items';
|
) 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
|
FOREIGN KEY (`psid`) REFERENCES `permissionset` (`id`) ON UPDATE RESTRICT ON DELETE RESTRICT
|
||||||
) DEFAULT COLLATE utf8mb4_general_ci COMMENT='Custom profile fields';
|
) 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
|
-- 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',
|
`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',
|
`fetch_further_information` tinyint unsigned COMMENT '0 => None, 1 => Fetch information, 3 => Fetch keywords, 2 => Fetch both',
|
||||||
`ffi_keyword_denylist` text COMMENT '',
|
`ffi_keyword_denylist` text COMMENT '',
|
||||||
`subhub` boolean COMMENT '',
|
|
||||||
`hub-verify` varbinary(383) COMMENT '',
|
`hub-verify` varbinary(383) COMMENT '',
|
||||||
`protocol` char(4) COMMENT 'Protocol of the contact',
|
`protocol` char(4) COMMENT 'Protocol of the contact',
|
||||||
`rating` tinyint COMMENT 'Automatically detected feed poll frequency',
|
`rating` tinyint COMMENT 'Automatically detected feed poll frequency',
|
||||||
|
@ -3516,7 +3491,6 @@ CREATE VIEW `owner-view` AS SELECT
|
||||||
`contact`.`poll` AS `poll`,
|
`contact`.`poll` AS `poll`,
|
||||||
`contact`.`confirm` AS `confirm`,
|
`contact`.`confirm` AS `confirm`,
|
||||||
`contact`.`poco` AS `poco`,
|
`contact`.`poco` AS `poco`,
|
||||||
`contact`.`subhub` AS `subhub`,
|
|
||||||
`contact`.`hub-verify` AS `hub-verify`,
|
`contact`.`hub-verify` AS `hub-verify`,
|
||||||
`contact`.`last-update` AS `last-update`,
|
`contact`.`last-update` AS `last-update`,
|
||||||
`contact`.`success_update` AS `success_update`,
|
`contact`.`success_update` AS `success_update`,
|
||||||
|
@ -3565,8 +3539,6 @@ CREATE VIEW `owner-view` AS SELECT
|
||||||
`user`.`theme` AS `theme`,
|
`user`.`theme` AS `theme`,
|
||||||
`user`.`pubkey` AS `upubkey`,
|
`user`.`pubkey` AS `upubkey`,
|
||||||
`user`.`prvkey` AS `uprvkey`,
|
`user`.`prvkey` AS `uprvkey`,
|
||||||
`user`.`sprvkey` AS `sprvkey`,
|
|
||||||
`user`.`spubkey` AS `spubkey`,
|
|
||||||
`user`.`verified` AS `verified`,
|
`user`.`verified` AS `verified`,
|
||||||
`user`.`blockwall` AS `blockwall`,
|
`user`.`blockwall` AS `blockwall`,
|
||||||
`user`.`hidewall` AS `hidewall`,
|
`user`.`hidewall` AS `hidewall`,
|
||||||
|
@ -3763,7 +3735,6 @@ CREATE VIEW `account-user-view` AS SELECT
|
||||||
`ucontact`.`readonly` AS `readonly`,
|
`ucontact`.`readonly` AS `readonly`,
|
||||||
`ucontact`.`blocked` AS `blocked`,
|
`ucontact`.`blocked` AS `blocked`,
|
||||||
`ucontact`.`block_reason` AS `block_reason`,
|
`ucontact`.`block_reason` AS `block_reason`,
|
||||||
`ucontact`.`subhub` AS `subhub`,
|
|
||||||
`ucontact`.`hub-verify` AS `hub-verify`,
|
`ucontact`.`hub-verify` AS `hub-verify`,
|
||||||
`ucontact`.`reason` AS `reason`,
|
`ucontact`.`reason` AS `reason`,
|
||||||
`contact`.`notify` AS `dfrn-notify`,
|
`contact`.`notify` AS `dfrn-notify`,
|
||||||
|
|
|
@ -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: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:feed - RSS/Atom feeds
|
||||||
* network:mail - Mails that had been imported via IMAP.
|
* 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:dscs | network:discourse - Posts that are received by the Discourse connector.
|
||||||
* network:tmbl | network:tumblr - Posts that are received by the Tumblr 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.
|
* network:bsky | network:bluesky - Posts that are received by the Bluesky connector.
|
||||||
|
|
|
@ -28,23 +28,6 @@ Diaspora
|
||||||
|
|
||||||
Add the Diaspora 'handle' to the 'Connect/Follow' text box on your [Contacts](contacts) page.
|
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
|
Blogger, Wordpress, RSS feeds, arbitrary web pages
|
||||||
---
|
---
|
||||||
|
|
||||||
|
|
|
@ -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.
|
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"
|
Enable "Use MySQL full text engine"
|
||||||
|
|
||||||
When using MyISAM (default) or InnoDB on MariaDB 10 this speeds up search.
|
When using MyISAM (default) or InnoDB on MariaDB 10 this speeds up search.
|
||||||
|
|
|
@ -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:
|
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.
|
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
|
Diaspora contacts
|
||||||
---
|
---
|
||||||
Newer Diaspora servers are able to process "account migration" messages.
|
Newer Diaspora servers are able to process "account migration" messages.
|
||||||
|
|
|
@ -20,23 +20,9 @@ Additional types are used for non standard activities.
|
||||||
* [Link to the specification](http://activitystrea.ms/head/activity-schema.html)
|
* [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)
|
* [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
|
||||||
---
|
---
|
||||||
|
|
||||||
Portable Contacts is used for friends lists.
|
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)
|
* [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)
|
|
||||||
|
|
|
@ -80,7 +80,6 @@ Database Tables
|
||||||
| [process](help/database/db_process) | Currently running system processes |
|
| [process](help/database/db_process) | Currently running system processes |
|
||||||
| [profile](help/database/db_profile) | user profiles data |
|
| [profile](help/database/db_profile) | user profiles data |
|
||||||
| [profile_field](help/database/db_profile_field) | Custom profile fields |
|
| [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 |
|
| [register](help/database/db_register) | registrations requiring admin approval |
|
||||||
| [report](help/database/db_report) | |
|
| [report](help/database/db_report) | |
|
||||||
| [report-post](help/database/db_report-post) | Individual posts attached to a moderation report |
|
| [report-post](help/database/db_report-post) | Individual posts attached to a moderation report |
|
||||||
|
|
|
@ -59,7 +59,6 @@ Fields
|
||||||
| remote_self | | boolean | NO | | 0 | |
|
| remote_self | | boolean | NO | | 0 | |
|
||||||
| rel | The kind of the relation between the user and the contact | tinyint unsigned | 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 | | | |
|
| protocol | Protocol of the contact | char(4) | NO | | | |
|
||||||
| subhub | | boolean | NO | | 0 | |
|
|
||||||
| hub-verify | | varbinary(383) | NO | | | |
|
| hub-verify | | varbinary(383) | NO | | | |
|
||||||
| rating | Automatically detected feed poll frequency | tinyint | NO | | 0 | |
|
| rating | Automatically detected feed poll frequency | tinyint | NO | | 0 | |
|
||||||
| priority | Feed poll priority | tinyint unsigned | NO | | 0 | |
|
| priority | Feed poll priority | tinyint unsigned | NO | | 0 | |
|
||||||
|
|
|
@ -18,7 +18,6 @@ Fields
|
||||||
| dfrn | Number of successful deliveries via DFRN | mediumint | NO | | 0 | |
|
| dfrn | Number of successful deliveries via DFRN | mediumint | NO | | 0 | |
|
||||||
| legacy_dfrn | Number of successful deliveries via legacy 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 | |
|
| diaspora | Number of successful deliveries via Diaspora | mediumint | NO | | 0 | |
|
||||||
| ostatus | Number of successful deliveries via OStatus | mediumint | NO | | 0 | |
|
|
||||||
|
|
||||||
Indexes
|
Indexes
|
||||||
------------
|
------------
|
||||||
|
|
|
@ -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)
|
|
|
@ -25,7 +25,6 @@ Fields
|
||||||
| remote_self | 0 => No mirroring, 1-2 => Mirror as own post, 3 => Mirror as reshare | tinyint unsigned | YES | | NULL | |
|
| 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 | |
|
| fetch_further_information | 0 => None, 1 => Fetch information, 3 => Fetch keywords, 2 => Fetch both | tinyint unsigned | YES | | NULL | |
|
||||||
| ffi_keyword_denylist | | text | YES | | NULL | |
|
| ffi_keyword_denylist | | text | YES | | NULL | |
|
||||||
| subhub | | boolean | YES | | NULL | |
|
|
||||||
| hub-verify | | varbinary(383) | YES | | NULL | |
|
| hub-verify | | varbinary(383) | YES | | NULL | |
|
||||||
| protocol | Protocol of the contact | char(4) | YES | | NULL | |
|
| protocol | Protocol of the contact | char(4) | YES | | NULL | |
|
||||||
| rating | Automatically detected feed poll frequency | tinyint | YES | | NULL | |
|
| rating | Automatically detected feed poll frequency | tinyint | YES | | NULL | |
|
||||||
|
|
|
@ -27,8 +27,6 @@ Fields
|
||||||
| theme | user theme preference | varchar(255) | NO | | | |
|
| theme | user theme preference | varchar(255) | NO | | | |
|
||||||
| pubkey | RSA public key 4096 bit | text | YES | | NULL | |
|
| pubkey | RSA public key 4096 bit | text | YES | | NULL | |
|
||||||
| prvkey | RSA private 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 | |
|
| verified | user is verified through email | boolean | NO | | 0 | |
|
||||||
| blocked | 1 for user is blocked | 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 | |
|
| blockwall | Prohibit contacts to post to the profile page of the user | boolean | NO | | 0 | |
|
||||||
|
|
|
@ -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: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:feed - RSS/Atom feeds
|
||||||
* network:mail - Mails die via IMAP importiert worden sind.
|
* 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: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: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.
|
* network:bsky | network:bluesky - Beiträge, die über den Bluesky connector empfangen werden.
|
||||||
|
|
|
@ -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.
|
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**
|
**Blogger, Wordpress, RSS feeds, andere Webseiten**
|
||||||
|
|
||||||
Trage die URL auf Deiner ["Kontakte"-Seite](contacts) in das Feld "Neuen Kontakt hinzufügen" ein.
|
Trage die URL auf Deiner ["Kontakte"-Seite](contacts) in das Feld "Neuen Kontakt hinzufügen" ein.
|
||||||
|
|
|
@ -388,38 +388,14 @@ function photos_post()
|
||||||
foreach ($tags as $tag) {
|
foreach ($tags as $tag) {
|
||||||
if (strpos($tag, '@') === 0) {
|
if (strpos($tag, '@') === 0) {
|
||||||
$profile = '';
|
$profile = '';
|
||||||
$contact = null;
|
|
||||||
$name = substr($tag, 1);
|
$name = substr($tag, 1);
|
||||||
|
$contact = Contact::getByURL($name);
|
||||||
if ((strpos($name, '@')) || (strpos($name, 'http://'))) {
|
if (empty($contact)) {
|
||||||
$newname = $name;
|
$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, '+')) {
|
if (strrpos($newname, '+')) {
|
||||||
$tagcid = intval(substr($newname, strrpos($newname, '+') + 1));
|
$tagcid = intval(substr($newname, strrpos($newname, '+') + 1));
|
||||||
|
} else {
|
||||||
|
$tagcid = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($tagcid) {
|
if ($tagcid) {
|
||||||
|
@ -439,17 +415,17 @@ function photos_post()
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (DBA::isResult($contact)) {
|
if (DBA::isResult($contact)) {
|
||||||
$newname = $contact['name'];
|
$newname = $contact['name'];
|
||||||
$profile = $contact['url'];
|
$profile = $contact['url'];
|
||||||
|
|
||||||
$notify = 'cid:' . $contact['id'];
|
$notify = 'cid:' . $contact['id'];
|
||||||
if (strlen($inform)) {
|
if (strlen($inform)) {
|
||||||
$inform .= ',';
|
$inform .= ',';
|
||||||
}
|
|
||||||
$inform .= $notify;
|
|
||||||
}
|
}
|
||||||
|
$inform .= $notify;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($profile) {
|
if ($profile) {
|
||||||
|
|
|
@ -53,11 +53,8 @@ class Mode
|
||||||
'objects',
|
'objects',
|
||||||
'outbox',
|
'outbox',
|
||||||
'poco',
|
'poco',
|
||||||
'pubsub',
|
|
||||||
'pubsubhubbub',
|
|
||||||
'receive',
|
'receive',
|
||||||
'rsd_xml',
|
'rsd_xml',
|
||||||
'salmon',
|
|
||||||
'statistics_json',
|
'statistics_json',
|
||||||
'xrd',
|
'xrd',
|
||||||
];
|
];
|
||||||
|
|
|
@ -25,7 +25,6 @@ use Friendica\Model\Contact;
|
||||||
* @property-read int $remoteSelf
|
* @property-read int $remoteSelf
|
||||||
* @property-read int $fetchFurtherInformation
|
* @property-read int $fetchFurtherInformation
|
||||||
* @property-read string $ffiKeywordDenylist
|
* @property-read string $ffiKeywordDenylist
|
||||||
* @property-read bool $subhub
|
|
||||||
* @property-read string $hubVerify
|
* @property-read string $hubVerify
|
||||||
* @property-read string $protocol
|
* @property-read string $protocol
|
||||||
* @property-read int $rating
|
* @property-read int $rating
|
||||||
|
@ -69,8 +68,6 @@ class LocalRelationship extends \Friendica\BaseEntity
|
||||||
protected $fetchFurtherInformation;
|
protected $fetchFurtherInformation;
|
||||||
/** @var string */
|
/** @var string */
|
||||||
protected $ffiKeywordDenylist;
|
protected $ffiKeywordDenylist;
|
||||||
/** @var bool */
|
|
||||||
protected $subhub;
|
|
||||||
/** @var string */
|
/** @var string */
|
||||||
protected $hubVerify;
|
protected $hubVerify;
|
||||||
/** @var string */
|
/** @var string */
|
||||||
|
@ -80,7 +77,7 @@ class LocalRelationship extends \Friendica\BaseEntity
|
||||||
/** @var int */
|
/** @var int */
|
||||||
protected $priority;
|
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->userId = $userId;
|
||||||
$this->contactId = $contactId;
|
$this->contactId = $contactId;
|
||||||
|
@ -95,7 +92,6 @@ class LocalRelationship extends \Friendica\BaseEntity
|
||||||
$this->remoteSelf = $remoteSelf;
|
$this->remoteSelf = $remoteSelf;
|
||||||
$this->fetchFurtherInformation = $fetchFurtherInformation;
|
$this->fetchFurtherInformation = $fetchFurtherInformation;
|
||||||
$this->ffiKeywordDenylist = $ffiKeywordDenylist;
|
$this->ffiKeywordDenylist = $ffiKeywordDenylist;
|
||||||
$this->subhub = $subhub;
|
|
||||||
$this->hubVerify = $hubVerify;
|
$this->hubVerify = $hubVerify;
|
||||||
$this->protocol = $protocol;
|
$this->protocol = $protocol;
|
||||||
$this->rating = $rating;
|
$this->rating = $rating;
|
||||||
|
|
|
@ -34,7 +34,6 @@ class LocalRelationship extends BaseFactory implements ICanCreateFromTableRow
|
||||||
$row['remote_self'] ?? Entity\LocalRelationship::MIRROR_DEACTIVATED,
|
$row['remote_self'] ?? Entity\LocalRelationship::MIRROR_DEACTIVATED,
|
||||||
$row['fetch_further_information'] ?? Entity\LocalRelationship::FFI_NONE,
|
$row['fetch_further_information'] ?? Entity\LocalRelationship::FFI_NONE,
|
||||||
$row['ffi_keyword_denylist'] ?? '',
|
$row['ffi_keyword_denylist'] ?? '',
|
||||||
$row['subhub'] ?? false,
|
|
||||||
$row['hub-verify'] ?? '',
|
$row['hub-verify'] ?? '',
|
||||||
$row['protocol'] ?? Protocol::PHANTOM,
|
$row['protocol'] ?? Protocol::PHANTOM,
|
||||||
$row['rating'] ?? null,
|
$row['rating'] ?? null,
|
||||||
|
|
|
@ -89,7 +89,6 @@ class LocalRelationship extends \Friendica\BaseRepository
|
||||||
'remote_self' => $localRelationship->remoteSelf,
|
'remote_self' => $localRelationship->remoteSelf,
|
||||||
'fetch_further_information' => $localRelationship->fetchFurtherInformation,
|
'fetch_further_information' => $localRelationship->fetchFurtherInformation,
|
||||||
'ffi_keyword_denylist' => $localRelationship->ffiKeywordDenylist,
|
'ffi_keyword_denylist' => $localRelationship->ffiKeywordDenylist,
|
||||||
'subhub' => $localRelationship->subhub,
|
|
||||||
'hub-verify' => $localRelationship->hubVerify,
|
'hub-verify' => $localRelationship->hubVerify,
|
||||||
'protocol' => $localRelationship->protocol,
|
'protocol' => $localRelationship->protocol,
|
||||||
'rating' => $localRelationship->rating,
|
'rating' => $localRelationship->rating,
|
||||||
|
|
|
@ -48,7 +48,6 @@ class BBCode
|
||||||
const CONNECTORS = 4;
|
const CONNECTORS = 4;
|
||||||
const TWITTER_API = 5;
|
const TWITTER_API = 5;
|
||||||
const NPF = 6;
|
const NPF = 6;
|
||||||
const OSTATUS = 7;
|
|
||||||
const TWITTER = 8;
|
const TWITTER = 8;
|
||||||
const BACKLINK = 8;
|
const BACKLINK = 8;
|
||||||
const ACTIVITYPUB = 9;
|
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";
|
$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('♲ ', ENT_QUOTES, 'UTF-8') . ' @' . $author_contact['addr'] . ': ' . $content . '</p>' . "\n";
|
|
||||||
break;
|
break;
|
||||||
case self::ACTIVITYPUB:
|
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>';
|
$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
|
* - 4: Used for WordPress, Libertree (before Markdown), pump.io and tumblr
|
||||||
* - 5: Unused
|
* - 5: Unused
|
||||||
* - 6: Unused
|
* - 6: Unused
|
||||||
* - 7: Used for dfrn, OStatus
|
* - 7: Used for dfrn
|
||||||
* - 8: Used for Twitter, WP backlink text setting
|
* - 8: Used for Twitter, WP backlink text setting
|
||||||
* - 9: ActivityPub
|
* - 9: ActivityPub
|
||||||
*
|
*
|
||||||
|
@ -1283,7 +1279,7 @@ class BBCode
|
||||||
* - 4: Used for WordPress, Libertree (before Markdown), pump.io and tumblr
|
* - 4: Used for WordPress, Libertree (before Markdown), pump.io and tumblr
|
||||||
* - 5: Unused
|
* - 5: Unused
|
||||||
* - 6: Unused
|
* - 6: Unused
|
||||||
* - 7: Used for dfrn, OStatus
|
* - 7: Used for dfrn
|
||||||
* - 8: Used for Twitter, WP backlink text setting
|
* - 8: Used for Twitter, WP backlink text setting
|
||||||
* - 9: ActivityPub
|
* - 9: ActivityPub
|
||||||
*
|
*
|
||||||
|
@ -1971,7 +1967,7 @@ class BBCode
|
||||||
'@<a href="$2">$3</a>',
|
'@<a href="$2">$3</a>',
|
||||||
$text
|
$text
|
||||||
);
|
);
|
||||||
} elseif (in_array($simple_html, [self::OSTATUS, self::ACTIVITYPUB])) {
|
} elseif (in_array($simple_html, [self::ACTIVITYPUB])) {
|
||||||
$text = preg_replace(
|
$text = preg_replace(
|
||||||
"/([@!])\[url\=(.*?)\](.*?)\[\/url\]/ism",
|
"/([@!])\[url\=(.*?)\](.*?)\[\/url\]/ism",
|
||||||
'<span class="h-card"><a href="$2" class="u-url mention">$1<span>$3</span></a></span>',
|
'<span class="h-card"><a href="$2" class="u-url mention">$1<span>$3</span></a></span>',
|
||||||
|
@ -2017,7 +2013,7 @@ class BBCode
|
||||||
$text
|
$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_callback("/([^#@!])\[url\=([^\]]*)\](.*?)\[\/url\]/ism", [self::class, 'expandLinksCallback'], $text);
|
||||||
//$text = preg_replace("/[^#@!]\[url\=([^\]]*)\](.*?)\[\/url\]/ism", ' $2 [url]$1[/url]', $text);
|
//$text = preg_replace("/[^#@!]\[url\=([^\]]*)\](.*?)\[\/url\]/ism", ' $2 [url]$1[/url]', $text);
|
||||||
$text = preg_replace("/\[bookmark\=([^\]]*)\](.*?)\[\/bookmark\]/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
|
// Red compatibility, though the link can't be authenticated on Friendica
|
||||||
$text = preg_replace("/\[zrl\=(.*?)\](.*?)\[\/zrl\]/ism", '[url=$1]$2[/url]', $text);
|
$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);
|
$text = self::shortenLinkDescription($text, $simple_html);
|
||||||
} else {
|
} else {
|
||||||
$text = self::unifyLinks($text);
|
$text = self::unifyLinks($text);
|
||||||
|
|
|
@ -119,10 +119,6 @@ class Plaintext
|
||||||
$abstract = BBCode::getAbstract($item['body'], Protocol::TWITTER);
|
$abstract = BBCode::getAbstract($item['body'], Protocol::TWITTER);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case BBCode::OSTATUS:
|
|
||||||
$abstract = BBCode::getAbstract($item['body'], Protocol::STATUSNET);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case BBCode::BLUESKY:
|
case BBCode::BLUESKY:
|
||||||
$abstract = BBCode::getAbstract($item['body'], Protocol::BLUESKY);
|
$abstract = BBCode::getAbstract($item['body'], Protocol::BLUESKY);
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -88,17 +88,13 @@ class Widget
|
||||||
public static function unavailableNetworks(): array
|
public static function unavailableNetworks(): array
|
||||||
{
|
{
|
||||||
// Always hide content from these networks
|
// 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();
|
Addon::loadAddons();
|
||||||
|
|
||||||
if (!Addon::isEnabled("discourse")) {
|
if (!Addon::isEnabled("discourse")) {
|
||||||
$networks[] = Protocol::DISCOURSE;
|
$networks[] = Protocol::DISCOURSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!Addon::isEnabled("statusnet")) {
|
|
||||||
$networks[] = Protocol::STATUSNET;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!Addon::isEnabled("pumpio")) {
|
if (!Addon::isEnabled("pumpio")) {
|
||||||
$networks[] = Protocol::PUMPIO;
|
$networks[] = Protocol::PUMPIO;
|
||||||
}
|
}
|
||||||
|
@ -107,10 +103,6 @@ class Widget
|
||||||
$networks[] = Protocol::TUMBLR;
|
$networks[] = Protocol::TUMBLR;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (DI::config()->get("system", "ostatus_disabled")) {
|
|
||||||
$networks[] = Protocol::OSTATUS;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!DI::config()->get("system", "diaspora_enabled")) {
|
if (!DI::config()->get("system", "diaspora_enabled")) {
|
||||||
$networks[] = Protocol::DIASPORA;
|
$networks[] = Protocol::DIASPORA;
|
||||||
}
|
}
|
||||||
|
|
|
@ -59,7 +59,7 @@ class ContactBlock
|
||||||
'hidden' => false,
|
'hidden' => false,
|
||||||
'archive' => false,
|
'archive' => false,
|
||||||
'failed' => 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');
|
$contacts_title = DI::l10n()->t('No contacts');
|
||||||
|
|
|
@ -8,14 +8,10 @@
|
||||||
namespace Friendica\Core;
|
namespace Friendica\Core;
|
||||||
|
|
||||||
use Friendica\Database\DBA;
|
use Friendica\Database\DBA;
|
||||||
use Friendica\Model\Item;
|
|
||||||
use Friendica\Model\User;
|
use Friendica\Model\User;
|
||||||
use Friendica\Network\HTTPException;
|
use Friendica\Network\HTTPException;
|
||||||
use Friendica\Protocol\Activity;
|
|
||||||
use Friendica\Protocol\ActivityPub;
|
use Friendica\Protocol\ActivityPub;
|
||||||
use Friendica\Protocol\Diaspora;
|
use Friendica\Protocol\Diaspora;
|
||||||
use Friendica\Protocol\OStatus;
|
|
||||||
use Friendica\Protocol\Salmon;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Manage compatibility with federated networks
|
* Manage compatibility with federated networks
|
||||||
|
@ -28,24 +24,24 @@ class Protocol
|
||||||
const DIASPORA = 'dspr'; // Diaspora, Hubzilla, Socialhome, Ganggo
|
const DIASPORA = 'dspr'; // Diaspora, Hubzilla, Socialhome, Ganggo
|
||||||
const FEED = 'feed'; // RSS/Atom feeds with no known "post/notify" protocol
|
const FEED = 'feed'; // RSS/Atom feeds with no known "post/notify" protocol
|
||||||
const MAIL = 'mail'; // IMAP/POP
|
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];
|
const SUPPORT_PRIVATE = [self::DFRN, self::DIASPORA, self::MAIL, self::ACTIVITYPUB, self::PUMPIO];
|
||||||
|
|
||||||
// Supported through a connector
|
// Supported through a connector
|
||||||
const DIASPORA2 = 'dspc'; // Diaspora connector
|
const DIASPORA2 = 'dspc'; // Diaspora connector
|
||||||
const PUMPIO = 'pump'; // pump.io
|
const PUMPIO = 'pump'; // pump.io
|
||||||
const STATUSNET = 'stac'; // Statusnet connector
|
|
||||||
const TWITTER = 'twit'; // Twitter
|
const TWITTER = 'twit'; // Twitter
|
||||||
const DISCOURSE = 'dscs'; // Discourse
|
const DISCOURSE = 'dscs'; // Discourse
|
||||||
const TUMBLR = 'tmbl'; // Tumblr
|
const TUMBLR = 'tmbl'; // Tumblr
|
||||||
const BLUESKY = 'bsky'; // Bluesky
|
const BLUESKY = 'bsky'; // Bluesky
|
||||||
|
|
||||||
// Dead protocols
|
// Dead protocols
|
||||||
|
const OSTATUS = 'stat'; // GNU Social and other OStatus implementations
|
||||||
|
const STATUSNET = 'stac'; // Statusnet connector
|
||||||
const APPNET = 'apdn'; // app.net - Dead protocol
|
const APPNET = 'apdn'; // app.net - Dead protocol
|
||||||
const FACEBOOK = 'face'; // Facebook API - Not working anymore, API is closed
|
const FACEBOOK = 'face'; // Facebook API - Not working anymore, API is closed
|
||||||
const GPLUS = 'goog'; // Google+ - Dead in 2019
|
const GPLUS = 'goog'; // Google+ - Dead in 2019
|
||||||
|
@ -124,27 +120,10 @@ class Protocol
|
||||||
|
|
||||||
$protocol = $protocol ?? $contact['protocol'];
|
$protocol = $protocol ?? $contact['protocol'];
|
||||||
|
|
||||||
if (in_array($protocol, [Protocol::OSTATUS, Protocol::DFRN])) {
|
if ($protocol == self::DIASPORA) {
|
||||||
// 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) {
|
|
||||||
$contact = Diaspora::sendShare($owner, $contact);
|
$contact = Diaspora::sendShare($owner, $contact);
|
||||||
Logger::notice('share returns: ' . $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']);
|
$activity_id = ActivityPub\Transmitter::activityIDFromContact($contact['id']);
|
||||||
if (empty($activity_id)) {
|
if (empty($activity_id)) {
|
||||||
// This really should never happen
|
// This really should never happen
|
||||||
|
@ -175,33 +154,13 @@ class Protocol
|
||||||
}
|
}
|
||||||
|
|
||||||
$protocol = $contact['network'];
|
$protocol = $contact['network'];
|
||||||
if (($protocol == Protocol::DFRN) && !empty($contact['protocol'])) {
|
if (($protocol == self::DFRN) && !empty($contact['protocol'])) {
|
||||||
$protocol = $contact['protocol'];
|
$protocol = $contact['protocol'];
|
||||||
}
|
}
|
||||||
|
|
||||||
if (in_array($protocol, [Protocol::OSTATUS, Protocol::DFRN])) {
|
if ($protocol == self::DIASPORA) {
|
||||||
// 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) {
|
|
||||||
return Diaspora::sendUnshare($owner, $contact) > 0;
|
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);
|
return ActivityPub\Transmitter::sendContactUndo($contact['url'], $contact['id'], $owner);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -232,11 +191,11 @@ class Protocol
|
||||||
}
|
}
|
||||||
|
|
||||||
$protocol = $contact['network'];
|
$protocol = $contact['network'];
|
||||||
if ($protocol == Protocol::DFRN && !empty($contact['protocol'])) {
|
if ($protocol == self::DFRN && !empty($contact['protocol'])) {
|
||||||
$protocol = $contact['protocol'];
|
$protocol = $contact['protocol'];
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($protocol == Protocol::ACTIVITYPUB) {
|
if ($protocol == self::ACTIVITYPUB) {
|
||||||
return ActivityPub\Transmitter::sendContactReject($contact['url'], $contact['hub-verify'], $owner);
|
return ActivityPub\Transmitter::sendContactReject($contact['url'], $contact['hub-verify'], $owner);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -72,7 +72,7 @@ class DBStructure
|
||||||
$old_tables = ['fserver', 'gcign', 'gcontact', 'gcontact-relation', 'gfollower' ,'glink', 'item-delivery-data',
|
$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',
|
'item-activity', 'item-content', 'item_id', 'participation', 'poll', 'poll_result', 'queue', 'retriever_rule',
|
||||||
'deliverq', 'dsprphotoq', 'ffinder', 'sign', 'spam', 'term', 'user-item', 'thread', 'item', 'challenge',
|
'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'],
|
$tables = DBA::selectToArray('INFORMATION_SCHEMA.TABLES', ['TABLE_NAME'],
|
||||||
['TABLE_SCHEMA' => DBA::databaseName(), 'TABLE_TYPE' => 'BASE TABLE']);
|
['TABLE_SCHEMA' => DBA::databaseName(), 'TABLE_TYPE' => 'BASE TABLE']);
|
||||||
|
|
|
@ -788,10 +788,8 @@ class Contact
|
||||||
'url' => DI::baseUrl() . '/profile/' . $user['nickname'],
|
'url' => DI::baseUrl() . '/profile/' . $user['nickname'],
|
||||||
'nurl' => Strings::normaliseLink(DI::baseUrl() . '/profile/' . $user['nickname']),
|
'nurl' => Strings::normaliseLink(DI::baseUrl() . '/profile/' . $user['nickname']),
|
||||||
'addr' => $user['nickname'] . '@' . substr(DI::baseUrl(), strpos(DI::baseUrl(), '://') + 3),
|
'addr' => $user['nickname'] . '@' . substr(DI::baseUrl(), strpos(DI::baseUrl(), '://') + 3),
|
||||||
'request' => DI::baseUrl() . '/dfrn_request/' . $user['nickname'],
|
'notify' => DI::baseUrl() . '/dfrn_notify/' . $user['nickname'],
|
||||||
'notify' => DI::baseUrl() . '/dfrn_notify/' . $user['nickname'],
|
'poll' => DI::baseUrl() . '/feed/' . $user['nickname'],
|
||||||
'poll' => DI::baseUrl() . '/dfrn_poll/' . $user['nickname'],
|
|
||||||
'confirm' => DI::baseUrl() . '/dfrn_confirm/' . $user['nickname'],
|
|
||||||
'name-date' => DateTimeFormat::utcNow(),
|
'name-date' => DateTimeFormat::utcNow(),
|
||||||
'uri-date' => DateTimeFormat::utcNow(),
|
'uri-date' => DateTimeFormat::utcNow(),
|
||||||
'avatar-date' => DateTimeFormat::utcNow(),
|
'avatar-date' => DateTimeFormat::utcNow(),
|
||||||
|
@ -873,10 +871,8 @@ class Contact
|
||||||
'nurl' => Strings::normaliseLink($url),
|
'nurl' => Strings::normaliseLink($url),
|
||||||
'uri-id' => ItemURI::getIdByURI($url),
|
'uri-id' => ItemURI::getIdByURI($url),
|
||||||
'addr' => $user['nickname'] . '@' . substr(DI::baseUrl(), strpos(DI::baseUrl(), '://') + 3),
|
'addr' => $user['nickname'] . '@' . substr(DI::baseUrl(), strpos(DI::baseUrl(), '://') + 3),
|
||||||
'request' => DI::baseUrl() . '/dfrn_request/' . $user['nickname'],
|
|
||||||
'notify' => DI::baseUrl() . '/dfrn_notify/' . $user['nickname'],
|
'notify' => DI::baseUrl() . '/dfrn_notify/' . $user['nickname'],
|
||||||
'poll' => DI::baseUrl() . '/dfrn_poll/' . $user['nickname'],
|
'poll' => DI::baseUrl() . '/feed/' . $user['nickname'],
|
||||||
'confirm' => DI::baseUrl() . '/dfrn_confirm/' . $user['nickname'],
|
|
||||||
];
|
];
|
||||||
|
|
||||||
$avatar = Photo::selectFirst(['resource-id', 'type'], ['uid' => $uid, 'profile' => true]);
|
$avatar = Photo::selectFirst(['resource-id', 'type'], ['uid' => $uid, 'profile' => true]);
|
||||||
|
@ -2532,22 +2528,6 @@ class Contact
|
||||||
}
|
}
|
||||||
|
|
||||||
self::update($fields, $condition);
|
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
|
* 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
|
* Returns an array
|
||||||
* $return['success'] boolean true if successful
|
* $return['success'] boolean true if successful
|
||||||
* $return['message'] error text if success is false.
|
* $return['message'] error text if success is false.
|
||||||
|
@ -3170,35 +3145,24 @@ class Contact
|
||||||
return $result;
|
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']) {
|
if (!$ret['notify']) {
|
||||||
$result['message'] .= DI::l10n()->t('Limited profile. This person will be unable to receive direct/personal notifications from you.') . '<br />';
|
$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);
|
$hidden = ($protocol === Protocol::MAIL);
|
||||||
|
|
||||||
$subhub = (($protocol === Protocol::OSTATUS) ? true : false);
|
|
||||||
|
|
||||||
$hidden = (($protocol === Protocol::MAIL) ? 1 : 0);
|
|
||||||
|
|
||||||
$pending = false;
|
$pending = false;
|
||||||
if (($protocol == Protocol::ACTIVITYPUB) && isset($ret['manually-approve'])) {
|
if (($protocol == Protocol::ACTIVITYPUB) && isset($ret['manually-approve'])) {
|
||||||
$pending = (bool)$ret['manually-approve'];
|
$pending = (bool)$ret['manually-approve'];
|
||||||
}
|
}
|
||||||
|
|
||||||
if (in_array($protocol, [Protocol::MAIL, Protocol::DIASPORA, Protocol::ACTIVITYPUB])) {
|
$writeable = in_array($protocol, [Protocol::MAIL, Protocol::DIASPORA, Protocol::ACTIVITYPUB]);
|
||||||
$writeable = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (DBA::isResult($contact)) {
|
if (DBA::isResult($contact)) {
|
||||||
// update contact
|
// update contact
|
||||||
$new_relation = (in_array($contact['rel'], [self::FOLLOWER, self::FRIEND]) ? self::FRIEND : self::SHARING);
|
$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'])) {
|
if ($contact['pending'] && !empty($contact['hub-verify'])) {
|
||||||
ActivityPub\Transmitter::sendContactAccept($contact['url'], $contact['hub-verify'], $uid);
|
ActivityPub\Transmitter::sendContactAccept($contact['url'], $contact['hub-verify'], $uid);
|
||||||
|
@ -3236,7 +3200,6 @@ class Contact
|
||||||
'blocked' => 0,
|
'blocked' => 0,
|
||||||
'readonly' => 0,
|
'readonly' => 0,
|
||||||
'pending' => $pending,
|
'pending' => $pending,
|
||||||
'subhub' => $subhub
|
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3258,11 +3221,6 @@ class Contact
|
||||||
// Update the avatar
|
// Update the avatar
|
||||||
self::updateAvatar($contact_id, $ret['photo']);
|
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) {
|
if ($probed) {
|
||||||
GServer::updateFromProbeArray($ret);
|
GServer::updateFromProbeArray($ret);
|
||||||
self::updateFromProbeArray($contact_id, $ret);
|
self::updateFromProbeArray($contact_id, $ret);
|
||||||
|
@ -3733,10 +3691,6 @@ class Contact
|
||||||
$networks[] = Protocol::DIASPORA;
|
$networks[] = Protocol::DIASPORA;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!DI::config()->get('system', 'ostatus_disabled')) {
|
|
||||||
$networks[] = Protocol::OSTATUS;
|
|
||||||
}
|
|
||||||
|
|
||||||
$condition = [
|
$condition = [
|
||||||
'network' => $networks,
|
'network' => $networks,
|
||||||
'server-failed' => false,
|
'server-failed' => false,
|
||||||
|
|
|
@ -284,7 +284,7 @@ class Relation
|
||||||
return false;
|
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);
|
$apcontact = APContact::getByURL($url, false);
|
||||||
if (empty($apcontact)) {
|
if (empty($apcontact)) {
|
||||||
Logger::info('No discovery - The contact does not seem to speak ActivityPub.', ['id' => $contact['id'], 'url' => $url, 'network' => $contact['network']]);
|
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]);
|
Logger::info('Collecting suggestions', ['uid' => $uid, 'cid' => $cid, 'start' => $start, 'limit' => $limit]);
|
||||||
|
|
||||||
$diaspora = DI::config()->get('system', 'diaspora_enabled') ? Protocol::DIASPORA : Protocol::ACTIVITYPUB;
|
$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.
|
// 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.
|
// 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` = ?)
|
(SELECT `cid` FROM `contact-relation` WHERE `relation-cid` = ?)
|
||||||
AND NOT `cid` IN (SELECT `id` FROM `contact` WHERE `uid` = ? AND `nurl` IN
|
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`)
|
(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` = ?)",
|
AND NOT `uri-id` IN (SELECT `uri-id` FROM `account-suggestion` WHERE `uri-id` = `contact`.`uri-id` AND `uid` = ?)",
|
||||||
$cid,
|
$cid,
|
||||||
0,
|
0,
|
||||||
$uid, Contact::FRIEND, Contact::SHARING,
|
$uid, Contact::FRIEND, Contact::SHARING,
|
||||||
Protocol::ACTIVITYPUB, Protocol::DFRN, $diaspora, $ostatus, $uid
|
Protocol::ACTIVITYPUB, Protocol::DFRN, $diaspora, $uid
|
||||||
], [
|
], [
|
||||||
'order' => ['last-item' => true],
|
'order' => ['last-item' => true],
|
||||||
'limit' => $totallimit,
|
'limit' => $totallimit,
|
||||||
|
@ -408,10 +407,10 @@ class Relation
|
||||||
(SELECT `relation-cid` FROM `contact-relation` WHERE `cid` = ?)
|
(SELECT `relation-cid` FROM `contact-relation` WHERE `cid` = ?)
|
||||||
AND NOT `cid` IN (SELECT `id` FROM `contact` WHERE `uid` = ? AND `nurl` IN
|
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`)
|
(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` = ?)",
|
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,
|
$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]
|
['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.
|
// The query returns contacts that follow the given user but aren't followed by that user.
|
||||||
$results = DBA::select('contact', [],
|
$results = DBA::select('contact', [],
|
||||||
["`nurl` IN (SELECT `nurl` FROM `contact` WHERE `uid` = ? AND `rel` = ?)
|
["`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` = ?)",
|
AND NOT `uri-id` IN (SELECT `uri-id` FROM `account-suggestion` WHERE `uri-id` = `contact`.`uri-id` AND `uid` = ?)",
|
||||||
$uid, Contact::FOLLOWER, 0,
|
$uid, Contact::FOLLOWER, 0,
|
||||||
Protocol::ACTIVITYPUB, Protocol::DFRN, $diaspora, $ostatus, $uid],
|
Protocol::ACTIVITYPUB, Protocol::DFRN, $diaspora, $uid],
|
||||||
['order' => ['last-item' => true], 'limit' => $totallimit]
|
['order' => ['last-item' => true], 'limit' => $totallimit]
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -450,10 +449,10 @@ class Relation
|
||||||
// The query returns any contact that isn't followed by that user.
|
// The query returns any contact that isn't followed by that user.
|
||||||
$results = DBA::select('contact', [],
|
$results = DBA::select('contact', [],
|
||||||
["NOT `nurl` IN (SELECT `nurl` FROM `contact` WHERE `uid` = ? AND `rel` IN (?, ?) AND `nurl` = `nurl`)
|
["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` = ?)",
|
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,
|
$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]
|
['order' => ['last-item' => true], 'limit' => $totallimit]
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
|
@ -16,7 +16,7 @@ class Conversation
|
||||||
const PARCEL_ACTIVITYPUB = 0;
|
const PARCEL_ACTIVITYPUB = 0;
|
||||||
const PARCEL_DFRN = 1; // Deprecated
|
const PARCEL_DFRN = 1; // Deprecated
|
||||||
const PARCEL_DIASPORA = 2;
|
const PARCEL_DIASPORA = 2;
|
||||||
const PARCEL_SALMON = 3;
|
const PARCEL_SALMON = 3; // @deprecated since version 2024.09
|
||||||
const PARCEL_FEED = 4; // Deprecated
|
const PARCEL_FEED = 4; // Deprecated
|
||||||
const PARCEL_SPLIT_CONVERSATION = 6; // @deprecated since version 2022.09
|
const PARCEL_SPLIT_CONVERSATION = 6; // @deprecated since version 2022.09
|
||||||
const PARCEL_LEGACY_DFRN = 7; // @deprecated since version 2021.09
|
const PARCEL_LEGACY_DFRN = 7; // @deprecated since version 2021.09
|
||||||
|
|
|
@ -2617,11 +2617,6 @@ class GServer
|
||||||
return;
|
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 the server is marked as ActivityPub then we won't change it to anything different
|
||||||
if ($old == Post\DeliveryData::ACTIVITYPUB) {
|
if ($old == Post\DeliveryData::ACTIVITYPUB) {
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -602,16 +602,6 @@ class Item
|
||||||
Logger::notice('duplicated item with the same guid found.', $condition);
|
Logger::notice('duplicated item with the same guid found.', $condition);
|
||||||
return true;
|
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)) {
|
if (empty($item['network']) || in_array($item['network'], Protocol::FEDERATED)) {
|
||||||
$condition = [
|
$condition = [
|
||||||
'`uri-id` = ? AND `uid` = ? AND `network` IN (?, ?, ?, ?)',
|
'`uri-id` = ? AND `uid` = ? AND `network` IN (?, ?, ?)',
|
||||||
$item['uri-id'],
|
$item['uri-id'],
|
||||||
$item['uid'],
|
$item['uid'],
|
||||||
Protocol::ACTIVITYPUB,
|
Protocol::ACTIVITYPUB,
|
||||||
Protocol::DIASPORA,
|
Protocol::DIASPORA,
|
||||||
Protocol::DFRN,
|
Protocol::DFRN
|
||||||
Protocol::OSTATUS
|
|
||||||
];
|
];
|
||||||
$existing = Post::selectFirst(['id', 'network'], $condition);
|
$existing = Post::selectFirst(['id', 'network'], $condition);
|
||||||
if (DBA::isResult($existing)) {
|
if (DBA::isResult($existing)) {
|
||||||
|
@ -908,7 +897,7 @@ class Item
|
||||||
/*
|
/*
|
||||||
* Do we already have this item?
|
* Do we already have this item?
|
||||||
* We have to check several networks since Friendica posts could be repeated
|
* We have to check several networks since Friendica posts could be repeated
|
||||||
* via OStatus (maybe Diaspora as well)
|
* via Diaspora.
|
||||||
*/
|
*/
|
||||||
$duplicate = self::getDuplicateID($item);
|
$duplicate = self::getDuplicateID($item);
|
||||||
if ($duplicate) {
|
if ($duplicate) {
|
||||||
|
|
|
@ -29,7 +29,7 @@ class DeliveryData
|
||||||
const DFRN = 2;
|
const DFRN = 2;
|
||||||
const LEGACY_DFRN = 3; // @deprecated since version 2021.09
|
const LEGACY_DFRN = 3; // @deprecated since version 2021.09
|
||||||
const DIASPORA = 4;
|
const DIASPORA = 4;
|
||||||
const OSTATUS = 5;
|
const OSTATUS = 5; // @deprecated since version 2024.09
|
||||||
const MAIL = 6;
|
const MAIL = 6;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -83,9 +83,6 @@ class DeliveryData
|
||||||
case self::DIASPORA:
|
case self::DIASPORA:
|
||||||
$increments[] = "`diaspora` = `diaspora` + 1";
|
$increments[] = "`diaspora` = `diaspora` + 1";
|
||||||
break;
|
break;
|
||||||
case self::OSTATUS:
|
|
||||||
$increments[] = "`ostatus` = `ostatus` + 1";
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return DBA::update('post-delivery-data', $increments, ['uri-id' => $uri_id]);
|
return DBA::update('post-delivery-data', $increments, ['uri-id' => $uri_id]);
|
||||||
|
|
|
@ -30,8 +30,8 @@ class Engagement
|
||||||
const ALTERNATIVES = ['source:news' => 'source:service', 'source:relay' => 'source:application',
|
const ALTERNATIVES = ['source:news' => 'source:service', 'source:relay' => 'source:application',
|
||||||
'media:picture' => 'media:image', 'media:photo' => 'media:image',
|
'media:picture' => 'media:image', 'media:photo' => 'media:image',
|
||||||
'network:activitypub' => 'network:apub', 'network:friendica' => 'network:dfrn',
|
'network:activitypub' => 'network:apub', 'network:friendica' => 'network:dfrn',
|
||||||
'network:diaspora' => 'network:dspr', 'network:ostatus' => 'network:stat',
|
'network:diaspora' => 'network:dspr', 'network:discourse' => 'network:dscs',
|
||||||
'network:discourse' => 'network:dscs', 'network:tumblr' => 'network:tmbl', 'network:bluesky' => 'network:bsky'];
|
'network:tumblr' => 'network:tmbl', 'network:bluesky' => 'network:bsky'];
|
||||||
const MEDIA_NONE = 0;
|
const MEDIA_NONE = 0;
|
||||||
const MEDIA_IMAGE = 1;
|
const MEDIA_IMAGE = 1;
|
||||||
const MEDIA_VIDEO = 2;
|
const MEDIA_VIDEO = 2;
|
||||||
|
|
|
@ -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
|
|
||||||
*
|
|
||||||
* @param integer $id Subscriber ID
|
|
||||||
* @return void
|
|
||||||
* @throws \Exception
|
|
||||||
*/
|
|
||||||
public static function delay(int $id)
|
|
||||||
{
|
|
||||||
$subscriber = DBA::selectFirst('push_subscriber', ['push', 'callback_url', 'renewed', 'nickname'], ['id' => $id]);
|
|
||||||
if (!DBA::isResult($subscriber)) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
$retrial = $subscriber['push'];
|
|
||||||
|
|
||||||
if ($retrial > 14) {
|
|
||||||
// End subscriptions if they weren't renewed for more than two months
|
|
||||||
$days = round((time() - strtotime($subscriber['renewed'])) / (60 * 60 * 24));
|
|
||||||
|
|
||||||
if ($days > 60) {
|
|
||||||
DBA::update('push_subscriber', ['push' => -1, 'next_try' => DBA::NULL_DATETIME], ['id' => $id]);
|
|
||||||
Logger::info('Delivery error: Subscription ' . $subscriber['callback_url'] . ' for ' . $subscriber['nickname'] . ' is marked as ended.');
|
|
||||||
} else {
|
|
||||||
DBA::update('push_subscriber', ['push' => 0, 'next_try' => DBA::NULL_DATETIME], ['id' => $id]);
|
|
||||||
Logger::info('Delivery error: Giving up ' . $subscriber['callback_url'] . ' for ' . $subscriber['nickname'] . ' for now.');
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
// Calculate the delay until the next trial
|
|
||||||
$delay = (($retrial + 3) ** 4) + (rand(1, 30) * ($retrial + 1));
|
|
||||||
$next = DateTimeFormat::utc('now + ' . $delay . ' seconds');
|
|
||||||
|
|
||||||
$retrial = $retrial + 1;
|
|
||||||
|
|
||||||
DBA::update('push_subscriber', ['push' => $retrial, 'next_try' => $next], ['id' => $id]);
|
|
||||||
Logger::info('Delivery error: Next try (' . $retrial . ') ' . $subscriber['callback_url'] . ' for ' . $subscriber['nickname'] . ' at ' . $next);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Reset the push subscriber
|
|
||||||
*
|
|
||||||
* @param integer $id Subscriber ID
|
|
||||||
* @param string $last_update Date of last transmitted item
|
|
||||||
* @return void
|
|
||||||
* @throws \Exception
|
|
||||||
*/
|
|
||||||
public static function reset(int $id, string $last_update)
|
|
||||||
{
|
|
||||||
$subscriber = DBA::selectFirst('push_subscriber', ['callback_url', 'nickname'], ['id' => $id]);
|
|
||||||
if (!DBA::isResult($subscriber)) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// set last_update to the 'created' date of the last item, and reset push=0
|
|
||||||
$fields = ['push' => 0, 'next_try' => DBA::NULL_DATETIME, 'last_update' => $last_update];
|
|
||||||
DBA::update('push_subscriber', $fields, ['id' => $id]);
|
|
||||||
Logger::info('Subscriber ' . $subscriber['callback_url'] . ' for ' . $subscriber['nickname'] . ' is marked as vital');
|
|
||||||
|
|
||||||
$parts = parse_url($subscriber['callback_url']);
|
|
||||||
unset($parts['path']);
|
|
||||||
$server_url = (string)Uri::fromParts((array)$parts);
|
|
||||||
$gsid = GServer::getID($server_url, true);
|
|
||||||
if (!empty($gsid)) {
|
|
||||||
GServer::setProtocol($gsid, Post\DeliveryData::OSTATUS);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -594,9 +594,9 @@ class Tag
|
||||||
public static function countByTag(string $search, int $uid = 0): int
|
public static function countByTag(string $search, int $uid = 0): int
|
||||||
{
|
{
|
||||||
$condition = ["`name` = ? AND (`uid` = ? OR (`uid` = ? AND NOT `global`))
|
$condition = ["`name` = ? AND (`uid` = ? OR (`uid` = ? AND NOT `global`))
|
||||||
AND (`network` IN (?, ?, ?, ?) OR (`uid` = ? AND `uid` != ?))",
|
AND (`network` IN (?, ?, ?) OR (`uid` = ? AND `uid` != ?))",
|
||||||
$search, 0, $uid,
|
$search, 0, $uid,
|
||||||
Protocol::ACTIVITYPUB, Protocol::DFRN, Protocol::DIASPORA, Protocol::OSTATUS, $uid, 0,
|
Protocol::ACTIVITYPUB, Protocol::DFRN, Protocol::DIASPORA, $uid, 0,
|
||||||
];
|
];
|
||||||
|
|
||||||
return DBA::count('tag-search-view', $condition);
|
return DBA::count('tag-search-view', $condition);
|
||||||
|
@ -615,9 +615,9 @@ class Tag
|
||||||
public static function getURIIdListByTag(string $search, int $uid = 0, int $start = 0, int $limit = 100, int $last_uriid = 0): array
|
public static function getURIIdListByTag(string $search, int $uid = 0, int $start = 0, int $limit = 100, int $last_uriid = 0): array
|
||||||
{
|
{
|
||||||
$condition = ["`name` = ? AND (`uid` = ? OR (`uid` = ? AND NOT `global`))
|
$condition = ["`name` = ? AND (`uid` = ? OR (`uid` = ? AND NOT `global`))
|
||||||
AND (`network` IN (?, ?, ?, ?) OR (`uid` = ? AND `uid` != ?))",
|
AND (`network` IN (?, ?, ?) OR (`uid` = ? AND `uid` != ?))",
|
||||||
$search, 0, $uid,
|
$search, 0, $uid,
|
||||||
Protocol::ACTIVITYPUB, Protocol::DFRN, Protocol::DIASPORA, Protocol::OSTATUS, $uid, 0,
|
Protocol::ACTIVITYPUB, Protocol::DFRN, Protocol::DIASPORA, $uid, 0,
|
||||||
];
|
];
|
||||||
|
|
||||||
if (!empty($last_uriid)) {
|
if (!empty($last_uriid)) {
|
||||||
|
|
|
@ -152,8 +152,8 @@ class User
|
||||||
}
|
}
|
||||||
|
|
||||||
$system['name'] = App::PLATFORM . " '" . App::CODENAME . "' " . App::VERSION . '-' . DB_UPDATE_VERSION;
|
$system['name'] = App::PLATFORM . " '" . App::CODENAME . "' " . App::VERSION . '-' . DB_UPDATE_VERSION;
|
||||||
$system['sprvkey'] = $system['uprvkey'] = $system['prvkey'];
|
$system['uprvkey'] = $system['prvkey'];
|
||||||
$system['spubkey'] = $system['upubkey'] = $system['pubkey'];
|
$system['upubkey'] = $system['pubkey'];
|
||||||
$system['nickname'] = $system['nick'];
|
$system['nickname'] = $system['nick'];
|
||||||
$system['page-flags'] = self::PAGE_FLAGS_SOAPBOX;
|
$system['page-flags'] = self::PAGE_FLAGS_SOAPBOX;
|
||||||
$system['account-type'] = $system['contact-type'];
|
$system['account-type'] = $system['contact-type'];
|
||||||
|
@ -183,8 +183,6 @@ class User
|
||||||
'register_date' => $system['created'],
|
'register_date' => $system['created'],
|
||||||
'pubkey' => $system['pubkey'],
|
'pubkey' => $system['pubkey'],
|
||||||
'prvkey' => $system['prvkey'],
|
'prvkey' => $system['prvkey'],
|
||||||
'spubkey' => $system['spubkey'],
|
|
||||||
'sprvkey' => $system['sprvkey'],
|
|
||||||
'guid' => System::createUUID(),
|
'guid' => System::createUUID(),
|
||||||
'verified' => true,
|
'verified' => true,
|
||||||
'page-flags' => self::PAGE_FLAGS_SOAPBOX,
|
'page-flags' => self::PAGE_FLAGS_SOAPBOX,
|
||||||
|
@ -1315,11 +1313,6 @@ class User
|
||||||
$prvkey = $keys['prvkey'];
|
$prvkey = $keys['prvkey'];
|
||||||
$pubkey = $keys['pubkey'];
|
$pubkey = $keys['pubkey'];
|
||||||
|
|
||||||
// Create another keypair for signing/verifying salmon protocol messages.
|
|
||||||
$sres = Crypto::newKeypair(512);
|
|
||||||
$sprvkey = $sres['prvkey'];
|
|
||||||
$spubkey = $sres['pubkey'];
|
|
||||||
|
|
||||||
$insert_result = DBA::insert('user', [
|
$insert_result = DBA::insert('user', [
|
||||||
'guid' => System::createUUID(),
|
'guid' => System::createUUID(),
|
||||||
'username' => $username,
|
'username' => $username,
|
||||||
|
@ -1329,8 +1322,6 @@ class User
|
||||||
'nickname' => $nickname,
|
'nickname' => $nickname,
|
||||||
'pubkey' => $pubkey,
|
'pubkey' => $pubkey,
|
||||||
'prvkey' => $prvkey,
|
'prvkey' => $prvkey,
|
||||||
'spubkey' => $spubkey,
|
|
||||||
'sprvkey' => $sprvkey,
|
|
||||||
'verified' => $verified,
|
'verified' => $verified,
|
||||||
'blocked' => $blocked,
|
'blocked' => $blocked,
|
||||||
'language' => $language,
|
'language' => $language,
|
||||||
|
|
|
@ -111,7 +111,6 @@ class Site extends BaseAdmin
|
||||||
$poco_local_search = !empty($_POST['poco_local_search']);
|
$poco_local_search = !empty($_POST['poco_local_search']);
|
||||||
$nodeinfo = !empty($_POST['nodeinfo']);
|
$nodeinfo = !empty($_POST['nodeinfo']);
|
||||||
$mail_enabled = !empty($_POST['mail_enabled']);
|
$mail_enabled = !empty($_POST['mail_enabled']);
|
||||||
$ostatus_enabled = !empty($_POST['ostatus_enabled']);
|
|
||||||
$diaspora_enabled = !empty($_POST['diaspora_enabled']);
|
$diaspora_enabled = !empty($_POST['diaspora_enabled']);
|
||||||
$force_ssl = !empty($_POST['force_ssl']);
|
$force_ssl = !empty($_POST['force_ssl']);
|
||||||
$show_help = !empty($_POST['show_help']);
|
$show_help = !empty($_POST['show_help']);
|
||||||
|
@ -280,7 +279,6 @@ class Site extends BaseAdmin
|
||||||
$transactionConfig->set('system', 'proxy' , $proxy);
|
$transactionConfig->set('system', 'proxy' , $proxy);
|
||||||
$transactionConfig->set('system', 'curl_timeout' , $timeout);
|
$transactionConfig->set('system', 'curl_timeout' , $timeout);
|
||||||
$transactionConfig->set('system', 'imap_disabled' , !$mail_enabled && function_exists('imap_open'));
|
$transactionConfig->set('system', 'imap_disabled' , !$mail_enabled && function_exists('imap_open'));
|
||||||
$transactionConfig->set('system', 'ostatus_disabled' , !$ostatus_enabled);
|
|
||||||
$transactionConfig->set('system', 'diaspora_enabled' , $diaspora_enabled);
|
$transactionConfig->set('system', 'diaspora_enabled' , $diaspora_enabled);
|
||||||
|
|
||||||
$transactionConfig->set('config', 'private_addons' , $private_addons);
|
$transactionConfig->set('config', 'private_addons' , $private_addons);
|
||||||
|
@ -531,7 +529,6 @@ class Site extends BaseAdmin
|
||||||
'$mail_able' => function_exists('imap_open'),
|
'$mail_able' => function_exists('imap_open'),
|
||||||
'$mail_enabled' => ['mail_enabled', DI::l10n()->t('Enable Mail support'), !DI::config()->get('system', 'imap_disabled', !function_exists('imap_open')), DI::l10n()->t('Enable built-in mail support to poll IMAP folders and to reply via mail.')],
|
'$mail_enabled' => ['mail_enabled', DI::l10n()->t('Enable Mail support'), !DI::config()->get('system', 'imap_disabled', !function_exists('imap_open')), DI::l10n()->t('Enable built-in mail support to poll IMAP folders and to reply via mail.')],
|
||||||
'$mail_not_able' => DI::l10n()->t('Mail support can\'t be enabled because the PHP IMAP module is not installed.'),
|
'$mail_not_able' => DI::l10n()->t('Mail support can\'t be enabled because the PHP IMAP module is not installed.'),
|
||||||
'$ostatus_enabled' => ['ostatus_enabled', DI::l10n()->t('Enable OStatus support'), !DI::config()->get('system', 'ostatus_disabled'), DI::l10n()->t('Enable built-in OStatus (StatusNet, GNU Social etc.) compatibility. All communications in OStatus are public.')],
|
|
||||||
'$diaspora_able' => $diaspora_able,
|
'$diaspora_able' => $diaspora_able,
|
||||||
'$diaspora_not_able' => DI::l10n()->t('Diaspora support can\'t be enabled because Friendica was installed into a sub directory.'),
|
'$diaspora_not_able' => DI::l10n()->t('Diaspora support can\'t be enabled because Friendica was installed into a sub directory.'),
|
||||||
'$diaspora_enabled' => ['diaspora_enabled', DI::l10n()->t('Enable Diaspora support'), DI::config()->get('system', 'diaspora_enabled', $diaspora_able), DI::l10n()->t('Enable built-in Diaspora network compatibility for communicating with diaspora servers.')],
|
'$diaspora_enabled' => ['diaspora_enabled', DI::l10n()->t('Enable Diaspora support'), DI::config()->get('system', 'diaspora_enabled', $diaspora_able), DI::l10n()->t('Enable built-in Diaspora network compatibility for communicating with diaspora servers.')],
|
||||||
|
@ -562,7 +559,7 @@ class Site extends BaseAdmin
|
||||||
'$dbclean' => ['dbclean', DI::l10n()->t('Clean database'), DI::config()->get('system', 'dbclean'), DI::l10n()->t('Remove old remote items, orphaned database records and old content from some other helper tables.')],
|
'$dbclean' => ['dbclean', DI::l10n()->t('Clean database'), DI::config()->get('system', 'dbclean'), DI::l10n()->t('Remove old remote items, orphaned database records and old content from some other helper tables.')],
|
||||||
'$dbclean_expire_days' => ['dbclean_expire_days', DI::l10n()->t('Lifespan of remote items'), DI::config()->get('system', 'dbclean-expire-days'), DI::l10n()->t('When the database cleanup is enabled, this defines the days after which remote items will be deleted. Own items, and marked or filed items are always kept. 0 disables this behaviour.')],
|
'$dbclean_expire_days' => ['dbclean_expire_days', DI::l10n()->t('Lifespan of remote items'), DI::config()->get('system', 'dbclean-expire-days'), DI::l10n()->t('When the database cleanup is enabled, this defines the days after which remote items will be deleted. Own items, and marked or filed items are always kept. 0 disables this behaviour.')],
|
||||||
'$dbclean_unclaimed' => ['dbclean_unclaimed', DI::l10n()->t('Lifespan of unclaimed items'), DI::config()->get('system', 'dbclean-expire-unclaimed'), DI::l10n()->t('When the database cleanup is enabled, this defines the days after which unclaimed remote items (mostly content from the relay) will be deleted. Default value is 90 days. Defaults to the general lifespan value of remote items if set to 0.')],
|
'$dbclean_unclaimed' => ['dbclean_unclaimed', DI::l10n()->t('Lifespan of unclaimed items'), DI::config()->get('system', 'dbclean-expire-unclaimed'), DI::l10n()->t('When the database cleanup is enabled, this defines the days after which unclaimed remote items (mostly content from the relay) will be deleted. Default value is 90 days. Defaults to the general lifespan value of remote items if set to 0.')],
|
||||||
'$dbclean_expire_conv' => ['dbclean_expire_conv', DI::l10n()->t('Lifespan of raw conversation data'), DI::config()->get('system', 'dbclean_expire_conversation'), DI::l10n()->t('The conversation data is used for ActivityPub and OStatus, as well as for debug purposes. It should be safe to remove it after 14 days, default is 90 days.')],
|
'$dbclean_expire_conv' => ['dbclean_expire_conv', DI::l10n()->t('Lifespan of raw conversation data'), DI::config()->get('system', 'dbclean_expire_conversation'), DI::l10n()->t('The conversation data is used for ActivityPub, as well as for debug purposes. It should be safe to remove it after 14 days, default is 90 days.')],
|
||||||
'$max_comments' => ['max_comments', DI::l10n()->t('Maximum numbers of comments per post'), DI::config()->get('system', 'max_comments'), DI::l10n()->t('How much comments should be shown for each post? Default value is 100.')],
|
'$max_comments' => ['max_comments', DI::l10n()->t('Maximum numbers of comments per post'), DI::config()->get('system', 'max_comments'), DI::l10n()->t('How much comments should be shown for each post? Default value is 100.')],
|
||||||
'$max_display_comments' => ['max_display_comments', DI::l10n()->t('Maximum numbers of comments per post on the display page'), DI::config()->get('system', 'max_display_comments'), DI::l10n()->t('How many comments should be shown on the single view for each post? Default value is 1000.')],
|
'$max_display_comments' => ['max_display_comments', DI::l10n()->t('Maximum numbers of comments per post on the display page'), DI::config()->get('system', 'max_display_comments'), DI::l10n()->t('How many comments should be shown on the single view for each post? Default value is 1000.')],
|
||||||
'$itemspage_network' => ['itemspage_network', DI::l10n()->t('Items per page'), DI::config()->get('system', 'itemspage_network'), DI::l10n()->t('Number of items per page in stream pages (network, community, profile/contact statuses, search).')],
|
'$itemspage_network' => ['itemspage_network', DI::l10n()->t('Items per page'), DI::config()->get('system', 'itemspage_network'), DI::l10n()->t('Number of items per page in stream pages (network, community, profile/contact statuses, search).')],
|
||||||
|
|
|
@ -140,8 +140,8 @@ class Search extends BaseApi
|
||||||
|
|
||||||
if (substr($q, 0, 1) == '#') {
|
if (substr($q, 0, 1) == '#') {
|
||||||
$condition = ["`name` = ? AND (`uid` = ? OR (`uid` = ? AND NOT `global`))
|
$condition = ["`name` = ? AND (`uid` = ? OR (`uid` = ? AND NOT `global`))
|
||||||
AND (`network` IN (?, ?, ?, ?) OR (`uid` = ? AND `uid` != ?))",
|
AND (`network` IN (?, ?, ?) OR (`uid` = ? AND `uid` != ?))",
|
||||||
substr($q, 1), 0, $uid, Protocol::ACTIVITYPUB, Protocol::DFRN, Protocol::DIASPORA, Protocol::OSTATUS, $uid, 0];
|
substr($q, 1), 0, $uid, Protocol::ACTIVITYPUB, Protocol::DFRN, Protocol::DIASPORA, $uid, 0];
|
||||||
$table = 'tag-search-view';
|
$table = 'tag-search-view';
|
||||||
} else {
|
} else {
|
||||||
$q = Post\Engagement::escapeKeywords($q);
|
$q = Post\Engagement::escapeKeywords($q);
|
||||||
|
|
|
@ -56,8 +56,8 @@ class Tag extends BaseApi
|
||||||
$params = ['order' => ['uri-id' => true], 'limit' => $request['limit']];
|
$params = ['order' => ['uri-id' => true], 'limit' => $request['limit']];
|
||||||
|
|
||||||
$condition = ["`name` = ? AND (`uid` = ? OR (`uid` = ? AND NOT `global`))
|
$condition = ["`name` = ? AND (`uid` = ? OR (`uid` = ? AND NOT `global`))
|
||||||
AND (`network` IN (?, ?, ?, ?) OR (`uid` = ? AND `uid` != ?))",
|
AND (`network` IN (?, ?, ?) OR (`uid` = ? AND `uid` != ?))",
|
||||||
$this->parameters['hashtag'], 0, $uid, Protocol::ACTIVITYPUB, Protocol::DFRN, Protocol::DIASPORA, Protocol::OSTATUS, $uid, 0];
|
$this->parameters['hashtag'], 0, $uid, Protocol::ACTIVITYPUB, Protocol::DFRN, Protocol::DIASPORA, $uid, 0];
|
||||||
|
|
||||||
if ($request['local']) {
|
if ($request['local']) {
|
||||||
$condition = DBA::mergeConditions($condition, ["`uri-id` IN (SELECT `uri-id` FROM `post-user` WHERE `origin`)"]);
|
$condition = DBA::mergeConditions($condition, ["`uri-id` IN (SELECT `uri-id` FROM `post-user` WHERE `origin`)"]);
|
||||||
|
|
|
@ -118,21 +118,10 @@ class Contact extends BaseModule
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($contact['network'] == Protocol::OSTATUS) {
|
try {
|
||||||
$result = Model\Contact::createFromProbeForUser($contact['uid'], $contact['url'], $contact['network']);
|
UpdateContact::add(Worker::PRIORITY_HIGH, $contact_id);
|
||||||
|
} catch (\InvalidArgumentException $e) {
|
||||||
if ($result['success']) {
|
Logger::notice($e->getMessage(), ['contact' => $contact]);
|
||||||
Model\Contact::update(['subhub' => 1], ['id' => $contact_id]);
|
|
||||||
}
|
|
||||||
|
|
||||||
// pull feed and consume it, which should subscribe to the hub.
|
|
||||||
Worker::add(Worker::PRIORITY_HIGH, 'OnePoll', $contact_id, 'force');
|
|
||||||
} else {
|
|
||||||
try {
|
|
||||||
UpdateContact::add(Worker::PRIORITY_HIGH, $contact_id);
|
|
||||||
} catch (\InvalidArgumentException $e) {
|
|
||||||
Logger::notice($e->getMessage(), ['contact' => $contact]);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -125,11 +125,6 @@ class Follow extends BaseModule
|
||||||
$submit = '';
|
$submit = '';
|
||||||
}
|
}
|
||||||
|
|
||||||
if (($protocol == Protocol::OSTATUS) && $this->config->get('system', 'ostatus_disabled')) {
|
|
||||||
$this->sysMessages->addNotice($this->t("OStatus support is disabled. Contact can't be added."));
|
|
||||||
$submit = '';
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($protocol == Protocol::MAIL) {
|
if ($protocol == Protocol::MAIL) {
|
||||||
$contact['url'] = $contact['addr'];
|
$contact['url'] = $contact['addr'];
|
||||||
}
|
}
|
||||||
|
|
|
@ -294,7 +294,7 @@ class Profile extends BaseModule
|
||||||
}
|
}
|
||||||
$lblsuggest = (($contact['network'] === Protocol::DFRN) ? $this->t('Suggest friends') : '');
|
$lblsuggest = (($contact['network'] === Protocol::DFRN) ? $this->t('Suggest friends') : '');
|
||||||
|
|
||||||
$poll_enabled = in_array($contact['network'], [Protocol::DFRN, Protocol::OSTATUS, Protocol::FEED, Protocol::MAIL]);
|
$poll_enabled = in_array($contact['network'], [Protocol::DFRN, Protocol::FEED, Protocol::MAIL]);
|
||||||
|
|
||||||
$nettype = $this->t('Network type: %s', ContactSelector::networkToName($contact['network'], $contact['url'], $contact['protocol'], $contact['gsid']));
|
$nettype = $this->t('Network type: %s', ContactSelector::networkToName($contact['network'], $contact['url'], $contact['protocol'], $contact['gsid']));
|
||||||
|
|
||||||
|
@ -460,7 +460,7 @@ class Profile extends BaseModule
|
||||||
*/
|
*/
|
||||||
private function getContactActions(array $contact, LocalRelationship\Entity\LocalRelationship $localRelationship): array
|
private function getContactActions(array $contact, LocalRelationship\Entity\LocalRelationship $localRelationship): array
|
||||||
{
|
{
|
||||||
$poll_enabled = in_array($contact['network'], [Protocol::ACTIVITYPUB, Protocol::DFRN, Protocol::OSTATUS, Protocol::FEED, Protocol::MAIL]);
|
$poll_enabled = in_array($contact['network'], [Protocol::ACTIVITYPUB, Protocol::DFRN, Protocol::FEED, Protocol::MAIL]);
|
||||||
$contact_actions = [];
|
$contact_actions = [];
|
||||||
|
|
||||||
$formSecurityToken = self::getFormSecurityToken('contact_action');
|
$formSecurityToken = self::getFormSecurityToken('contact_action');
|
||||||
|
|
|
@ -51,7 +51,6 @@ class Notify extends BaseModule
|
||||||
{
|
{
|
||||||
$msg = Diaspora::decodeRaw($postdata, '', true);
|
$msg = Diaspora::decodeRaw($postdata, '', true);
|
||||||
if (!is_array($msg)) {
|
if (!is_array($msg)) {
|
||||||
// We have to fail silently to be able to hand it over to the salmon parser
|
|
||||||
$this->logger->warning('Diaspora::decodeRaw() has failed for some reason.', ['post-data' => $postdata]);
|
$this->logger->warning('Diaspora::decodeRaw() has failed for some reason.', ['post-data' => $postdata]);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,39 +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\Module\DFRN;
|
|
||||||
|
|
||||||
use Friendica\BaseModule;
|
|
||||||
use Friendica\Core\System;
|
|
||||||
use Friendica\Model\User;
|
|
||||||
use Friendica\Module\Response;
|
|
||||||
use Friendica\Network\HTTPException;
|
|
||||||
use Friendica\Protocol\OStatus;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* DFRN Poll
|
|
||||||
*/
|
|
||||||
class Poll extends BaseModule
|
|
||||||
{
|
|
||||||
protected function rawContent(array $request = [])
|
|
||||||
{
|
|
||||||
$owner = User::getByNickname(
|
|
||||||
$this->parameters['nickname'] ?? '',
|
|
||||||
['nickname', 'blocked', 'account_expired', 'account_removed']
|
|
||||||
);
|
|
||||||
if (!$owner || $owner['account_expired'] || $owner['account_removed']) {
|
|
||||||
throw new HTTPException\NotFoundException($this->t('User not found.'));
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($owner['blocked']) {
|
|
||||||
throw new HTTPException\UnauthorizedException($this->t('Access to this profile has been restricted.'));
|
|
||||||
}
|
|
||||||
|
|
||||||
$last_update = $request['last_update'] ?? '';
|
|
||||||
$this->httpExit(OStatus::feed($owner['nickname'], $last_update, 10) ?? '', Response::TYPE_ATOM);
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -55,11 +55,11 @@ class HCard extends BaseModule
|
||||||
$uri = urlencode('acct:' . $profile['nickname'] . '@' . DI::baseUrl()->getHost() . (DI::baseUrl()->getPath() ? '/' . DI::baseUrl()->getPath() : ''));
|
$uri = urlencode('acct:' . $profile['nickname'] . '@' . DI::baseUrl()->getHost() . (DI::baseUrl()->getPath() ? '/' . DI::baseUrl()->getPath() : ''));
|
||||||
|
|
||||||
$page['htmlhead'] .= '<meta name="dfrn-global-visibility" content="' . ($profile['net-publish'] ? 'true' : 'false') . '" />' . "\r\n";
|
$page['htmlhead'] .= '<meta name="dfrn-global-visibility" content="' . ($profile['net-publish'] ? 'true' : 'false') . '" />' . "\r\n";
|
||||||
$page['htmlhead'] .= '<link rel="alternate" type="application/atom+xml" href="' . $baseUrl . '/dfrn_poll/' . $nickname . '" />' . "\r\n";
|
$page['htmlhead'] .= '<link rel="alternate" type="application/atom+xml" href="' . $profile['poll'] . '" />' . "\r\n";
|
||||||
$page['htmlhead'] .= '<link rel="lrdd" type="application/xrd+xml" href="' . $baseUrl . '/xrd/?uri=' . $uri . '" />' . "\r\n";
|
$page['htmlhead'] .= '<link rel="lrdd" type="application/xrd+xml" href="' . $baseUrl . '/xrd/?uri=' . $uri . '" />' . "\r\n";
|
||||||
header('Link: <' . $baseUrl . '/xrd/?uri=' . $uri . '>; rel="lrdd"; type="application/xrd+xml"', false);
|
header('Link: <' . $baseUrl . '/xrd/?uri=' . $uri . '>; rel="lrdd"; type="application/xrd+xml"', false);
|
||||||
|
|
||||||
foreach (['request', 'confirm', 'notify', 'poll'] as $dfrn) {
|
foreach (['notify', 'poll'] as $dfrn) {
|
||||||
$page['htmlhead'] .= "<link rel=\"dfrn-{$dfrn}\" href=\"" . $baseUrl . "/dfrn_{$dfrn}/{$nickname}\" />\r\n";
|
$page['htmlhead'] .= "<link rel=\"dfrn-{$dfrn}\" href=\"" . $baseUrl . "/dfrn_{$dfrn}/{$nickname}\" />\r\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -50,7 +50,7 @@ class NoScrape extends BaseModule
|
||||||
'account-type' => $owner['account-type'],
|
'account-type' => $owner['account-type'],
|
||||||
];
|
];
|
||||||
|
|
||||||
$dfrn_pages = ['request', 'confirm', 'notify', 'poll'];
|
$dfrn_pages = ['notify', 'poll'];
|
||||||
foreach ($dfrn_pages as $dfrn) {
|
foreach ($dfrn_pages as $dfrn) {
|
||||||
$json_info["dfrn-{$dfrn}"] = DI::baseUrl() . "/dfrn_{$dfrn}/{$which}";
|
$json_info["dfrn-{$dfrn}"] = DI::baseUrl() . "/dfrn_{$dfrn}/{$which}";
|
||||||
}
|
}
|
||||||
|
|
|
@ -61,11 +61,6 @@ class NodeInfo110 extends BaseModule
|
||||||
$nodeinfo['protocols']['outbound'][] = 'diaspora';
|
$nodeinfo['protocols']['outbound'][] = 'diaspora';
|
||||||
}
|
}
|
||||||
|
|
||||||
if (empty($this->config->get('system', 'ostatus_disabled'))) {
|
|
||||||
$nodeinfo['protocols']['inbound'][] = 'gnusocial';
|
|
||||||
$nodeinfo['protocols']['outbound'][] = 'gnusocial';
|
|
||||||
}
|
|
||||||
|
|
||||||
$nodeinfo['metadata']['protocols'] = $nodeinfo['protocols'];
|
$nodeinfo['metadata']['protocols'] = $nodeinfo['protocols'];
|
||||||
$nodeinfo['metadata']['protocols']['outbound'][] = 'atom1.0';
|
$nodeinfo['metadata']['protocols']['outbound'][] = 'atom1.0';
|
||||||
$nodeinfo['metadata']['protocols']['inbound'][] = 'atom1.0';
|
$nodeinfo['metadata']['protocols']['inbound'][] = 'atom1.0';
|
||||||
|
|
|
@ -54,10 +54,6 @@ class NodeInfo120 extends BaseModule
|
||||||
$nodeinfo['protocols'][] = 'diaspora';
|
$nodeinfo['protocols'][] = 'diaspora';
|
||||||
}
|
}
|
||||||
|
|
||||||
if (empty($this->config->get('system', 'ostatus_disabled'))) {
|
|
||||||
$nodeinfo['protocols'][] = 'ostatus';
|
|
||||||
}
|
|
||||||
|
|
||||||
$nodeinfo['services']['inbound'][] = 'atom1.0';
|
$nodeinfo['services']['inbound'][] = 'atom1.0';
|
||||||
$nodeinfo['services']['inbound'][] = 'rss2.0';
|
$nodeinfo['services']['inbound'][] = 'rss2.0';
|
||||||
$nodeinfo['services']['outbound'][] = 'atom1.0';
|
$nodeinfo['services']['outbound'][] = 'atom1.0';
|
||||||
|
|
|
@ -56,10 +56,6 @@ class NodeInfo121 extends BaseModule
|
||||||
$nodeinfo['protocols'][] = 'diaspora';
|
$nodeinfo['protocols'][] = 'diaspora';
|
||||||
}
|
}
|
||||||
|
|
||||||
if (empty($this->config->get('system', 'ostatus_disabled'))) {
|
|
||||||
$nodeinfo['protocols'][] = 'ostatus';
|
|
||||||
}
|
|
||||||
|
|
||||||
$nodeinfo['services']['inbound'][] = 'atom1.0';
|
$nodeinfo['services']['inbound'][] = 'atom1.0';
|
||||||
$nodeinfo['services']['inbound'][] = 'rss2.0';
|
$nodeinfo['services']['inbound'][] = 'rss2.0';
|
||||||
$nodeinfo['services']['outbound'][] = 'atom1.0';
|
$nodeinfo['services']['outbound'][] = 'atom1.0';
|
||||||
|
|
|
@ -57,10 +57,6 @@ class NodeInfo122 extends BaseModule
|
||||||
$nodeinfo['protocols'][] = 'diaspora';
|
$nodeinfo['protocols'][] = 'diaspora';
|
||||||
}
|
}
|
||||||
|
|
||||||
if (empty($this->config->get('system', 'ostatus_disabled'))) {
|
|
||||||
$nodeinfo['protocols'][] = 'ostatus';
|
|
||||||
}
|
|
||||||
|
|
||||||
$nodeinfo['services']['inbound'][] = 'atom1.0';
|
$nodeinfo['services']['inbound'][] = 'atom1.0';
|
||||||
$nodeinfo['services']['inbound'][] = 'rss2.0';
|
$nodeinfo['services']['inbound'][] = 'rss2.0';
|
||||||
$nodeinfo['services']['outbound'][] = 'atom1.0';
|
$nodeinfo['services']['outbound'][] = 'atom1.0';
|
||||||
|
|
|
@ -52,10 +52,6 @@ class NodeInfo210 extends BaseModule
|
||||||
$nodeinfo['protocols'][] = 'diaspora';
|
$nodeinfo['protocols'][] = 'diaspora';
|
||||||
}
|
}
|
||||||
|
|
||||||
if (empty($this->config->get('system', 'ostatus_disabled'))) {
|
|
||||||
$nodeinfo['protocols'][] = 'ostatus';
|
|
||||||
}
|
|
||||||
|
|
||||||
$nodeinfo['services']['inbound'][] = 'atom1.0';
|
$nodeinfo['services']['inbound'][] = 'atom1.0';
|
||||||
$nodeinfo['services']['inbound'][] = 'rss2.0';
|
$nodeinfo['services']['inbound'][] = 'rss2.0';
|
||||||
$nodeinfo['services']['outbound'][] = 'atom1.0';
|
$nodeinfo['services']['outbound'][] = 'atom1.0';
|
||||||
|
|
|
@ -1,148 +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\Module\OStatus;
|
|
||||||
|
|
||||||
use Friendica\App;
|
|
||||||
use Friendica\Core\L10n;
|
|
||||||
use Friendica\Core\Protocol;
|
|
||||||
use Friendica\Core\System;
|
|
||||||
use Friendica\Database\Database;
|
|
||||||
use Friendica\Model\Contact;
|
|
||||||
use Friendica\Model\GServer;
|
|
||||||
use Friendica\Model\Item;
|
|
||||||
use Friendica\Model\Post;
|
|
||||||
use Friendica\Module\Response;
|
|
||||||
use Friendica\Network\HTTPException;
|
|
||||||
use Friendica\Protocol\OStatus;
|
|
||||||
use Friendica\Util\Network;
|
|
||||||
use Friendica\Util\Profiler;
|
|
||||||
use Friendica\Util\Strings;
|
|
||||||
use Psr\Log\LoggerInterface;
|
|
||||||
|
|
||||||
class PubSub extends \Friendica\BaseModule
|
|
||||||
{
|
|
||||||
/** @var Database */
|
|
||||||
private $database;
|
|
||||||
/** @var App\Request */
|
|
||||||
private $request;
|
|
||||||
|
|
||||||
public function __construct(App\Request $request, Database $database, L10n $l10n, App\BaseURL $baseUrl, App\Arguments $args, LoggerInterface $logger, Profiler $profiler, Response $response, array $server, array $parameters = [])
|
|
||||||
{
|
|
||||||
parent::__construct($l10n, $baseUrl, $args, $logger, $profiler, $response, $server, $parameters);
|
|
||||||
|
|
||||||
$this->database = $database;
|
|
||||||
$this->request = $request;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected function post(array $request = [])
|
|
||||||
{
|
|
||||||
$xml = Network::postdata();
|
|
||||||
|
|
||||||
$this->logger->info('Feed arrived.', ['from' => $this->request->getRemoteAddress(), 'for' => $this->args->getCommand(), 'user-agent' => $this->server['HTTP_USER_AGENT']]);
|
|
||||||
$this->logger->debug('Data stream.', ['xml' => $xml]);
|
|
||||||
$this->logger->debug('Got request data.', ['request' => $request]);
|
|
||||||
|
|
||||||
$nickname = $this->parameters['nickname'] ?? '';
|
|
||||||
$contact_id = $this->parameters['cid'] ?? 0;
|
|
||||||
|
|
||||||
$importer = $this->database->selectFirst('user', [], ['nickname' => $nickname, 'verified' => true, 'blocked' => false, 'account_removed' => false, 'account_expired' => false]);
|
|
||||||
if (!$importer) {
|
|
||||||
throw new HTTPException\OKException();
|
|
||||||
}
|
|
||||||
|
|
||||||
$condition = ['id' => $contact_id, 'uid' => $importer['uid'], 'subhub' => true, 'blocked' => false];
|
|
||||||
$contact = $this->database->selectFirst('contact', [], $condition);
|
|
||||||
if (!$contact) {
|
|
||||||
$author = OStatus::salmonAuthor($xml, $importer);
|
|
||||||
if (!empty($author['contact-id'])) {
|
|
||||||
$condition = ['id' => $author['contact-id'], 'uid' => $importer['uid'], 'subhub' => true, 'blocked' => false];
|
|
||||||
$contact = $this->database->selectFirst('contact', [], $condition);
|
|
||||||
$this->logger->notice('No record found for nickname, using author entry instead.', ['nickname' => $nickname, 'contact-id' => $contact_id, 'author-contact-id' => $author['contact-id']]);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!$contact) {
|
|
||||||
$this->logger->notice("Contact wasn't found - ignored.", ['author-link' => $author['author-link'], 'contact-id' => $contact_id, 'nickname' => $nickname, 'xml' => $xml]);
|
|
||||||
throw new HTTPException\OKException();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!empty($contact['gsid'])) {
|
|
||||||
GServer::setProtocol($contact['gsid'], Post\DeliveryData::OSTATUS);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!in_array($contact['rel'], [Contact::SHARING, Contact::FRIEND]) && ($contact['network'] != Protocol::FEED)) {
|
|
||||||
$this->logger->notice('Contact is not expected to share with us - ignored.', ['contact-id' => $contact['id']]);
|
|
||||||
throw new HTTPException\OKException();
|
|
||||||
}
|
|
||||||
|
|
||||||
// We only import feeds from OStatus here
|
|
||||||
if (!in_array($contact['network'], [Protocol::ACTIVITYPUB, Protocol::OSTATUS])) {
|
|
||||||
$this->logger->warning('Unexpected network', ['contact' => $contact, 'network' => $contact['network']]);
|
|
||||||
throw new HTTPException\OKException();
|
|
||||||
}
|
|
||||||
|
|
||||||
$this->logger->info('Import item from Contact.', ['nickname' => $nickname, 'contact-nickname' => $contact['nick'], 'contact-id' => $contact['id']]);
|
|
||||||
$feedhub = '';
|
|
||||||
Item::incrementOutbound(Protocol::OSTATUS);
|
|
||||||
OStatus::import($xml, $importer, $contact, $feedhub);
|
|
||||||
|
|
||||||
throw new HTTPException\OKException();
|
|
||||||
}
|
|
||||||
|
|
||||||
protected function rawContent(array $request = [])
|
|
||||||
{
|
|
||||||
$nickname = $this->parameters['nickname'] ?? '';
|
|
||||||
$contact_id = $this->parameters['cid'] ?? 0;
|
|
||||||
|
|
||||||
$hub_mode = trim($request['hub_mode'] ?? '');
|
|
||||||
$hub_topic = trim($request['hub_topic'] ?? '');
|
|
||||||
$hub_challenge = trim($request['hub_challenge'] ?? '');
|
|
||||||
$hub_verify = trim($request['hub_verify_token'] ?? '');
|
|
||||||
|
|
||||||
$this->logger->notice('Subscription start.', ['from' => $this->request->getRemoteAddress(), 'mode' => $hub_mode, 'nickname' => $nickname]);
|
|
||||||
$this->logger->debug('Data: ', ['get' => $request]);
|
|
||||||
|
|
||||||
$owner = $this->database->selectFirst('user', ['uid'], ['nickname' => $nickname, 'verified' => true, 'blocked' => false, 'account_removed' => false, 'account_expired' => false]);
|
|
||||||
if (!$owner) {
|
|
||||||
$this->logger->notice('Local account not found.', ['nickname' => $nickname]);
|
|
||||||
throw new HTTPException\NotFoundException();
|
|
||||||
}
|
|
||||||
|
|
||||||
$condition = ['uid' => $owner['uid'], 'id' => $contact_id, 'blocked' => false, 'pending' => false];
|
|
||||||
|
|
||||||
if (!empty($hub_verify)) {
|
|
||||||
$condition['hub-verify'] = $hub_verify;
|
|
||||||
}
|
|
||||||
|
|
||||||
$contact = $this->database->selectFirst('contact', ['id', 'poll'], $condition);
|
|
||||||
if (!$contact) {
|
|
||||||
$this->logger->notice('Contact not found.', ['contact' => $contact_id]);
|
|
||||||
throw new HTTPException\NotFoundException();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!empty($hub_topic) && !Strings::compareLink($hub_topic, $contact['poll'])) {
|
|
||||||
$this->logger->notice("Hub topic isn't valid for Contact.", ['hub_topic' => $hub_topic, 'contact_poll' => $contact['poll']]);
|
|
||||||
throw new HTTPException\NotFoundException();
|
|
||||||
}
|
|
||||||
|
|
||||||
// We must initiate an unsubscribe request with a verify_token.
|
|
||||||
// Don't allow outsiders to unsubscribe us.
|
|
||||||
|
|
||||||
if (($hub_mode === 'unsubscribe') && empty($hub_verify)) {
|
|
||||||
$this->logger->notice('Bogus unsubscribe');
|
|
||||||
throw new HTTPException\NotFoundException();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!empty($hub_mode)) {
|
|
||||||
Contact::update(['subhub' => $hub_mode === 'subscribe'], ['id' => $contact['id']]);
|
|
||||||
$this->logger->notice('Success for contact.', ['mode' => $hub_mode, 'contact' => $contact_id]);
|
|
||||||
}
|
|
||||||
|
|
||||||
$this->httpExit($hub_challenge);
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,165 +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\Module\OStatus;
|
|
||||||
|
|
||||||
use Friendica\App;
|
|
||||||
use Friendica\Core\Config\Capability\IManageConfigValues;
|
|
||||||
use Friendica\Core\L10n;
|
|
||||||
use Friendica\Database\Database;
|
|
||||||
use Friendica\Model\PushSubscriber;
|
|
||||||
use Friendica\Module\Response;
|
|
||||||
use Friendica\Network\HTTPClient\Capability\ICanSendHttpRequests;
|
|
||||||
use Friendica\Network\HTTPClient\Client\HttpClientAccept;
|
|
||||||
use Friendica\Network\HTTPClient\Client\HttpClientOptions;
|
|
||||||
use Friendica\Network\HTTPClient\Client\HttpClientRequest;
|
|
||||||
use Friendica\Network\HTTPException;
|
|
||||||
use Friendica\Util\Profiler;
|
|
||||||
use Friendica\Util\Strings;
|
|
||||||
use Psr\Log\LoggerInterface;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* An open, simple, web-scale and decentralized pubsub protocol.
|
|
||||||
*
|
|
||||||
* Part of the OStatus stack.
|
|
||||||
*
|
|
||||||
* See https://pubsubhubbub.github.io/PubSubHubbub/pubsubhubbub-core-0.4.html
|
|
||||||
*
|
|
||||||
* @version 0.4
|
|
||||||
*/
|
|
||||||
class PubSubHubBub extends \Friendica\BaseModule
|
|
||||||
{
|
|
||||||
/** @var IManageConfigValues */
|
|
||||||
private $config;
|
|
||||||
/** @var Database */
|
|
||||||
private $database;
|
|
||||||
/** @var ICanSendHttpRequests */
|
|
||||||
private $httpClient;
|
|
||||||
/** @var App\Request */
|
|
||||||
private $request;
|
|
||||||
|
|
||||||
public function __construct(App\Request $request, ICanSendHttpRequests $httpClient, Database $database, IManageConfigValues $config, L10n $l10n, App\BaseURL $baseUrl, App\Arguments $args, LoggerInterface $logger, Profiler $profiler, Response $response, array $server, array $parameters = [])
|
|
||||||
{
|
|
||||||
parent::__construct($l10n, $baseUrl, $args, $logger, $profiler, $response, $server, $parameters);
|
|
||||||
|
|
||||||
$this->config = $config;
|
|
||||||
$this->database = $database;
|
|
||||||
$this->httpClient = $httpClient;
|
|
||||||
$this->request = $request;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected function post(array $request = [])
|
|
||||||
{
|
|
||||||
// PuSH subscription must be considered "public" so just block it
|
|
||||||
// if public access isn't enabled.
|
|
||||||
if ($this->config->get('system', 'block_public')) {
|
|
||||||
throw new HTTPException\ForbiddenException();
|
|
||||||
}
|
|
||||||
|
|
||||||
$this->logger->debug('Got request data.', ['request' => $request]);
|
|
||||||
|
|
||||||
// Subscription request from subscriber
|
|
||||||
// https://pubsubhubbub.github.io/PubSubHubbub/pubsubhubbub-core-0.4.html#rfc.section.5.1
|
|
||||||
// Example from GNU Social:
|
|
||||||
// [hub_mode] => subscribe
|
|
||||||
// [hub_callback] => http://status.local/main/push/callback/1
|
|
||||||
// [hub_verify] => sync
|
|
||||||
// [hub_verify_token] => af11...
|
|
||||||
// [hub_secret] => af11...
|
|
||||||
// [hub_topic] => http://friendica.local/dfrn_poll/sazius
|
|
||||||
|
|
||||||
$hub_mode = $request['hub_mode'] ?? '';
|
|
||||||
$hub_callback = $request['hub_callback'] ?? '';
|
|
||||||
$hub_verify_token = $request['hub_verify_token'] ?? '';
|
|
||||||
$hub_secret = $request['hub_secret'] ?? '';
|
|
||||||
$hub_topic = $request['hub_topic'] ?? '';
|
|
||||||
|
|
||||||
// check for valid hub_mode
|
|
||||||
if ($hub_mode === 'subscribe') {
|
|
||||||
$subscribe = 1;
|
|
||||||
} elseif ($hub_mode === 'unsubscribe') {
|
|
||||||
$subscribe = 0;
|
|
||||||
} else {
|
|
||||||
$this->logger->notice('Invalid hub_mod - ignored.', ['mode' => $hub_mode]);
|
|
||||||
throw new HTTPException\NotFoundException();
|
|
||||||
}
|
|
||||||
|
|
||||||
$this->logger->info('hub_mode request details.', ['from' => $this->request->getRemoteAddress(), 'mode' => $hub_mode]);
|
|
||||||
|
|
||||||
$nickname = $this->parameters['nickname'] ?? $hub_topic;
|
|
||||||
|
|
||||||
// Extract nickname and strip any .atom extension
|
|
||||||
$nickname = basename($nickname, '.atom');
|
|
||||||
if (!$nickname) {
|
|
||||||
$this->logger->notice('Empty nick, ignoring.');
|
|
||||||
throw new HTTPException\NotFoundException();
|
|
||||||
}
|
|
||||||
|
|
||||||
// fetch user from database given the nickname
|
|
||||||
$condition = ['nickname' => $nickname, 'verified' => true, 'blocked' => false, 'account_removed' => false, 'account_expired' => false];
|
|
||||||
$owner = $this->database->selectFirst('user', ['uid', 'nickname'], $condition);
|
|
||||||
if (!$owner) {
|
|
||||||
$this->logger->notice('Local account not found', ['nickname' => $nickname, 'topic' => $hub_topic, 'callback' => $hub_callback]);
|
|
||||||
throw new HTTPException\NotFoundException();
|
|
||||||
}
|
|
||||||
|
|
||||||
// get corresponding row from contact table
|
|
||||||
$condition = ['uid' => $owner['uid'], 'blocked' => false, 'pending' => false, 'self' => true];
|
|
||||||
$contact = $this->database->selectFirst('contact', ['poll'], $condition);
|
|
||||||
if (!$contact) {
|
|
||||||
$this->logger->notice('Self contact for user not found.', ['uid' => $owner['uid']]);
|
|
||||||
throw new HTTPException\NotFoundException();
|
|
||||||
}
|
|
||||||
|
|
||||||
// sanity check that topic URLs are the same
|
|
||||||
$hub_topic2 = str_replace('/feed/', '/dfrn_poll/', $hub_topic);
|
|
||||||
$self = $this->baseUrl . '/api/statuses/user_timeline/' . $owner['nickname'] . '.atom';
|
|
||||||
|
|
||||||
if (!Strings::compareLink($hub_topic, $contact['poll']) && !Strings::compareLink($hub_topic2, $contact['poll']) && !Strings::compareLink($hub_topic, $self)) {
|
|
||||||
$this->logger->notice('Hub topic invalid', ['hub_topic' => $hub_topic, 'poll' => $contact['poll']]);
|
|
||||||
throw new HTTPException\NotFoundException();
|
|
||||||
}
|
|
||||||
|
|
||||||
// do subscriber verification according to the PuSH protocol
|
|
||||||
$hub_challenge = Strings::getRandomHex(40);
|
|
||||||
|
|
||||||
$params = http_build_query([
|
|
||||||
'hub.mode' => $subscribe == 1 ? 'subscribe' : 'unsubscribe',
|
|
||||||
'hub.topic' => $hub_topic,
|
|
||||||
'hub.challenge' => $hub_challenge,
|
|
||||||
'hub.verify_token' => $hub_verify_token,
|
|
||||||
|
|
||||||
// lease time is hard coded to one week (in seconds)
|
|
||||||
// we don't actually enforce the lease time because GNU
|
|
||||||
// Social/StatusNet doesn't honour it (yet)
|
|
||||||
'hub.lease_seconds' => 604800,
|
|
||||||
]);
|
|
||||||
|
|
||||||
$hub_callback = rtrim($hub_callback, ' ?&#');
|
|
||||||
$separator = parse_url($hub_callback, PHP_URL_QUERY) === null ? '?' : '&';
|
|
||||||
|
|
||||||
$fetchResult = $this->httpClient->get($hub_callback . $separator . $params, HttpClientAccept::DEFAULT, [HttpClientOptions::REQUEST => HttpClientRequest::PUBSUB]);
|
|
||||||
$body = $fetchResult->getBodyString();
|
|
||||||
$returnCode = $fetchResult->getReturnCode();
|
|
||||||
|
|
||||||
// give up if the HTTP return code wasn't a success (2xx)
|
|
||||||
if ($returnCode < 200 || $returnCode > 299) {
|
|
||||||
$this->logger->notice('Subscriber verification ignored', ['hub_topic' => $hub_topic, 'callback' => $hub_callback, 'returnCode' => $returnCode]);
|
|
||||||
throw new HTTPException\NotFoundException();
|
|
||||||
}
|
|
||||||
|
|
||||||
// check that the correct hub_challenge code was echoed back
|
|
||||||
if (trim($body) !== $hub_challenge) {
|
|
||||||
$this->logger->notice('Subscriber did not echo back hub.challenge, ignoring.', ['hub_challenge' => $hub_challenge, 'body' => trim($body)]);
|
|
||||||
throw new HTTPException\NotFoundException();
|
|
||||||
}
|
|
||||||
|
|
||||||
PushSubscriber::renew($owner['uid'], $nickname, $subscribe, $hub_callback, $hub_topic, $hub_secret);
|
|
||||||
|
|
||||||
throw new HTTPException\AcceptedException();
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,79 +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\Module\OStatus;
|
|
||||||
|
|
||||||
use Friendica\App;
|
|
||||||
use Friendica\Core\L10n;
|
|
||||||
use Friendica\Core\Protocol;
|
|
||||||
use Friendica\Core\Renderer;
|
|
||||||
use Friendica\Core\Session\Capability\IHandleUserSessions;
|
|
||||||
use Friendica\Database\Database;
|
|
||||||
use Friendica\Model\Contact;
|
|
||||||
use Friendica\Module\Response;
|
|
||||||
use Friendica\Navigation\SystemMessages;
|
|
||||||
use Friendica\Util\Profiler;
|
|
||||||
use Psr\Log\LoggerInterface;
|
|
||||||
|
|
||||||
class Repair extends \Friendica\BaseModule
|
|
||||||
{
|
|
||||||
/** @var IHandleUserSessions */
|
|
||||||
private $session;
|
|
||||||
/** @var SystemMessages */
|
|
||||||
private $systemMessages;
|
|
||||||
/** @var Database */
|
|
||||||
private $database;
|
|
||||||
/** @var App\Page */
|
|
||||||
private $page;
|
|
||||||
|
|
||||||
public function __construct(App\Page $page, Database $database, SystemMessages $systemMessages, IHandleUserSessions $session, L10n $l10n, App\BaseURL $baseUrl, App\Arguments $args, LoggerInterface $logger, Profiler $profiler, Response $response, array $server, array $parameters = [])
|
|
||||||
{
|
|
||||||
parent::__construct($l10n, $baseUrl, $args, $logger, $profiler, $response, $server, $parameters);
|
|
||||||
|
|
||||||
$this->session = $session;
|
|
||||||
$this->systemMessages = $systemMessages;
|
|
||||||
$this->database = $database;
|
|
||||||
$this->page = $page;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected function content(array $request = []): string
|
|
||||||
{
|
|
||||||
if (!$this->session->getLocalUserId()) {
|
|
||||||
$this->systemMessages->addNotice($this->t('Permission denied.'));
|
|
||||||
$this->baseUrl->redirect('login');
|
|
||||||
}
|
|
||||||
|
|
||||||
$uid = $this->session->getLocalUserId();
|
|
||||||
|
|
||||||
$counter = intval($request['counter'] ?? 0);
|
|
||||||
|
|
||||||
$condition = ['uid' => $uid, 'network' => Protocol::OSTATUS, 'rel' => [Contact::FRIEND, Contact::SHARING]];
|
|
||||||
$total = $this->database->count('contact', $condition);
|
|
||||||
if ($total) {
|
|
||||||
$contacts = Contact::selectToArray(['url'], $condition, ['order' => ['url'], 'limit' => [$counter++, 1]]);
|
|
||||||
if ($contacts) {
|
|
||||||
Contact::createFromProbeForUser($this->session->getLocalUserId(), $contacts[0]['url']);
|
|
||||||
|
|
||||||
$this->page['htmlhead'] .= '<meta http-equiv="refresh" content="5; url=ostatus/repair?counter=' . $counter . '">';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$tpl = Renderer::getMarkupTemplate('ostatus/repair.tpl');
|
|
||||||
|
|
||||||
return Renderer::replaceMacros($tpl, [
|
|
||||||
'$l10n' => [
|
|
||||||
'title' => $this->t('Resubscribing to OStatus contacts'),
|
|
||||||
'keep' => $this->t('Keep this window open until done.'),
|
|
||||||
'done' => $this->t('✔ Done'),
|
|
||||||
'nocontacts' => $this->t('No OStatus contacts to resubscribe to.'),
|
|
||||||
],
|
|
||||||
'$total' => $total,
|
|
||||||
'$counter' => $counter,
|
|
||||||
'$contact' => $contacts[0] ?? null,
|
|
||||||
]);
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,205 +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\Module\OStatus;
|
|
||||||
|
|
||||||
use Friendica\App;
|
|
||||||
use Friendica\Core\L10n;
|
|
||||||
use Friendica\Core\Protocol;
|
|
||||||
use Friendica\Database\Database;
|
|
||||||
use Friendica\Model\GServer;
|
|
||||||
use Friendica\Model\Item;
|
|
||||||
use Friendica\Model\Post;
|
|
||||||
use Friendica\Module\Response;
|
|
||||||
use Friendica\Protocol\ActivityNamespace;
|
|
||||||
use Friendica\Protocol\OStatus;
|
|
||||||
use Friendica\Util\Crypto;
|
|
||||||
use Friendica\Util\Network;
|
|
||||||
use Friendica\Network\HTTPException;
|
|
||||||
use Friendica\Protocol\Salmon as SalmonProtocol;
|
|
||||||
use Friendica\Util\Profiler;
|
|
||||||
use Friendica\Util\Strings;
|
|
||||||
use Psr\Log\LoggerInterface;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Technical endpoint for the Salmon protocol
|
|
||||||
*/
|
|
||||||
class Salmon extends \Friendica\BaseModule
|
|
||||||
{
|
|
||||||
/** @var Database */
|
|
||||||
private $database;
|
|
||||||
|
|
||||||
public function __construct(Database $database, L10n $l10n, App\BaseURL $baseUrl, App\Arguments $args, LoggerInterface $logger, Profiler $profiler, Response $response, array $server, array $parameters = [])
|
|
||||||
{
|
|
||||||
parent::__construct($l10n, $baseUrl, $args, $logger, $profiler, $response, $server, $parameters);
|
|
||||||
|
|
||||||
$this->database = $database;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param array $request
|
|
||||||
* @return void
|
|
||||||
* @throws HTTPException\AcceptedException
|
|
||||||
* @throws HTTPException\BadRequestException
|
|
||||||
* @throws HTTPException\InternalServerErrorException
|
|
||||||
* @throws HTTPException\OKException
|
|
||||||
* @throws \ImagickException
|
|
||||||
*/
|
|
||||||
protected function post(array $request = [])
|
|
||||||
{
|
|
||||||
$xml = Network::postdata();
|
|
||||||
$this->logger->debug('Got request data.', ['request' => $request]);
|
|
||||||
|
|
||||||
$nickname = $this->parameters['nickname'] ?? '';
|
|
||||||
if (empty($nickname)) {
|
|
||||||
throw new HTTPException\BadRequestException('nickname parameter is mandatory');
|
|
||||||
}
|
|
||||||
|
|
||||||
$this->logger->debug('New Salmon', ['nickname' => $nickname, 'xml' => $xml]);
|
|
||||||
|
|
||||||
$importer = $this->database->selectFirst('user', [], ['nickname' => $nickname, 'verified' => true, 'blocked' => false, 'account_removed' => false, 'account_expired' => false]);
|
|
||||||
if (!$this->database->isResult($importer)) {
|
|
||||||
throw new HTTPException\InternalServerErrorException();
|
|
||||||
}
|
|
||||||
|
|
||||||
// parse the xml
|
|
||||||
$dom = simplexml_load_string($xml, 'SimpleXMLElement', 0, ActivityNamespace::SALMON_ME);
|
|
||||||
|
|
||||||
$base = null;
|
|
||||||
|
|
||||||
// figure out where in the DOM tree our data is hiding
|
|
||||||
if (!empty($dom->provenance->data)) {
|
|
||||||
$base = $dom->provenance;
|
|
||||||
} elseif (!empty($dom->env->data)) {
|
|
||||||
$base = $dom->env;
|
|
||||||
} elseif (!empty($dom->data)) {
|
|
||||||
$base = $dom;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (empty($base)) {
|
|
||||||
$this->logger->notice('unable to locate salmon data in xml');
|
|
||||||
throw new HTTPException\BadRequestException();
|
|
||||||
}
|
|
||||||
|
|
||||||
// Stash the signature away for now. We have to find their key or it won't be good for anything.
|
|
||||||
$signature = Strings::base64UrlDecode($base->sig);
|
|
||||||
|
|
||||||
// unpack the data
|
|
||||||
|
|
||||||
// strip whitespace so our data element will return to one big base64 blob
|
|
||||||
$data = str_replace([" ", "\t", "\r", "\n"], ["", "", "", ""], $base->data);
|
|
||||||
|
|
||||||
// stash away some other stuff for later
|
|
||||||
|
|
||||||
$type = $base->data[0]->attributes()->type[0];
|
|
||||||
$keyhash = $base->sig[0]->attributes()->keyhash[0] ?? '';
|
|
||||||
$encoding = $base->encoding;
|
|
||||||
$alg = $base->alg;
|
|
||||||
|
|
||||||
// Salmon magic signatures have evolved and there is no way of knowing ahead of time which
|
|
||||||
// flavour we have. We'll try and verify it regardless.
|
|
||||||
|
|
||||||
$stnet_signed_data = $data;
|
|
||||||
|
|
||||||
$signed_data = $data . '.' . Strings::base64UrlEncode($type) . '.' . Strings::base64UrlEncode($encoding) . '.' . Strings::base64UrlEncode($alg);
|
|
||||||
|
|
||||||
$compliant_format = str_replace('=', '', $signed_data);
|
|
||||||
|
|
||||||
|
|
||||||
// decode the data
|
|
||||||
$data = Strings::base64UrlDecode($data);
|
|
||||||
|
|
||||||
$author = OStatus::salmonAuthor($data, $importer);
|
|
||||||
$author_link = $author["author-link"];
|
|
||||||
if (!$author_link) {
|
|
||||||
$this->logger->notice('Could not retrieve author URI.');
|
|
||||||
throw new HTTPException\BadRequestException();
|
|
||||||
}
|
|
||||||
|
|
||||||
// Once we have the author URI, go to the web and try to find their public key
|
|
||||||
|
|
||||||
$this->logger->notice('Fetching key for ' . $author_link);
|
|
||||||
|
|
||||||
$key = SalmonProtocol::getKey($author_link, $keyhash);
|
|
||||||
|
|
||||||
if (!$key) {
|
|
||||||
$this->logger->notice('Could not retrieve author key.');
|
|
||||||
throw new HTTPException\BadRequestException();
|
|
||||||
}
|
|
||||||
|
|
||||||
$this->logger->info('Key details', ['info' => $key]);
|
|
||||||
|
|
||||||
$pubkey = SalmonProtocol::magicKeyToPem($key);
|
|
||||||
|
|
||||||
// We should have everything we need now. Let's see if it verifies.
|
|
||||||
|
|
||||||
// Try GNU Social format
|
|
||||||
$verify = Crypto::rsaVerify($signed_data, $signature, $pubkey);
|
|
||||||
$mode = 1;
|
|
||||||
|
|
||||||
if (!$verify) {
|
|
||||||
$this->logger->notice('Message did not verify using protocol. Trying compliant format.');
|
|
||||||
$verify = Crypto::rsaVerify($compliant_format, $signature, $pubkey);
|
|
||||||
$mode = 2;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!$verify) {
|
|
||||||
$this->logger->notice('Message did not verify using padding. Trying old statusnet format.');
|
|
||||||
$verify = Crypto::rsaVerify($stnet_signed_data, $signature, $pubkey);
|
|
||||||
$mode = 3;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!$verify) {
|
|
||||||
$this->logger->notice('Message did not verify. Discarding.');
|
|
||||||
throw new HTTPException\BadRequestException();
|
|
||||||
}
|
|
||||||
|
|
||||||
$this->logger->notice('Message verified with mode ' . $mode);
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
*
|
|
||||||
* If we reached this point, the message is good. Now let's figure out if the author is allowed to send us stuff.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
$contact = $this->database->selectFirst(
|
|
||||||
'contact',
|
|
||||||
[],
|
|
||||||
[
|
|
||||||
"`network` IN (?, ?)
|
|
||||||
AND (`nurl` = ? OR `alias` = ? OR `alias` = ?)
|
|
||||||
AND `uid` = ?",
|
|
||||||
Protocol::OSTATUS, Protocol::DFRN,
|
|
||||||
Strings::normaliseLink($author_link), $author_link, Strings::normaliseLink($author_link),
|
|
||||||
$importer['uid']
|
|
||||||
]
|
|
||||||
);
|
|
||||||
|
|
||||||
if (!empty($contact['gsid'])) {
|
|
||||||
GServer::setProtocol($contact['gsid'], Post\DeliveryData::OSTATUS);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Have we ignored the person?
|
|
||||||
// If so we can not accept this post.
|
|
||||||
|
|
||||||
if (!empty($contact['blocked'])) {
|
|
||||||
$this->logger->notice('Ignoring this author.');
|
|
||||||
throw new HTTPException\AcceptedException();
|
|
||||||
}
|
|
||||||
|
|
||||||
// Placeholder for hub discovery.
|
|
||||||
$hub = '';
|
|
||||||
|
|
||||||
$contact = $contact ?: [];
|
|
||||||
|
|
||||||
Item::incrementOutbound(Protocol::OSTATUS);
|
|
||||||
OStatus::import($data, $importer, $contact, $hub);
|
|
||||||
|
|
||||||
throw new HTTPException\OKException();
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -77,7 +77,7 @@ class Common extends BaseProfile
|
||||||
$condition = [
|
$condition = [
|
||||||
'blocked' => false,
|
'blocked' => false,
|
||||||
'deleted' => false,
|
'deleted' => false,
|
||||||
'network' => [Protocol::ACTIVITYPUB, Protocol::DFRN, Protocol::DIASPORA, Protocol::OSTATUS, Protocol::FEED],
|
'network' => [Protocol::ACTIVITYPUB, Protocol::DFRN, Protocol::DIASPORA, Protocol::FEED],
|
||||||
];
|
];
|
||||||
|
|
||||||
$total = Contact\Relation::countCommon($sourceId, $targetId, $condition);
|
$total = Contact\Relation::countCommon($sourceId, $targetId, $condition);
|
||||||
|
|
|
@ -78,7 +78,7 @@ class Contacts extends Module\BaseProfile
|
||||||
'archive' => false,
|
'archive' => false,
|
||||||
'failed' => false,
|
'failed' => false,
|
||||||
'self' => false,
|
'self' => false,
|
||||||
'network' => [Protocol::ACTIVITYPUB, Protocol::DFRN, Protocol::DIASPORA, Protocol::OSTATUS]
|
'network' => [Protocol::ACTIVITYPUB, Protocol::DFRN, Protocol::DIASPORA]
|
||||||
];
|
];
|
||||||
|
|
||||||
switch ($type) {
|
switch ($type) {
|
||||||
|
|
|
@ -89,7 +89,6 @@ class Conversations extends BaseProfile
|
||||||
$this->page['htmlhead'] .= '<meta content="noindex, noarchive" name="robots" />' . "\n";
|
$this->page['htmlhead'] .= '<meta content="noindex, noarchive" name="robots" />' . "\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->page['htmlhead'] .= '<link rel="alternate" type="application/atom+xml" href="' . $this->baseUrl . '/dfrn_poll/' . $this->parameters['nickname'] . '" title="DFRN: ' . $this->t('%s\'s timeline', Strings::escapeHtml($profile['name'])) . '"/>' . "\n";
|
|
||||||
$this->page['htmlhead'] .= '<link rel="alternate" type="application/atom+xml" href="' . $this->baseUrl . '/feed/' . $this->parameters['nickname'] . '/" title="' . $this->t('%s\'s posts', Strings::escapeHtml($profile['name'])) . '"/>' . "\n";
|
$this->page['htmlhead'] .= '<link rel="alternate" type="application/atom+xml" href="' . $this->baseUrl . '/feed/' . $this->parameters['nickname'] . '/" title="' . $this->t('%s\'s posts', Strings::escapeHtml($profile['name'])) . '"/>' . "\n";
|
||||||
$this->page['htmlhead'] .= '<link rel="alternate" type="application/atom+xml" href="' . $this->baseUrl . '/feed/' . $this->parameters['nickname'] . '/comments" title="' . $this->t('%s\'s comments', Strings::escapeHtml($profile['name'])) . '"/>' . "\n";
|
$this->page['htmlhead'] .= '<link rel="alternate" type="application/atom+xml" href="' . $this->baseUrl . '/feed/' . $this->parameters['nickname'] . '/comments" title="' . $this->t('%s\'s comments', Strings::escapeHtml($profile['name'])) . '"/>' . "\n";
|
||||||
$this->page['htmlhead'] .= '<link rel="alternate" type="application/atom+xml" href="' . $this->baseUrl . '/feed/' . $this->parameters['nickname'] . '/activity" title="' . $this->t('%s\'s timeline', Strings::escapeHtml($profile['name'])) . '"/>' . "\n";
|
$this->page['htmlhead'] .= '<link rel="alternate" type="application/atom+xml" href="' . $this->baseUrl . '/feed/' . $this->parameters['nickname'] . '/activity" title="' . $this->t('%s\'s timeline', Strings::escapeHtml($profile['name'])) . '"/>' . "\n";
|
||||||
|
|
|
@ -336,7 +336,6 @@ class Profile extends BaseProfile
|
||||||
$htmlhead .= '<meta content="noindex, noarchive" name="robots" />' . "\n";
|
$htmlhead .= '<meta content="noindex, noarchive" name="robots" />' . "\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
$htmlhead .= '<link rel="alternate" type="application/atom+xml" href="' . $this->baseUrl . '/dfrn_poll/' . $nickname . '" title="DFRN: ' . $this->t('%s\'s timeline', htmlspecialchars($profile['name'], ENT_COMPAT, 'UTF-8', true)) . '"/>' . "\n";
|
|
||||||
$htmlhead .= '<link rel="alternate" type="application/atom+xml" href="' . $this->baseUrl . '/feed/' . $nickname . '/" title="' . $this->t('%s\'s posts', htmlspecialchars($profile['name'], ENT_COMPAT, 'UTF-8', true)) . '"/>' . "\n";
|
$htmlhead .= '<link rel="alternate" type="application/atom+xml" href="' . $this->baseUrl . '/feed/' . $nickname . '/" title="' . $this->t('%s\'s posts', htmlspecialchars($profile['name'], ENT_COMPAT, 'UTF-8', true)) . '"/>' . "\n";
|
||||||
$htmlhead .= '<link rel="alternate" type="application/atom+xml" href="' . $this->baseUrl . '/feed/' . $nickname . '/comments" title="' . $this->t('%s\'s comments', htmlspecialchars($profile['name'], ENT_COMPAT, 'UTF-8', true)) . '"/>' . "\n";
|
$htmlhead .= '<link rel="alternate" type="application/atom+xml" href="' . $this->baseUrl . '/feed/' . $nickname . '/comments" title="' . $this->t('%s\'s comments', htmlspecialchars($profile['name'], ENT_COMPAT, 'UTF-8', true)) . '"/>' . "\n";
|
||||||
$htmlhead .= '<link rel="alternate" type="application/atom+xml" href="' . $this->baseUrl . '/feed/' . $nickname . '/activity" title="' . $this->t('%s\'s timeline', htmlspecialchars($profile['name'], ENT_COMPAT, 'UTF-8', true)) . '"/>' . "\n";
|
$htmlhead .= '<link rel="alternate" type="application/atom+xml" href="' . $this->baseUrl . '/feed/' . $nickname . '/activity" title="' . $this->t('%s\'s timeline', htmlspecialchars($profile['name'], ENT_COMPAT, 'UTF-8', true)) . '"/>' . "\n";
|
||||||
|
@ -344,7 +343,7 @@ class Profile extends BaseProfile
|
||||||
$htmlhead .= '<link rel="lrdd" type="application/xrd+xml" href="' . $this->baseUrl . '/xrd/?uri=' . $uri . '" />' . "\n";
|
$htmlhead .= '<link rel="lrdd" type="application/xrd+xml" href="' . $this->baseUrl . '/xrd/?uri=' . $uri . '" />' . "\n";
|
||||||
header('Link: <' . $this->baseUrl . '/xrd/?uri=' . $uri . '>; rel="lrdd"; type="application/xrd+xml"', false);
|
header('Link: <' . $this->baseUrl . '/xrd/?uri=' . $uri . '>; rel="lrdd"; type="application/xrd+xml"', false);
|
||||||
|
|
||||||
$dfrn_pages = ['request', 'confirm', 'notify', 'poll'];
|
$dfrn_pages = ['notify', 'poll'];
|
||||||
foreach ($dfrn_pages as $dfrn) {
|
foreach ($dfrn_pages as $dfrn) {
|
||||||
$htmlhead .= '<link rel="dfrn-' . $dfrn . '" href="' . $this->baseUrl . '/dfrn_' . $dfrn . '/' . $nickname . '" />' . "\n";
|
$htmlhead .= '<link rel="dfrn-' . $dfrn . '" href="' . $this->baseUrl . '/dfrn_' . $dfrn . '/' . $nickname . '" />' . "\n";
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,40 +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\Module;
|
|
||||||
|
|
||||||
use Friendica\BaseModule;
|
|
||||||
use Friendica\Core\System;
|
|
||||||
use Friendica\Model\User;
|
|
||||||
use Friendica\Network\HTTPException\BadRequestException;
|
|
||||||
use Friendica\Protocol\Salmon;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* prints the public RSA key of a user
|
|
||||||
*/
|
|
||||||
class PublicRSAKey extends BaseModule
|
|
||||||
{
|
|
||||||
protected function rawContent(array $request = [])
|
|
||||||
{
|
|
||||||
if (empty($this->parameters['nick'])) {
|
|
||||||
throw new BadRequestException();
|
|
||||||
}
|
|
||||||
|
|
||||||
$nick = $this->parameters['nick'];
|
|
||||||
|
|
||||||
$user = User::getByNickname($nick, ['spubkey']);
|
|
||||||
if (empty($user) || empty($user['spubkey'])) {
|
|
||||||
throw new BadRequestException();
|
|
||||||
}
|
|
||||||
|
|
||||||
$this->httpExit(
|
|
||||||
Salmon::salmonKey($user['spubkey']),
|
|
||||||
Response::TYPE_BLANK,
|
|
||||||
'application/magic-public-key'
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -141,11 +141,6 @@ class Acl extends BaseModule
|
||||||
|
|
||||||
switch ($type) {
|
switch ($type) {
|
||||||
case self::TYPE_MENTION_CONTACT_CIRCLE:
|
case self::TYPE_MENTION_CONTACT_CIRCLE:
|
||||||
$condition = DBA::mergeConditions($condition,
|
|
||||||
["NOT `self` AND NOT `blocked` AND `network` != ?", Protocol::OSTATUS
|
|
||||||
]);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case self::TYPE_MENTION_CONTACT:
|
case self::TYPE_MENTION_CONTACT:
|
||||||
$condition = DBA::mergeConditions($condition,
|
$condition = DBA::mergeConditions($condition,
|
||||||
["NOT `self` AND NOT `blocked`",
|
["NOT `self` AND NOT `blocked`",
|
||||||
|
|
|
@ -154,12 +154,8 @@ class Connectors extends BaseSettings
|
||||||
$diasp_enabled = $this->config->get('system', 'diaspora_enabled') ?
|
$diasp_enabled = $this->config->get('system', 'diaspora_enabled') ?
|
||||||
$this->t('Built-in support for %s connectivity is enabled', $this->t('Diaspora (Socialhome, Hubzilla)')) :
|
$this->t('Built-in support for %s connectivity is enabled', $this->t('Diaspora (Socialhome, Hubzilla)')) :
|
||||||
$this->t('Built-in support for %s connectivity is disabled', $this->t('Diaspora (Socialhome, Hubzilla)'));
|
$this->t('Built-in support for %s connectivity is disabled', $this->t('Diaspora (Socialhome, Hubzilla)'));
|
||||||
$ostat_enabled = $this->config->get('system', 'ostatus_disabled') ?
|
|
||||||
$this->t('Built-in support for %s connectivity is disabled', $this->t('OStatus (GNU Social)')) :
|
|
||||||
$this->t('Built-in support for %s connectivity is enabled', $this->t('OStatus (GNU Social)'));
|
|
||||||
} else {
|
} else {
|
||||||
$diasp_enabled = '';
|
$diasp_enabled = '';
|
||||||
$ostat_enabled = '';
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$mail_enabled = function_exists('imap_open') && !$this->config->get('system', 'imap_disabled');
|
$mail_enabled = function_exists('imap_open') && !$this->config->get('system', 'imap_disabled');
|
||||||
|
@ -199,7 +195,6 @@ class Connectors extends BaseSettings
|
||||||
'$title' => $this->t('Social Networks'),
|
'$title' => $this->t('Social Networks'),
|
||||||
|
|
||||||
'$diasp_enabled' => $diasp_enabled,
|
'$diasp_enabled' => $diasp_enabled,
|
||||||
'$ostat_enabled' => $ostat_enabled,
|
|
||||||
|
|
||||||
'$general_settings' => $this->t('General Social Media Settings'),
|
'$general_settings' => $this->t('General Social Media Settings'),
|
||||||
'$accept_only_sharer' => [
|
'$accept_only_sharer' => [
|
||||||
|
@ -221,8 +216,6 @@ class Connectors extends BaseSettings
|
||||||
'$api_auto_attach' => ['api_auto_attach', $this->t('API: Automatically links at the end of the post as attached posts'), $api_auto_attach, $this->t('When activated, added links at the end of the post react the same way as added links in the web interface.')],
|
'$api_auto_attach' => ['api_auto_attach', $this->t('API: Automatically links at the end of the post as attached posts'), $api_auto_attach, $this->t('When activated, added links at the end of the post react the same way as added links in the web interface.')],
|
||||||
'$article_mode' => ['article_mode', $this->t('Article Mode'), $article_mode, $this->t("Controls how posts with titles are transmitted. Mastodon and its forks don't display the content of these posts if the post is created in the correct (default) way."), $article_modes],
|
'$article_mode' => ['article_mode', $this->t('Article Mode'), $article_mode, $this->t("Controls how posts with titles are transmitted. Mastodon and its forks don't display the content of these posts if the post is created in the correct (default) way."), $article_modes],
|
||||||
'$legacy_contact' => ['legacy_contact', $this->t('Your legacy ActivityPub/GNU Social account'), $legacy_contact, $this->t('If you enter your old account name from an ActivityPub based system or your GNU Social/Statusnet account name here (in the format user@domain.tld), your contacts will be added automatically. The field will be emptied when done.')],
|
'$legacy_contact' => ['legacy_contact', $this->t('Your legacy ActivityPub/GNU Social account'), $legacy_contact, $this->t('If you enter your old account name from an ActivityPub based system or your GNU Social/Statusnet account name here (in the format user@domain.tld), your contacts will be added automatically. The field will be emptied when done.')],
|
||||||
'$repair_ostatus_url' => 'ostatus/repair',
|
|
||||||
'$repair_ostatus_text' => $this->t('Repair OStatus subscriptions'),
|
|
||||||
|
|
||||||
'$connector_settings_forms' => $connector_settings_forms,
|
'$connector_settings_forms' => $connector_settings_forms,
|
||||||
|
|
||||||
|
|
|
@ -8,10 +8,8 @@
|
||||||
namespace Friendica\Module\WellKnown;
|
namespace Friendica\Module\WellKnown;
|
||||||
|
|
||||||
use Friendica\BaseModule;
|
use Friendica\BaseModule;
|
||||||
use Friendica\Core\System;
|
|
||||||
use Friendica\DI;
|
use Friendica\DI;
|
||||||
use Friendica\Module\Response;
|
use Friendica\Module\Response;
|
||||||
use Friendica\Protocol\Salmon;
|
|
||||||
use Friendica\Util\Crypto;
|
use Friendica\Util\Crypto;
|
||||||
use Friendica\Util\XML;
|
use Friendica\Util\XML;
|
||||||
|
|
||||||
|
@ -66,15 +64,8 @@ class HostMeta extends BaseModule
|
||||||
'href' => $domain . '/amcd'
|
'href' => $domain . '/amcd'
|
||||||
]
|
]
|
||||||
],
|
],
|
||||||
'Property' => [
|
|
||||||
'@attributes' => [
|
|
||||||
'type' => 'http://salmon-protocol.org/ns/magic-key',
|
|
||||||
'mk:key_id' => '1'
|
|
||||||
],
|
|
||||||
Salmon::salmonKey($config->get('system', 'site_pubkey'))
|
|
||||||
]
|
|
||||||
],
|
],
|
||||||
], $xml, false, ['hm' => 'http://host-meta.net/xrd/1.0', 'mk' => 'http://salmon-protocol.org/ns/magic-key']);
|
], $xml, false, ['hm' => 'http://host-meta.net/xrd/1.0']);
|
||||||
|
|
||||||
$this->httpExit($xml->saveXML(), Response::TYPE_XML, 'application/xrd+xml');
|
$this->httpExit($xml->saveXML(), Response::TYPE_XML, 'application/xrd+xml');
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,14 +8,12 @@
|
||||||
namespace Friendica\Module;
|
namespace Friendica\Module;
|
||||||
|
|
||||||
use Friendica\BaseModule;
|
use Friendica\BaseModule;
|
||||||
use Friendica\Core\System;
|
|
||||||
use Friendica\DI;
|
use Friendica\DI;
|
||||||
use Friendica\Model\Photo;
|
use Friendica\Model\Photo;
|
||||||
use Friendica\Model\User;
|
use Friendica\Model\User;
|
||||||
use Friendica\Network\HTTPException\BadRequestException;
|
use Friendica\Network\HTTPException\BadRequestException;
|
||||||
use Friendica\Network\HTTPException\NotFoundException;
|
use Friendica\Network\HTTPException\NotFoundException;
|
||||||
use Friendica\Protocol\ActivityNamespace;
|
use Friendica\Protocol\ActivityNamespace;
|
||||||
use Friendica\Protocol\Salmon;
|
|
||||||
use Friendica\Util\Network;
|
use Friendica\Util\Network;
|
||||||
use Friendica\Util\XML;
|
use Friendica\Util\XML;
|
||||||
|
|
||||||
|
@ -132,6 +130,11 @@ class Xrd extends BaseModule
|
||||||
'subject' => 'acct:' . $owner['addr'],
|
'subject' => 'acct:' . $owner['addr'],
|
||||||
'aliases' => [$owner['url']],
|
'aliases' => [$owner['url']],
|
||||||
'links' => [
|
'links' => [
|
||||||
|
[
|
||||||
|
'rel' => ActivityNamespace::FEED,
|
||||||
|
'type' => 'application/atom+xml',
|
||||||
|
'href' => $owner['poll'] ?? $baseURL,
|
||||||
|
],
|
||||||
[
|
[
|
||||||
'rel' => ActivityNamespace::WEBFINGERPROFILE,
|
'rel' => ActivityNamespace::WEBFINGERPROFILE,
|
||||||
'type' => 'text/html',
|
'type' => 'text/html',
|
||||||
|
@ -142,19 +145,6 @@ class Xrd extends BaseModule
|
||||||
'type' => 'application/activity+json',
|
'type' => 'application/activity+json',
|
||||||
'href' => $owner['url'],
|
'href' => $owner['url'],
|
||||||
],
|
],
|
||||||
[
|
|
||||||
'rel' => ActivityNamespace::OSTATUSSUB,
|
|
||||||
'template' => $baseURL . '/contact/follow?url={uri}',
|
|
||||||
],
|
|
||||||
[
|
|
||||||
'rel' => ActivityNamespace::FEED,
|
|
||||||
'type' => 'application/atom+xml',
|
|
||||||
'href' => $owner['poll'] ?? $baseURL,
|
|
||||||
],
|
|
||||||
[
|
|
||||||
'rel' => 'salmon',
|
|
||||||
'href' => $baseURL . '/salmon/' . $owner['nickname'],
|
|
||||||
],
|
|
||||||
[
|
[
|
||||||
'rel' => ActivityNamespace::HCARD,
|
'rel' => ActivityNamespace::HCARD,
|
||||||
'type' => 'text/html',
|
'type' => 'text/html',
|
||||||
|
@ -165,6 +155,14 @@ class Xrd extends BaseModule
|
||||||
'type' => 'text/html',
|
'type' => 'text/html',
|
||||||
'href' => $baseURL,
|
'href' => $baseURL,
|
||||||
],
|
],
|
||||||
|
[
|
||||||
|
'rel' => 'salmon',
|
||||||
|
'href' => $baseURL . '/receive/users/' . $owner['guid'],
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'rel' => ActivityNamespace::OSTATUSSUB,
|
||||||
|
'template' => $baseURL . '/contact/follow?url={uri}',
|
||||||
|
],
|
||||||
]
|
]
|
||||||
];
|
];
|
||||||
header('Access-Control-Allow-Origin: *');
|
header('Access-Control-Allow-Origin: *');
|
||||||
|
@ -218,24 +216,12 @@ class Xrd extends BaseModule
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
'rel' => 'salmon',
|
'rel' => 'salmon',
|
||||||
'href' => $baseURL . '/salmon/' . $owner['nickname'],
|
'href' => $baseURL . '/receive/users/' . $owner['guid'],
|
||||||
],
|
|
||||||
[
|
|
||||||
'rel' => 'http://salmon-protocol.org/ns/salmon-replies',
|
|
||||||
'href' => $baseURL . '/salmon/' . $owner['nickname'],
|
|
||||||
],
|
|
||||||
[
|
|
||||||
'rel' => 'http://salmon-protocol.org/ns/salmon-mention',
|
|
||||||
'href' => $baseURL . '/salmon/' . $owner['nickname'] . '/mention',
|
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
'rel' => ActivityNamespace::OSTATUSSUB,
|
'rel' => ActivityNamespace::OSTATUSSUB,
|
||||||
'template' => $baseURL . '/contact/follow?url={uri}',
|
'template' => $baseURL . '/contact/follow?url={uri}',
|
||||||
],
|
],
|
||||||
[
|
|
||||||
'rel' => 'magic-public-key',
|
|
||||||
'href' => 'data:application/magic-public-key,' . Salmon::salmonKey($owner['spubkey']),
|
|
||||||
],
|
|
||||||
[
|
[
|
||||||
'rel' => ActivityNamespace::OPENWEBAUTH,
|
'rel' => ActivityNamespace::OPENWEBAUTH,
|
||||||
'type' => 'application/x-zot+json',
|
'type' => 'application/x-zot+json',
|
||||||
|
@ -262,13 +248,13 @@ class Xrd extends BaseModule
|
||||||
'2:Alias' => $alias,
|
'2:Alias' => $alias,
|
||||||
'1:link' => [
|
'1:link' => [
|
||||||
'@attributes' => [
|
'@attributes' => [
|
||||||
'rel' => 'http://purl.org/macgirvin/dfrn/1.0',
|
'rel' => ActivityNamespace::DFRN,
|
||||||
'href' => $owner['url']
|
'href' => $owner['url']
|
||||||
]
|
]
|
||||||
],
|
],
|
||||||
'2:link' => [
|
'2:link' => [
|
||||||
'@attributes' => [
|
'@attributes' => [
|
||||||
'rel' => 'http://schemas.google.com/g/2010#updates-from',
|
'rel' => ActivityNamespace::FEED,
|
||||||
'type' => 'application/atom+xml',
|
'type' => 'application/atom+xml',
|
||||||
'href' => $owner['poll']
|
'href' => $owner['poll']
|
||||||
]
|
]
|
||||||
|
@ -311,34 +297,16 @@ class Xrd extends BaseModule
|
||||||
'8:link' => [
|
'8:link' => [
|
||||||
'@attributes' => [
|
'@attributes' => [
|
||||||
'rel' => 'salmon',
|
'rel' => 'salmon',
|
||||||
'href' => $baseURL . '/salmon/' . $owner['nickname']
|
'href' => $baseURL . '/receive/users/' . $owner['guid']
|
||||||
]
|
]
|
||||||
],
|
],
|
||||||
'9:link' => [
|
'9:link' => [
|
||||||
'@attributes' => [
|
|
||||||
'rel' => 'http://salmon-protocol.org/ns/salmon-replies',
|
|
||||||
'href' => $baseURL . '/salmon/' . $owner['nickname']
|
|
||||||
]
|
|
||||||
],
|
|
||||||
'10:link' => [
|
|
||||||
'@attributes' => [
|
|
||||||
'rel' => 'http://salmon-protocol.org/ns/salmon-mention',
|
|
||||||
'href' => $baseURL . '/salmon/' . $owner['nickname'] . '/mention'
|
|
||||||
]
|
|
||||||
],
|
|
||||||
'11:link' => [
|
|
||||||
'@attributes' => [
|
'@attributes' => [
|
||||||
'rel' => ActivityNamespace::OSTATUSSUB,
|
'rel' => ActivityNamespace::OSTATUSSUB,
|
||||||
'template' => $baseURL . '/contact/follow?url={uri}'
|
'template' => $baseURL . '/contact/follow?url={uri}'
|
||||||
]
|
]
|
||||||
],
|
],
|
||||||
'12:link' => [
|
'10:link' => [
|
||||||
'@attributes' => [
|
|
||||||
'rel' => 'magic-public-key',
|
|
||||||
'href' => 'data:application/magic-public-key,' . Salmon::salmonKey($owner['spubkey'])
|
|
||||||
]
|
|
||||||
],
|
|
||||||
'13:link' => [
|
|
||||||
'@attributes' => [
|
'@attributes' => [
|
||||||
'rel' => ActivityNamespace::OPENWEBAUTH,
|
'rel' => ActivityNamespace::OPENWEBAUTH,
|
||||||
'type' => 'application/x-zot+json',
|
'type' => 'application/x-zot+json',
|
||||||
|
|
|
@ -140,8 +140,8 @@ class Introduction extends BaseFactory
|
||||||
}
|
}
|
||||||
|
|
||||||
$formattedIntroductions[] = new ValueObject\Introduction([
|
$formattedIntroductions[] = new ValueObject\Introduction([
|
||||||
'label' => (($intro['network'] !== Protocol::OSTATUS) ? 'friend_request' : 'follower'),
|
'label' => 'friend_request',
|
||||||
'str_type' => (($intro['network'] !== Protocol::OSTATUS) ? $this->l10n->t('Friend/Connect Request') : $this->l10n->t('New Follower')),
|
'str_type' => $this->l10n->t('Friend/Connect Request'),
|
||||||
'dfrn_id' => $intro['issued-id'],
|
'dfrn_id' => $intro['issued-id'],
|
||||||
'uid' => $this->session->getLocalUserId(),
|
'uid' => $this->session->getLocalUserId(),
|
||||||
'intro_id' => $intro['intro_id'],
|
'intro_id' => $intro['intro_id'],
|
||||||
|
|
|
@ -24,7 +24,6 @@ class HttpClientRequest
|
||||||
public const MEDIAPROXY = 'MediaProxy/1';
|
public const MEDIAPROXY = 'MediaProxy/1';
|
||||||
public const MEDIAVERIFIER = 'MediaVerifier/1';
|
public const MEDIAVERIFIER = 'MediaVerifier/1';
|
||||||
public const OSTATUS = 'OStatus/1';
|
public const OSTATUS = 'OStatus/1';
|
||||||
public const SALMON = 'Salmon/1';
|
|
||||||
public const SERVERINFO = 'ServerInfo/1';
|
public const SERVERINFO = 'ServerInfo/1';
|
||||||
public const SERVERDISCOVER = 'ServerDiscover/1';
|
public const SERVERDISCOVER = 'ServerDiscover/1';
|
||||||
public const SITEINFO = 'SiteInfo/1';
|
public const SITEINFO = 'SiteInfo/1';
|
||||||
|
|
|
@ -869,20 +869,6 @@ class Probe
|
||||||
$data['baseurl'] = trim($link['href'], '/');
|
$data['baseurl'] = trim($link['href'], '/');
|
||||||
} elseif (($link['rel'] == 'http://webfinger.net/rel/blog') && !empty($link['href'])) {
|
} elseif (($link['rel'] == 'http://webfinger.net/rel/blog') && !empty($link['href'])) {
|
||||||
$data['url'] = $link['href'];
|
$data['url'] = $link['href'];
|
||||||
} elseif (($link['rel'] == 'magic-public-key') && !empty($link['href'])) {
|
|
||||||
$pubkey = $link['href'];
|
|
||||||
|
|
||||||
if (substr($pubkey, 0, 5) === 'data:') {
|
|
||||||
if (strstr($pubkey, ',')) {
|
|
||||||
$pubkey = substr($pubkey, strpos($pubkey, ',') + 1);
|
|
||||||
} else {
|
|
||||||
$pubkey = substr($pubkey, 5);
|
|
||||||
}
|
|
||||||
try {
|
|
||||||
$data['pubkey'] = Salmon::magicKeyToPem($pubkey);
|
|
||||||
} catch (\Throwable $e) {
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -98,8 +98,8 @@ class Post
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
// You can always comment on Diaspora and OStatus items
|
// You can always comment on Diaspora items
|
||||||
if (in_array($item['network'], [Protocol::OSTATUS, Protocol::DIASPORA]) && (DI::userSession()->getLocalUserId() == $item['uid'])) {
|
if (in_array($item['network'], [Protocol::DIASPORA]) && (DI::userSession()->getLocalUserId() == $item['uid'])) {
|
||||||
$item['writable'] = true;
|
$item['writable'] = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1285,8 +1285,6 @@ class Receiver
|
||||||
DBA::close($parents);
|
DBA::close($parents);
|
||||||
}
|
}
|
||||||
|
|
||||||
self::switchContacts($receivers, $actor);
|
|
||||||
|
|
||||||
// "birdsitelive" is a service that mirrors tweets into the fediverse
|
// "birdsitelive" is a service that mirrors tweets into the fediverse
|
||||||
// These posts can be fetched without authentication, but are not marked as public
|
// These posts can be fetched without authentication, but are not marked as public
|
||||||
// We treat them as unlisted posts to be able to handle them.
|
// We treat them as unlisted posts to be able to handle them.
|
||||||
|
@ -1369,62 +1367,6 @@ class Receiver
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Switches existing contacts to ActivityPub
|
|
||||||
*
|
|
||||||
* @param integer $cid Contact ID
|
|
||||||
* @param integer $uid User ID
|
|
||||||
* @param string $url Profile URL
|
|
||||||
* @return void
|
|
||||||
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
|
|
||||||
* @throws \ImagickException
|
|
||||||
*/
|
|
||||||
public static function switchContact(int $cid, int $uid, string $url)
|
|
||||||
{
|
|
||||||
if (DBA::exists('contact', ['id' => $cid, 'network' => Protocol::ACTIVITYPUB])) {
|
|
||||||
Logger::info('Contact is already ActivityPub', ['id' => $cid, 'uid' => $uid, 'url' => $url]);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (Contact::updateFromProbe($cid)) {
|
|
||||||
Logger::info('Update was successful', ['id' => $cid, 'uid' => $uid, 'url' => $url]);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Send a new follow request to be sure that the connection still exists
|
|
||||||
if (($uid != 0) && DBA::exists('contact', ['id' => $cid, 'rel' => [Contact::SHARING, Contact::FRIEND], 'network' => Protocol::ACTIVITYPUB])) {
|
|
||||||
Logger::info('Contact had been switched to ActivityPub. Sending a new follow request.', ['uid' => $uid, 'url' => $url]);
|
|
||||||
ActivityPub\Transmitter::sendActivity('Follow', $url, $uid);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @TODO Fix documentation and type-hints
|
|
||||||
*
|
|
||||||
* @param $receivers
|
|
||||||
* @param $actor
|
|
||||||
* @return void
|
|
||||||
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
|
|
||||||
* @throws \ImagickException
|
|
||||||
*/
|
|
||||||
private static function switchContacts($receivers, $actor)
|
|
||||||
{
|
|
||||||
if (empty($actor)) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
foreach ($receivers as $receiver) {
|
|
||||||
$contact = DBA::selectFirst('contact', ['id'], ['uid' => $receiver['uid'], 'network' => Protocol::OSTATUS, 'nurl' => Strings::normaliseLink($actor)]);
|
|
||||||
if (DBA::isResult($contact)) {
|
|
||||||
self::switchContact($contact['id'], $receiver['uid'], $actor);
|
|
||||||
}
|
|
||||||
|
|
||||||
$contact = DBA::selectFirst('contact', ['id'], ['uid' => $receiver['uid'], 'network' => Protocol::OSTATUS, 'alias' => [Strings::normaliseLink($actor), $actor]]);
|
|
||||||
if (DBA::isResult($contact)) {
|
|
||||||
self::switchContact($contact['id'], $receiver['uid'], $actor);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @TODO Fix documentation and type-hints
|
* @TODO Fix documentation and type-hints
|
||||||
*
|
*
|
||||||
|
|
|
@ -642,7 +642,7 @@ class Transmitter
|
||||||
$networks = Protocol::FEDERATED;
|
$networks = Protocol::FEDERATED;
|
||||||
} else {
|
} else {
|
||||||
// For now only send to these contacts:
|
// For now only send to these contacts:
|
||||||
$networks = [Protocol::ACTIVITYPUB, Protocol::OSTATUS];
|
$networks = [Protocol::ACTIVITYPUB];
|
||||||
}
|
}
|
||||||
|
|
||||||
$data = ['to' => [], 'cc' => [], 'bto' => [], 'bcc' => [], 'audience' => $audience];
|
$data = ['to' => [], 'cc' => [], 'bto' => [], 'bcc' => [], 'audience' => $audience];
|
||||||
|
@ -1019,7 +1019,7 @@ class Transmitter
|
||||||
$networks = Protocol::FEDERATED;
|
$networks = Protocol::FEDERATED;
|
||||||
} else {
|
} else {
|
||||||
// For now only send to these contacts:
|
// For now only send to these contacts:
|
||||||
$networks = [Protocol::ACTIVITYPUB, Protocol::OSTATUS];
|
$networks = [Protocol::ACTIVITYPUB];
|
||||||
}
|
}
|
||||||
|
|
||||||
$condition = [
|
$condition = [
|
||||||
|
|
|
@ -85,8 +85,7 @@ class DFRN
|
||||||
$user['uprvkey'] = $user['prvkey'];
|
$user['uprvkey'] = $user['prvkey'];
|
||||||
} else {
|
} else {
|
||||||
$user = ['importer_uid' => 0, 'uprvkey' => '', 'timezone' => 'UTC',
|
$user = ['importer_uid' => 0, 'uprvkey' => '', 'timezone' => 'UTC',
|
||||||
'nickname' => '', 'sprvkey' => '', 'spubkey' => '',
|
'nickname' => '', 'page-flags' => 0, 'account-type' => 0, 'prvnets' => 0];
|
||||||
'page-flags' => 0, 'account-type' => 0, 'prvnets' => 0];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return array_merge($contact, $user);
|
return array_merge($contact, $user);
|
||||||
|
@ -363,21 +362,6 @@ class DFRN
|
||||||
$attributes = ['rel' => 'alternate', 'type' => 'text/html', 'href' => $alternatelink];
|
$attributes = ['rel' => 'alternate', 'type' => 'text/html', 'href' => $alternatelink];
|
||||||
XML::addElement($doc, $root, 'link', '', $attributes);
|
XML::addElement($doc, $root, 'link', '', $attributes);
|
||||||
|
|
||||||
|
|
||||||
if ($public) {
|
|
||||||
// DFRN itself doesn't uses this. But maybe someone else wants to subscribe to the public feed.
|
|
||||||
OStatus::addHubLink($doc, $root, $owner['nick']);
|
|
||||||
|
|
||||||
$attributes = ['rel' => 'salmon', 'href' => DI::baseUrl() . '/salmon/' . $owner['nick']];
|
|
||||||
XML::addElement($doc, $root, 'link', '', $attributes);
|
|
||||||
|
|
||||||
$attributes = ['rel' => 'http://salmon-protocol.org/ns/salmon-replies', 'href' => DI::baseUrl() . '/salmon/' . $owner['nick']];
|
|
||||||
XML::addElement($doc, $root, 'link', '', $attributes);
|
|
||||||
|
|
||||||
$attributes = ['rel' => 'http://salmon-protocol.org/ns/salmon-mention', 'href' => DI::baseUrl() . '/salmon/' . $owner['nick']];
|
|
||||||
XML::addElement($doc, $root, 'link', '', $attributes);
|
|
||||||
}
|
|
||||||
|
|
||||||
// For backward compatibility we keep this element
|
// For backward compatibility we keep this element
|
||||||
if (in_array($owner['page-flags'], [User::PAGE_FLAGS_COMMUNITY, User::PAGE_FLAGS_COMM_MAN])) {
|
if (in_array($owner['page-flags'], [User::PAGE_FLAGS_COMMUNITY, User::PAGE_FLAGS_COMM_MAN])) {
|
||||||
XML::addElement($doc, $root, 'dfrn:community', 1);
|
XML::addElement($doc, $root, 'dfrn:community', 1);
|
||||||
|
|
|
@ -799,7 +799,7 @@ class Feed
|
||||||
$frequency = [];
|
$frequency = [];
|
||||||
$oldest = time();
|
$oldest = time();
|
||||||
$newest = 0;
|
$newest = 0;
|
||||||
$oldest_date = $newest_date = '';
|
$newest_date = '';
|
||||||
|
|
||||||
foreach ($creation_dates as $date) {
|
foreach ($creation_dates as $date) {
|
||||||
$timestamp = strtotime($date);
|
$timestamp = strtotime($date);
|
||||||
|
@ -822,7 +822,6 @@ class Feed
|
||||||
}
|
}
|
||||||
if ($oldest > $day) {
|
if ($oldest > $day) {
|
||||||
$oldest = $day;
|
$oldest = $day;
|
||||||
$oldest_date = $date;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($newest < $day) {
|
if ($newest < $day) {
|
||||||
|
@ -919,11 +918,6 @@ class Feed
|
||||||
$rating = 9;
|
$rating = 9;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Friendica and OStatus are checked once a day
|
|
||||||
if (in_array($contact['network'], [Protocol::DFRN, Protocol::OSTATUS])) {
|
|
||||||
$rating = 8;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Check archived contacts or contacts with unsupported protocols once a month
|
// Check archived contacts or contacts with unsupported protocols once a month
|
||||||
if ($contact['archive'] || in_array($contact['network'], [Protocol::ZOT, Protocol::PHANTOM])) {
|
if ($contact['archive'] || in_array($contact['network'], [Protocol::ZOT, Protocol::PHANTOM])) {
|
||||||
$rating = 10;
|
$rating = 10;
|
||||||
|
@ -1030,10 +1024,9 @@ class Feed
|
||||||
|
|
||||||
$condition = [
|
$condition = [
|
||||||
"`uid` = ? AND `received` > ? AND NOT `deleted` AND `gravity` IN (?, ?)
|
"`uid` = ? AND `received` > ? AND NOT `deleted` AND `gravity` IN (?, ?)
|
||||||
AND `private` != ? AND `visible` AND `wall` AND `parent-network` IN (?, ?, ?, ?)",
|
AND `private` != ? AND `visible` AND `wall` AND `parent-network` IN (?, ?, ?)",
|
||||||
$owner['uid'], $check_date, Item::GRAVITY_PARENT, Item::GRAVITY_COMMENT,
|
$owner['uid'], $check_date, Item::GRAVITY_PARENT, Item::GRAVITY_COMMENT,
|
||||||
Item::PRIVATE, Protocol::ACTIVITYPUB,
|
Item::PRIVATE, Protocol::ACTIVITYPUB, Protocol::DFRN, Protocol::DIASPORA
|
||||||
Protocol::OSTATUS, Protocol::DFRN, Protocol::DIASPORA
|
|
||||||
];
|
];
|
||||||
|
|
||||||
if ($filter === 'comments') {
|
if ($filter === 'comments') {
|
||||||
|
@ -1123,8 +1116,6 @@ class Feed
|
||||||
$attributes = ['href' => $owner['url'], 'rel' => 'alternate', 'type' => 'text/html'];
|
$attributes = ['href' => $owner['url'], 'rel' => 'alternate', 'type' => 'text/html'];
|
||||||
XML::addElement($doc, $root, 'link', '', $attributes);
|
XML::addElement($doc, $root, 'link', '', $attributes);
|
||||||
|
|
||||||
OStatus::addHubLink($doc, $root, $owner['nick']);
|
|
||||||
|
|
||||||
$attributes = ['href' => DI::baseUrl() . $selfUri, 'rel' => 'self', 'type' => 'application/atom+xml'];
|
$attributes = ['href' => DI::baseUrl() . $selfUri, 'rel' => 'self', 'type' => 'application/atom+xml'];
|
||||||
XML::addElement($doc, $root, 'link', '', $attributes);
|
XML::addElement($doc, $root, 'link', '', $attributes);
|
||||||
|
|
||||||
|
@ -1166,7 +1157,7 @@ class Feed
|
||||||
Logger::info('Feed entry author does not match feed owner', ['owner' => $owner['url'], 'author' => $item['author-link']]);
|
Logger::info('Feed entry author does not match feed owner', ['owner' => $owner['url'], 'author' => $item['author-link']]);
|
||||||
}
|
}
|
||||||
|
|
||||||
$entry = OStatus::entryHeader($doc, $owner, $item, false);
|
$entry = self::entryHeader($doc, $owner, $item, false);
|
||||||
|
|
||||||
self::entryContent($doc, $entry, $item, self::getTitle($item), '', true);
|
self::entryContent($doc, $entry, $item, self::getTitle($item), '', true);
|
||||||
|
|
||||||
|
@ -1191,7 +1182,7 @@ class Feed
|
||||||
private static function entryContent(DOMDocument $doc, DOMElement $entry, array $item, $title, string $verb = '', bool $complete = true)
|
private static function entryContent(DOMDocument $doc, DOMElement $entry, array $item, $title, string $verb = '', bool $complete = true)
|
||||||
{
|
{
|
||||||
if ($verb == '') {
|
if ($verb == '') {
|
||||||
$verb = OStatus::constructVerb($item);
|
$verb = self::constructVerb($item);
|
||||||
}
|
}
|
||||||
|
|
||||||
XML::addElement($doc, $entry, 'id', $item['uri']);
|
XML::addElement($doc, $entry, 'id', $item['uri']);
|
||||||
|
@ -1278,7 +1269,7 @@ class Feed
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
OStatus::getAttachment($doc, $entry, $item);
|
self::getAttachment($doc, $entry, $item);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1346,4 +1337,89 @@ class Feed
|
||||||
}
|
}
|
||||||
return $replace;
|
return $replace;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Adds attachment data to the XML document
|
||||||
|
*
|
||||||
|
* @param DOMDocument $doc XML document
|
||||||
|
* @param DOMElement $root XML root element where the hub links are added
|
||||||
|
* @param array $item Data of the item that is to be posted
|
||||||
|
* @return void
|
||||||
|
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
|
||||||
|
*/
|
||||||
|
private static function getAttachment(DOMDocument $doc, DOMElement $root, array $item)
|
||||||
|
{
|
||||||
|
foreach (Post\Media::getByURIId($item['uri-id'], [Post\Media::AUDIO, Post\Media::IMAGE, Post\Media::VIDEO, Post\Media::DOCUMENT, Post\Media::TORRENT]) as $attachment) {
|
||||||
|
$attributes = ['rel' => 'enclosure',
|
||||||
|
'href' => $attachment['url'],
|
||||||
|
'type' => $attachment['mimetype']];
|
||||||
|
|
||||||
|
if (!empty($attachment['size'])) {
|
||||||
|
$attributes['length'] = intval($attachment['size']);
|
||||||
|
}
|
||||||
|
if (!empty($attachment['description'])) {
|
||||||
|
$attributes['title'] = $attachment['description'];
|
||||||
|
}
|
||||||
|
|
||||||
|
XML::addElement($doc, $root, 'link', '', $attributes);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @TODO Picture attachments should look like this:
|
||||||
|
* <a href="https://status.pirati.ca/attachment/572819" title="https://status.pirati.ca/file/heluecht-20151202T222602-rd3u49p.gif"
|
||||||
|
* class="attachment thumbnail" id="attachment-572819" rel="nofollow external">https://status.pirati.ca/attachment/572819</a>
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the given activity if present - otherwise returns the "post" activity
|
||||||
|
*
|
||||||
|
* @param array $item Data of the item that is to be posted
|
||||||
|
* @return string activity
|
||||||
|
*/
|
||||||
|
private static function constructVerb(array $item): string
|
||||||
|
{
|
||||||
|
if (!empty($item['verb'])) {
|
||||||
|
return $item['verb'];
|
||||||
|
}
|
||||||
|
|
||||||
|
return Activity::POST;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Adds a header element to the XML document
|
||||||
|
*
|
||||||
|
* @param DOMDocument $doc XML document
|
||||||
|
* @param array $owner Contact data of the poster
|
||||||
|
* @param array $item
|
||||||
|
* @param bool $toplevel Is it for en entry element (false) or a feed entry (true)?
|
||||||
|
* @return DOMElement The entry element where the elements are added
|
||||||
|
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
|
||||||
|
* @throws \ImagickException
|
||||||
|
*/
|
||||||
|
private static function entryHeader(DOMDocument $doc, array $owner, array $item, bool $toplevel): DOMElement
|
||||||
|
{
|
||||||
|
if (!$toplevel) {
|
||||||
|
$entry = $doc->createElement('entry');
|
||||||
|
|
||||||
|
if ($owner['contact-type'] == Contact::TYPE_COMMUNITY) {
|
||||||
|
$entry->setAttribute('xmlns:activity', ActivityNamespace::ACTIVITY);
|
||||||
|
|
||||||
|
$contact = Contact::getByURL($item['author-link']) ?: $owner;
|
||||||
|
$contact['nickname'] = $contact['nickname'] ?? $contact['nick'];
|
||||||
|
$author = self::addAuthor($doc, $contact, false);
|
||||||
|
$entry->appendChild($author);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$entry = $doc->createElementNS(ActivityNamespace::ATOM1, 'entry');
|
||||||
|
|
||||||
|
$entry->setAttribute('xmlns:thr', ActivityNamespace::THREAD);
|
||||||
|
$entry->setAttribute('xmlns:poco', ActivityNamespace::POCO);
|
||||||
|
|
||||||
|
$author = self::addAuthor($doc, $owner);
|
||||||
|
$entry->appendChild($author);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $entry;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -7,17 +7,7 @@
|
||||||
|
|
||||||
namespace Friendica\Protocol;
|
namespace Friendica\Protocol;
|
||||||
|
|
||||||
use Friendica\Core\Logger;
|
|
||||||
use Friendica\Core\Protocol;
|
|
||||||
use Friendica\DI;
|
|
||||||
use Friendica\Model\Item;
|
|
||||||
use Friendica\Network\HTTPClient\Client\HttpClientAccept;
|
|
||||||
use Friendica\Network\HTTPClient\Client\HttpClientRequest;
|
|
||||||
use Friendica\Network\Probe;
|
|
||||||
use Friendica\Protocol\Salmon\Format\Magic;
|
use Friendica\Protocol\Salmon\Format\Magic;
|
||||||
use Friendica\Util\Crypto;
|
|
||||||
use Friendica\Util\Strings;
|
|
||||||
use Friendica\Util\XML;
|
|
||||||
use phpseclib3\Crypt\PublicKeyLoader;
|
use phpseclib3\Crypt\PublicKeyLoader;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -28,206 +18,6 @@ use phpseclib3\Crypt\PublicKeyLoader;
|
||||||
*/
|
*/
|
||||||
class Salmon
|
class Salmon
|
||||||
{
|
{
|
||||||
/**
|
|
||||||
* @param string $uri Uniform Resource Identifier
|
|
||||||
* @param string $keyhash encoded key
|
|
||||||
* @return string Key or empty string on any errors
|
|
||||||
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
|
|
||||||
*/
|
|
||||||
public static function getKey(string $uri, string $keyhash): string
|
|
||||||
{
|
|
||||||
$ret = [];
|
|
||||||
|
|
||||||
Logger::info('Fetching salmon key for ' . $uri);
|
|
||||||
|
|
||||||
$arr = Probe::lrdd($uri);
|
|
||||||
|
|
||||||
if (is_array($arr)) {
|
|
||||||
foreach ($arr as $a) {
|
|
||||||
if ($a['@attributes']['rel'] === 'magic-public-key') {
|
|
||||||
$ret[] = $a['@attributes']['href'];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
return '';
|
|
||||||
}
|
|
||||||
|
|
||||||
// We have found at least one key URL
|
|
||||||
// If it's inline, parse it - otherwise get the key
|
|
||||||
|
|
||||||
if (count($ret) > 0) {
|
|
||||||
for ($x = 0; $x < count($ret); $x++) {
|
|
||||||
if (substr($ret[$x], 0, 5) === 'data:') {
|
|
||||||
if (strstr($ret[$x], ',')) {
|
|
||||||
$ret[$x] = substr($ret[$x], strpos($ret[$x], ',') + 1);
|
|
||||||
} else {
|
|
||||||
$ret[$x] = substr($ret[$x], 5);
|
|
||||||
}
|
|
||||||
} elseif (Strings::normaliseLink($ret[$x]) == 'http://') {
|
|
||||||
$ret[$x] = DI::httpClient()->fetch($ret[$x], HttpClientAccept::MAGIC_KEY, 0, '', HttpClientRequest::SALMON);
|
|
||||||
Logger::debug('Fetched public key', ['url' => $ret[$x]]);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
Logger::notice('Key located', ['ret' => $ret]);
|
|
||||||
|
|
||||||
if (count($ret) == 1) {
|
|
||||||
/* We only found one key so we don't care if the hash matches.
|
|
||||||
* If it's the wrong key we'll find out soon enough because
|
|
||||||
* message verification will fail. This also covers some older
|
|
||||||
* software which don't supply a keyhash. As long as they only
|
|
||||||
* have one key we'll be right.
|
|
||||||
*/
|
|
||||||
return (string) $ret[0];
|
|
||||||
} else {
|
|
||||||
foreach ($ret as $a) {
|
|
||||||
$hash = Strings::base64UrlEncode(hash('sha256', $a));
|
|
||||||
if ($hash == $keyhash) {
|
|
||||||
return $a;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return '';
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param array $owner owner
|
|
||||||
* @param string $url url
|
|
||||||
* @param string $slap slap
|
|
||||||
* @return integer
|
|
||||||
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
|
|
||||||
*/
|
|
||||||
public static function slapper(array $owner, string $url, string $slap): int
|
|
||||||
{
|
|
||||||
// does contact have a salmon endpoint?
|
|
||||||
|
|
||||||
if (!strlen($url)) {
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!$owner['sprvkey']) {
|
|
||||||
Logger::notice(sprintf(
|
|
||||||
"user '%s' (%d) does not have a salmon private key. Send failed.",
|
|
||||||
$owner['name'],
|
|
||||||
$owner['uid']
|
|
||||||
));
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
Logger::info('slapper called for ' . $url . '. Data: ' . $slap);
|
|
||||||
|
|
||||||
// create a magic envelope
|
|
||||||
|
|
||||||
$data = Strings::base64UrlEncode($slap);
|
|
||||||
$data_type = 'application/atom+xml';
|
|
||||||
$encoding = 'base64url';
|
|
||||||
$algorithm = 'RSA-SHA256';
|
|
||||||
$keyhash = Strings::base64UrlEncode(hash('sha256', self::salmonKey($owner['spubkey'])), true);
|
|
||||||
|
|
||||||
$precomputed = '.' . Strings::base64UrlEncode($data_type) . '.' . Strings::base64UrlEncode($encoding) . '.' . Strings::base64UrlEncode($algorithm);
|
|
||||||
|
|
||||||
// GNU Social format
|
|
||||||
$signature = Strings::base64UrlEncode(Crypto::rsaSign($data . $precomputed, $owner['sprvkey']));
|
|
||||||
|
|
||||||
// Compliant format
|
|
||||||
$signature2 = Strings::base64UrlEncode(Crypto::rsaSign(str_replace('=', '', $data . $precomputed), $owner['sprvkey']));
|
|
||||||
|
|
||||||
// Old Status.net format
|
|
||||||
$signature3 = Strings::base64UrlEncode(Crypto::rsaSign($data, $owner['sprvkey']));
|
|
||||||
|
|
||||||
// At first try the non compliant method that works for GNU Social
|
|
||||||
$xmldata = [
|
|
||||||
'me:env' => [
|
|
||||||
'me:data' => $data,
|
|
||||||
'@attributes' => ['type' => $data_type],
|
|
||||||
'me:encoding' => $encoding,
|
|
||||||
'me:alg' => $algorithm,
|
|
||||||
'me:sig' => $signature,
|
|
||||||
'@attributes2' => ['key_id' => $keyhash],
|
|
||||||
]
|
|
||||||
];
|
|
||||||
|
|
||||||
$namespaces = ['me' => ActivityNamespace::SALMON_ME];
|
|
||||||
|
|
||||||
$salmon = XML::fromArray($xmldata, $dummy, false, $namespaces);
|
|
||||||
|
|
||||||
// slap them
|
|
||||||
$postResult = DI::httpClient()->post($url, $salmon, [
|
|
||||||
'Content-type' => 'application/magic-envelope+xml',
|
|
||||||
'Content-length' => strlen($salmon),
|
|
||||||
], 0, HttpClientRequest::SALMON);
|
|
||||||
|
|
||||||
$return_code = $postResult->getReturnCode();
|
|
||||||
|
|
||||||
// check for success, e.g. 2xx
|
|
||||||
|
|
||||||
if ($return_code > 299) {
|
|
||||||
Logger::notice('GNU Social salmon failed. Falling back to compliant mode');
|
|
||||||
|
|
||||||
// Now try the compliant mode that normally isn't used for GNU Social
|
|
||||||
$xmldata = [
|
|
||||||
'me:env' => [
|
|
||||||
'me:data' => $data,
|
|
||||||
'@attributes' => ['type' => $data_type],
|
|
||||||
'me:encoding' => $encoding,
|
|
||||||
'me:alg' => $algorithm,
|
|
||||||
'me:sig' => $signature2,
|
|
||||||
'@attributes2' => ['key_id' => $keyhash]
|
|
||||||
]
|
|
||||||
];
|
|
||||||
|
|
||||||
$salmon = XML::fromArray($xmldata, $dummy, false, $namespaces);
|
|
||||||
|
|
||||||
// slap them
|
|
||||||
$postResult = DI::httpClient()->post($url, $salmon, [
|
|
||||||
'Content-type' => 'application/magic-envelope+xml',
|
|
||||||
'Content-length' => strlen($salmon),
|
|
||||||
], 0, HttpClientRequest::SALMON);
|
|
||||||
$return_code = $postResult->getReturnCode();
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($return_code > 299) {
|
|
||||||
Logger::notice('compliant salmon failed. Falling back to old status.net');
|
|
||||||
|
|
||||||
// Last try. This will most likely fail as well.
|
|
||||||
$xmldata = [
|
|
||||||
'me:env' => [
|
|
||||||
'me:data' => $data,
|
|
||||||
'@attributes' => ['type' => $data_type],
|
|
||||||
'me:encoding' => $encoding,
|
|
||||||
'me:alg' => $algorithm,
|
|
||||||
'me:sig' => $signature3,
|
|
||||||
'@attributes2' => ['key_id' => $keyhash],
|
|
||||||
]
|
|
||||||
];
|
|
||||||
|
|
||||||
$salmon = XML::fromArray($xmldata, $dummy, false, $namespaces);
|
|
||||||
|
|
||||||
// slap them
|
|
||||||
$postResult = DI::httpClient()->post($url, $salmon, [
|
|
||||||
'Content-type' => 'application/magic-envelope+xml',
|
|
||||||
'Content-length' => strlen($salmon)
|
|
||||||
], 0, HttpClientRequest::SALMON);
|
|
||||||
$return_code = $postResult->getReturnCode();
|
|
||||||
}
|
|
||||||
|
|
||||||
Item::incrementOutbound(Protocol::OSTATUS);
|
|
||||||
Logger::info('slapper for ' . $url . ' returned ' . $return_code);
|
|
||||||
|
|
||||||
if (!$return_code) {
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (($return_code == 503) && $postResult->inHeader('retry-after')) {
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
return (($return_code >= 200) && ($return_code < 300)) ? 0 : 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param string $pubkey public key
|
* @param string $pubkey public key
|
||||||
* @return string
|
* @return string
|
||||||
|
|
|
@ -71,7 +71,7 @@ class MergeContact
|
||||||
*/
|
*/
|
||||||
private static function mergePersonalContacts(int $first, int $duplicate)
|
private static function mergePersonalContacts(int $first, int $duplicate)
|
||||||
{
|
{
|
||||||
$fields = ['self', 'remote_self', 'rel', 'prvkey', 'subhub', 'hub-verify', 'priority', 'writable', 'archive', 'pending',
|
$fields = ['self', 'remote_self', 'rel', 'prvkey', 'hub-verify', 'priority', 'writable', 'archive', 'pending',
|
||||||
'rating', 'notify_new_posts', 'fetch_further_information', 'ffi_keyword_denylist', 'block_reason'];
|
'rating', 'notify_new_posts', 'fetch_further_information', 'ffi_keyword_denylist', 'block_reason'];
|
||||||
$c1 = Contact::getById($first, $fields);
|
$c1 = Contact::getById($first, $fields);
|
||||||
$c2 = Contact::getById($duplicate, $fields);
|
$c2 = Contact::getById($duplicate, $fields);
|
||||||
|
@ -87,7 +87,7 @@ class MergeContact
|
||||||
$ctarget[$field] = $c1[$field] ?: $c2[$field];
|
$ctarget[$field] = $c1[$field] ?: $c2[$field];
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach (['remote_self', 'subhub', 'writable', 'notify_new_posts'] as $field) {
|
foreach (['remote_self', 'writable', 'notify_new_posts'] as $field) {
|
||||||
$ctarget[$field] = $c1[$field] || $c2[$field];
|
$ctarget[$field] = $c1[$field] || $c2[$field];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -19,17 +19,13 @@ use Friendica\Model\Circle;
|
||||||
use Friendica\Model\GServer;
|
use Friendica\Model\GServer;
|
||||||
use Friendica\Model\Item;
|
use Friendica\Model\Item;
|
||||||
use Friendica\Model\Post;
|
use Friendica\Model\Post;
|
||||||
use Friendica\Model\PushSubscriber;
|
|
||||||
use Friendica\Model\Tag;
|
use Friendica\Model\Tag;
|
||||||
use Friendica\Model\User;
|
use Friendica\Model\User;
|
||||||
use Friendica\Protocol\Activity;
|
use Friendica\Protocol\Activity;
|
||||||
use Friendica\Protocol\ActivityPub;
|
use Friendica\Protocol\ActivityPub;
|
||||||
use Friendica\Protocol\Diaspora;
|
use Friendica\Protocol\Diaspora;
|
||||||
use Friendica\Protocol\Delivery;
|
use Friendica\Protocol\Delivery;
|
||||||
use Friendica\Protocol\OStatus;
|
|
||||||
use Friendica\Protocol\Salmon;
|
|
||||||
use Friendica\Util\LDSignature;
|
use Friendica\Util\LDSignature;
|
||||||
use Friendica\Util\Network;
|
|
||||||
use Friendica\Util\Strings;
|
use Friendica\Util\Strings;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -52,7 +48,6 @@ class Notifier
|
||||||
$target_id = $post_uriid;
|
$target_id = $post_uriid;
|
||||||
$top_level = false;
|
$top_level = false;
|
||||||
$recipients = [];
|
$recipients = [];
|
||||||
$url_recipients = [];
|
|
||||||
|
|
||||||
$delivery_contacts_stmt = null;
|
$delivery_contacts_stmt = null;
|
||||||
$target_item = [];
|
$target_item = [];
|
||||||
|
@ -149,12 +144,6 @@ class Notifier
|
||||||
|
|
||||||
$unlisted = false;
|
$unlisted = false;
|
||||||
|
|
||||||
// Do a PuSH
|
|
||||||
$push_notify = false;
|
|
||||||
|
|
||||||
// Deliver directly to a group, don't PuSH
|
|
||||||
$direct_group_delivery = false;
|
|
||||||
|
|
||||||
$only_ap_delivery = false;
|
$only_ap_delivery = false;
|
||||||
|
|
||||||
$followup = false;
|
$followup = false;
|
||||||
|
@ -268,32 +257,6 @@ class Notifier
|
||||||
$recipients_followup = [$parent['contact-id']];
|
$recipients_followup = [$parent['contact-id']];
|
||||||
|
|
||||||
Logger::info('Followup', ['target' => $target_id, 'guid' => $target_item['guid'], 'to' => $parent['contact-id']]);
|
Logger::info('Followup', ['target' => $target_id, 'guid' => $target_item['guid'], 'to' => $parent['contact-id']]);
|
||||||
|
|
||||||
if (($target_item['private'] != Item::PRIVATE) &&
|
|
||||||
(strlen($target_item['allow_cid'].$target_item['allow_gid'].
|
|
||||||
$target_item['deny_cid'].$target_item['deny_gid']) == 0))
|
|
||||||
$push_notify = true;
|
|
||||||
|
|
||||||
if (($thr_parent && ($thr_parent['network'] == Protocol::OSTATUS)) || ($parent['network'] == Protocol::OSTATUS)) {
|
|
||||||
$push_notify = true;
|
|
||||||
|
|
||||||
if ($parent["network"] == Protocol::OSTATUS) {
|
|
||||||
// Distribute the message to the DFRN contacts as if this wasn't a followup since OStatus can't relay comments
|
|
||||||
// Currently it is work at progress
|
|
||||||
$condition = ['uid' => $uid, 'network' => Protocol::DFRN, 'blocked' => false, 'pending' => false, 'archive' => false];
|
|
||||||
$followup_contacts_stmt = DBA::select('contact', ['id'], $condition);
|
|
||||||
while($followup_contact = DBA::fetch($followup_contacts_stmt)) {
|
|
||||||
$recipients_followup[] = $followup_contact['id'];
|
|
||||||
}
|
|
||||||
DBA::close($followup_contacts_stmt);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($direct_group_delivery) {
|
|
||||||
$push_notify = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
Logger::info('Notify ' . $target_item["guid"] .' via PuSH: ' . ($push_notify ? "Yes":"No"));
|
|
||||||
} elseif ($exclusive_delivery) {
|
} elseif ($exclusive_delivery) {
|
||||||
$followup = true;
|
$followup = true;
|
||||||
|
|
||||||
|
@ -338,17 +301,11 @@ class Notifier
|
||||||
foreach ($people as $person) {
|
foreach ($people as $person) {
|
||||||
if (substr($person,0,4) === 'cid:') {
|
if (substr($person,0,4) === 'cid:') {
|
||||||
$recipients[] = intval(substr($person,4));
|
$recipients[] = intval(substr($person,4));
|
||||||
} else {
|
|
||||||
$url_recipients[] = substr($person,4);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (count($url_recipients)) {
|
|
||||||
Logger::notice('Deliver', ['target' => $target_id, 'guid' => $target_item['guid'], 'recipients' => $url_recipients]);
|
|
||||||
}
|
|
||||||
|
|
||||||
$recipients = array_unique(array_merge($recipients, $allow_people, $allow_circles));
|
$recipients = array_unique(array_merge($recipients, $allow_people, $allow_circles));
|
||||||
$deny = array_unique(array_merge($deny_people, $deny_circles));
|
$deny = array_unique(array_merge($deny_people, $deny_circles));
|
||||||
$recipients = array_diff($recipients, $deny);
|
$recipients = array_diff($recipients, $deny);
|
||||||
|
@ -368,39 +325,7 @@ class Notifier
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// If the thread parent is OStatus then do some magic to distribute the messages.
|
if ($diaspora_delivery) {
|
||||||
// We have not only to look at the parent, since it could be a Friendica thread.
|
|
||||||
if (($thr_parent && ($thr_parent['network'] == Protocol::OSTATUS)) || ($parent['network'] == Protocol::OSTATUS)) {
|
|
||||||
$diaspora_delivery = false;
|
|
||||||
|
|
||||||
Logger::info('Some parent is OStatus for ' . $target_item['guid'] . ' - Author: ' . $thr_parent['author-id'] . ' - Owner: ' . $thr_parent['owner-id']);
|
|
||||||
|
|
||||||
// Send a salmon to the parent author
|
|
||||||
$probed_contact = DBA::selectFirst('contact', ['url', 'notify'], ['id' => $thr_parent['author-id']]);
|
|
||||||
if (DBA::isResult($probed_contact) && !empty($probed_contact['notify'])) {
|
|
||||||
Logger::notice('Notify parent author', ['url' => $probed_contact['url'], 'notify' => $probed_contact['notify']]);
|
|
||||||
$url_recipients[$probed_contact['notify']] = $probed_contact['notify'];
|
|
||||||
}
|
|
||||||
|
|
||||||
// Send a salmon to the parent owner
|
|
||||||
$probed_contact = DBA::selectFirst('contact', ['url', 'notify'], ['id' => $thr_parent['owner-id']]);
|
|
||||||
if (DBA::isResult($probed_contact) && !empty($probed_contact['notify'])) {
|
|
||||||
Logger::notice('Notify parent owner', ['url' => $probed_contact['url'], 'notify' => $probed_contact['notify']]);
|
|
||||||
$url_recipients[$probed_contact['notify']] = $probed_contact['notify'];
|
|
||||||
}
|
|
||||||
|
|
||||||
// Send a salmon notification to every person we mentioned in the post
|
|
||||||
foreach (Tag::getByURIId($target_item['uri-id'], [Tag::MENTION, Tag::EXCLUSIVE_MENTION, Tag::IMPLICIT_MENTION]) as $tag) {
|
|
||||||
$probed_contact = Contact::getByURL($tag['url']);
|
|
||||||
if (!empty($probed_contact['notify'])) {
|
|
||||||
Logger::notice('Notify mentioned user', ['url' => $probed_contact['url'], 'notify' => $probed_contact['notify']]);
|
|
||||||
$url_recipients[$probed_contact['notify']] = $probed_contact['notify'];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// It only makes sense to distribute answers to OStatus messages to Friendica and OStatus - but not Diaspora
|
|
||||||
$networks = [Protocol::DFRN];
|
|
||||||
} elseif ($diaspora_delivery) {
|
|
||||||
$networks = [Protocol::DFRN, Protocol::DIASPORA, Protocol::MAIL];
|
$networks = [Protocol::DFRN, Protocol::DIASPORA, Protocol::MAIL];
|
||||||
if (($parent['network'] == Protocol::DIASPORA) || ($thr_parent['network'] == Protocol::DIASPORA)) {
|
if (($parent['network'] == Protocol::DIASPORA) || ($thr_parent['network'] == Protocol::DIASPORA)) {
|
||||||
Logger::info('Add AP contacts', ['target' => $target_id, 'guid' => $target_item['guid']]);
|
Logger::info('Add AP contacts', ['target' => $target_id, 'guid' => $target_item['guid']]);
|
||||||
|
@ -453,15 +378,11 @@ class Notifier
|
||||||
$conversants = array_merge($contacts, $participants);
|
$conversants = array_merge($contacts, $participants);
|
||||||
|
|
||||||
$delivery_queue_count += self::delivery($cmd, $post_uriid, $sender_uid, $target_item, $thr_parent, $owner, $batch_delivery, true, $conversants, $ap_contacts, []);
|
$delivery_queue_count += self::delivery($cmd, $post_uriid, $sender_uid, $target_item, $thr_parent, $owner, $batch_delivery, true, $conversants, $ap_contacts, []);
|
||||||
|
|
||||||
$push_notify = true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$contacts = DBA::toArray($delivery_contacts_stmt);
|
$contacts = DBA::toArray($delivery_contacts_stmt);
|
||||||
$delivery_queue_count += self::delivery($cmd, $post_uriid, $sender_uid, $target_item, $thr_parent, $owner, $batch_delivery, false, $contacts, $ap_contacts, $conversants);
|
$delivery_queue_count += self::delivery($cmd, $post_uriid, $sender_uid, $target_item, $thr_parent, $owner, $batch_delivery, false, $contacts, $ap_contacts, $conversants);
|
||||||
|
|
||||||
$delivery_queue_count += self::deliverOStatus($target_id, $target_item, $owner, $url_recipients, $public_message, $push_notify);
|
|
||||||
|
|
||||||
if (!empty($target_item)) {
|
if (!empty($target_item)) {
|
||||||
Logger::info('Calling hooks for ' . $cmd . ' ' . $target_id);
|
Logger::info('Calling hooks for ' . $cmd . ' ' . $target_id);
|
||||||
|
|
||||||
|
@ -612,50 +533,6 @@ class Notifier
|
||||||
return $delivery_queue_count;
|
return $delivery_queue_count;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Deliver the message via OStatus
|
|
||||||
*
|
|
||||||
* @param int $target_id
|
|
||||||
* @param array $target_item
|
|
||||||
* @param array $owner
|
|
||||||
* @param array $url_recipients
|
|
||||||
* @param bool $public_message
|
|
||||||
* @param bool $push_notify
|
|
||||||
*
|
|
||||||
* @return int Count of sent Salmon notifications
|
|
||||||
* @throws InternalServerErrorException
|
|
||||||
* @throws Exception
|
|
||||||
*/
|
|
||||||
private static function deliverOStatus(int $target_id, array $target_item, array $owner, array $url_recipients, bool $public_message, bool $push_notify): int
|
|
||||||
{
|
|
||||||
$a = DI::app();
|
|
||||||
$delivery_queue_count = 0;
|
|
||||||
|
|
||||||
$url_recipients = array_filter($url_recipients);
|
|
||||||
// send salmon slaps to mentioned remote tags (@foo@example.com) in OStatus posts
|
|
||||||
// They are especially used for notifications to OStatus users that don't follow us.
|
|
||||||
if (count($url_recipients) && ($public_message || $push_notify) && !empty($target_item)) {
|
|
||||||
$slap = OStatus::salmon($target_item, $owner);
|
|
||||||
foreach ($url_recipients as $url) {
|
|
||||||
Logger::info('Salmon delivery', ['item' => $target_id, 'to' => $url]);
|
|
||||||
|
|
||||||
$delivery_queue_count++;
|
|
||||||
Salmon::slapper($owner, $url, $slap);
|
|
||||||
Item::incrementOutbound(Protocol::OSTATUS);
|
|
||||||
Post\DeliveryData::incrementQueueDone($target_item['uri-id'], Post\DeliveryData::OSTATUS);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Notify PuSH subscribers (Used for OStatus distribution of regular posts)
|
|
||||||
if ($push_notify) {
|
|
||||||
Logger::info('Activating internal PuSH', ['uid' => $owner['uid']]);
|
|
||||||
|
|
||||||
// Handling the pubsubhubbub requests
|
|
||||||
PushSubscriber::publishFeed($owner['uid'], $a->getQueueValue('priority'));
|
|
||||||
}
|
|
||||||
return $delivery_queue_count;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Checks if the current delivery shouldn't be transported to Diaspora.
|
* Checks if the current delivery shouldn't be transported to Diaspora.
|
||||||
* This is done for posts from AP authors or posts that are comments to AP authors.
|
* This is done for posts from AP authors or posts that are comments to AP authors.
|
||||||
|
|
|
@ -59,15 +59,10 @@ class OnePoll
|
||||||
|
|
||||||
$updated = DateTimeFormat::utcNow();
|
$updated = DateTimeFormat::utcNow();
|
||||||
|
|
||||||
// Possibly switch the remote contact to AP
|
|
||||||
if ($success && ($contact['network'] === Protocol::OSTATUS)) {
|
|
||||||
ActivityPub\Receiver::switchContact($contact['id'], $importer_uid, $contact['url']);
|
|
||||||
}
|
|
||||||
|
|
||||||
$contact = DBA::selectFirst('contact', [], ['id' => $contact_id]);
|
$contact = DBA::selectFirst('contact', [], ['id' => $contact_id]);
|
||||||
|
|
||||||
if ($success && ($importer_uid != 0) && in_array($contact['rel'], [Contact::SHARING, Contact::FRIEND])
|
if ($success && ($importer_uid != 0) && in_array($contact['rel'], [Contact::SHARING, Contact::FRIEND])
|
||||||
&& in_array($contact['network'], [Protocol::FEED, Protocol::MAIL, Protocol::OSTATUS])) {
|
&& in_array($contact['network'], [Protocol::FEED, Protocol::MAIL])) {
|
||||||
$importer = User::getOwnerDataById($importer_uid);
|
$importer = User::getOwnerDataById($importer_uid);
|
||||||
if (empty($importer)) {
|
if (empty($importer)) {
|
||||||
Logger::warning('No self contact for user', ['uid' => $importer_uid]);
|
Logger::warning('No self contact for user', ['uid' => $importer_uid]);
|
||||||
|
@ -113,7 +108,7 @@ class OnePoll
|
||||||
*/
|
*/
|
||||||
private static function updateContact(array $contact, array $fields)
|
private static function updateContact(array $contact, array $fields)
|
||||||
{
|
{
|
||||||
if (in_array($contact['network'], [Protocol::FEED, Protocol::MAIL, Protocol::OSTATUS])) {
|
if (in_array($contact['network'], [Protocol::FEED, Protocol::MAIL])) {
|
||||||
// Update the user's contact
|
// Update the user's contact
|
||||||
Contact::update($fields, ['id' => $contact['id']]);
|
Contact::update($fields, ['id' => $contact['id']]);
|
||||||
|
|
||||||
|
|
|
@ -27,7 +27,7 @@ class PollContacts
|
||||||
$abandon_days = 0;
|
$abandon_days = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
$condition = ['network' => [Protocol::FEED, Protocol::MAIL, Protocol::OSTATUS], 'self' => false, 'blocked' => false, 'archive' => false];
|
$condition = ['network' => [Protocol::FEED, Protocol::MAIL], 'self' => false, 'blocked' => false, 'archive' => false];
|
||||||
|
|
||||||
if (!empty($abandon_days)) {
|
if (!empty($abandon_days)) {
|
||||||
$condition = DBA::mergeConditions($condition,
|
$condition = DBA::mergeConditions($condition,
|
||||||
|
|
|
@ -1,86 +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\Worker;
|
|
||||||
|
|
||||||
use Friendica\Core\Logger;
|
|
||||||
use Friendica\Database\DBA;
|
|
||||||
use Friendica\DI;
|
|
||||||
use Friendica\Model\PushSubscriber;
|
|
||||||
use Friendica\Network\HTTPClient\Client\HttpClientRequest;
|
|
||||||
use Friendica\Protocol\OStatus;
|
|
||||||
|
|
||||||
class PubSubPublish
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* Publishes subscriber id
|
|
||||||
*
|
|
||||||
* @param int $pubsubpublish_id Push subscriber id
|
|
||||||
* @return void
|
|
||||||
*/
|
|
||||||
public static function execute(int $pubsubpublish_id = 0)
|
|
||||||
{
|
|
||||||
if ($pubsubpublish_id == 0) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
self::publish($pubsubpublish_id);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Publishes push subscriber
|
|
||||||
*
|
|
||||||
* @param int $id Push subscriber id
|
|
||||||
* @return void
|
|
||||||
*/
|
|
||||||
private static function publish(int $id)
|
|
||||||
{
|
|
||||||
$subscriber = DBA::selectFirst('push_subscriber', [], ['id' => $id]);
|
|
||||||
if (!DBA::isResult($subscriber)) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// @todo Check server status with GServer::check()
|
|
||||||
// Before this can be done we need a way to safely detect the server url.
|
|
||||||
|
|
||||||
Logger::info('Generate feed of user ' . $subscriber['nickname'] . ' to ' . $subscriber['callback_url'] . ' - last updated ' . $subscriber['last_update']);
|
|
||||||
|
|
||||||
$last_update = $subscriber['last_update'];
|
|
||||||
$params = OStatus::feed($subscriber['nickname'], $last_update);
|
|
||||||
|
|
||||||
if (!$params) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
$hmac_sig = hash_hmac('sha1', $params, $subscriber['secret']);
|
|
||||||
|
|
||||||
$headers = [
|
|
||||||
'Content-type' => 'application/atom+xml',
|
|
||||||
'Link' => sprintf(
|
|
||||||
'<%s>;rel=hub,<%s>;rel=self',
|
|
||||||
DI::baseUrl() . '/pubsubhubbub/' . $subscriber['nickname'],
|
|
||||||
$subscriber['topic']
|
|
||||||
),
|
|
||||||
'X-Hub-Signature' => 'sha1=' . $hmac_sig
|
|
||||||
];
|
|
||||||
|
|
||||||
Logger::debug('POST', ['headers' => $headers, 'params' => $params]);
|
|
||||||
|
|
||||||
$postResult = DI::httpClient()->post($subscriber['callback_url'], $params, $headers, 0, HttpClientRequest::PUBSUB);
|
|
||||||
$ret = $postResult->getReturnCode();
|
|
||||||
|
|
||||||
if ($ret >= 200 && $ret <= 299) {
|
|
||||||
Logger::info('Successfully pushed to ' . $subscriber['callback_url']);
|
|
||||||
|
|
||||||
PushSubscriber::reset($subscriber['id'], $last_update);
|
|
||||||
} else {
|
|
||||||
Logger::notice('Delivery error when pushing to ' . $subscriber['callback_url'] . ' HTTP: ' . $ret);
|
|
||||||
|
|
||||||
PushSubscriber::delay($subscriber['id']);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -115,8 +115,6 @@ return [
|
||||||
"theme" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => "user theme preference"],
|
"theme" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => "user theme preference"],
|
||||||
"pubkey" => ["type" => "text", "comment" => "RSA public key 4096 bit"],
|
"pubkey" => ["type" => "text", "comment" => "RSA public key 4096 bit"],
|
||||||
"prvkey" => ["type" => "text", "comment" => "RSA private key 4096 bit"],
|
"prvkey" => ["type" => "text", "comment" => "RSA private key 4096 bit"],
|
||||||
"spubkey" => ["type" => "text", "comment" => ""],
|
|
||||||
"sprvkey" => ["type" => "text", "comment" => ""],
|
|
||||||
"verified" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => "user is verified through email"],
|
"verified" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => "user is verified through email"],
|
||||||
"blocked" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => "1 for user is blocked"],
|
"blocked" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => "1 for user is blocked"],
|
||||||
"blockwall" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => "Prohibit contacts to post to the profile page of the user"],
|
"blockwall" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => "Prohibit contacts to post to the profile page of the user"],
|
||||||
|
@ -229,7 +227,6 @@ return [
|
||||||
"remote_self" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => ""],
|
"remote_self" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => ""],
|
||||||
"rel" => ["type" => "tinyint unsigned", "not null" => "1", "default" => "0", "comment" => "The kind of the relation between the user and the contact"],
|
"rel" => ["type" => "tinyint unsigned", "not null" => "1", "default" => "0", "comment" => "The kind of the relation between the user and the contact"],
|
||||||
"protocol" => ["type" => "char(4)", "not null" => "1", "default" => "", "comment" => "Protocol of the contact"],
|
"protocol" => ["type" => "char(4)", "not null" => "1", "default" => "", "comment" => "Protocol of the contact"],
|
||||||
"subhub" => ["type" => "boolean", "not null" => "1", "default" => "0", "comment" => ""],
|
|
||||||
"hub-verify" => ["type" => "varbinary(383)", "not null" => "1", "default" => "", "comment" => ""],
|
"hub-verify" => ["type" => "varbinary(383)", "not null" => "1", "default" => "", "comment" => ""],
|
||||||
"rating" => ["type" => "tinyint", "not null" => "1", "default" => "0", "comment" => "Automatically detected feed poll frequency"],
|
"rating" => ["type" => "tinyint", "not null" => "1", "default" => "0", "comment" => "Automatically detected feed poll frequency"],
|
||||||
"priority" => ["type" => "tinyint unsigned", "not null" => "1", "default" => "0", "comment" => "Feed poll priority"],
|
"priority" => ["type" => "tinyint unsigned", "not null" => "1", "default" => "0", "comment" => "Feed poll priority"],
|
||||||
|
@ -1353,7 +1350,6 @@ return [
|
||||||
"dfrn" => ["type" => "mediumint", "not null" => "1", "default" => "0", "comment" => "Number of successful deliveries via DFRN"],
|
"dfrn" => ["type" => "mediumint", "not null" => "1", "default" => "0", "comment" => "Number of successful deliveries via DFRN"],
|
||||||
"legacy_dfrn" => ["type" => "mediumint", "not null" => "1", "default" => "0", "comment" => "Number of successful deliveries via legacy DFRN"],
|
"legacy_dfrn" => ["type" => "mediumint", "not null" => "1", "default" => "0", "comment" => "Number of successful deliveries via legacy DFRN"],
|
||||||
"diaspora" => ["type" => "mediumint", "not null" => "1", "default" => "0", "comment" => "Number of successful deliveries via Diaspora"],
|
"diaspora" => ["type" => "mediumint", "not null" => "1", "default" => "0", "comment" => "Number of successful deliveries via Diaspora"],
|
||||||
"ostatus" => ["type" => "mediumint", "not null" => "1", "default" => "0", "comment" => "Number of successful deliveries via OStatus"],
|
|
||||||
],
|
],
|
||||||
"indexes" => [
|
"indexes" => [
|
||||||
"PRIMARY" => ["uri-id"],
|
"PRIMARY" => ["uri-id"],
|
||||||
|
@ -1785,26 +1781,6 @@ return [
|
||||||
"psid" => ["psid"],
|
"psid" => ["psid"],
|
||||||
]
|
]
|
||||||
],
|
],
|
||||||
"push_subscriber" => [
|
|
||||||
"comment" => "Used for OStatus: Contains feed subscribers",
|
|
||||||
"fields" => [
|
|
||||||
"id" => ["type" => "int unsigned", "not null" => "1", "extra" => "auto_increment", "primary" => "1", "comment" => "sequential ID"],
|
|
||||||
"uid" => ["type" => "mediumint unsigned", "not null" => "1", "default" => "0", "foreign" => ["user" => "uid"], "comment" => "User id"],
|
|
||||||
"callback_url" => ["type" => "varbinary(383)", "not null" => "1", "default" => "", "comment" => ""],
|
|
||||||
"topic" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
|
|
||||||
"nickname" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
|
|
||||||
"push" => ["type" => "tinyint", "not null" => "1", "default" => "0", "comment" => "Retrial counter"],
|
|
||||||
"last_update" => ["type" => "datetime", "not null" => "1", "default" => DBA::NULL_DATETIME, "comment" => "Date of last successful trial"],
|
|
||||||
"next_try" => ["type" => "datetime", "not null" => "1", "default" => DBA::NULL_DATETIME, "comment" => "Next retrial date"],
|
|
||||||
"renewed" => ["type" => "datetime", "not null" => "1", "default" => DBA::NULL_DATETIME, "comment" => "Date of last subscription renewal"],
|
|
||||||
"secret" => ["type" => "varchar(255)", "not null" => "1", "default" => "", "comment" => ""],
|
|
||||||
],
|
|
||||||
"indexes" => [
|
|
||||||
"PRIMARY" => ["id"],
|
|
||||||
"next_try" => ["next_try"],
|
|
||||||
"uid" => ["uid"]
|
|
||||||
]
|
|
||||||
],
|
|
||||||
"register" => [
|
"register" => [
|
||||||
"comment" => "registrations requiring admin approval",
|
"comment" => "registrations requiring admin approval",
|
||||||
"fields" => [
|
"fields" => [
|
||||||
|
@ -1979,7 +1955,6 @@ return [
|
||||||
"remote_self" => ["type" => "tinyint unsigned", "comment" => "0 => No mirroring, 1-2 => Mirror as own post, 3 => Mirror as reshare"],
|
"remote_self" => ["type" => "tinyint unsigned", "comment" => "0 => No mirroring, 1-2 => Mirror as own post, 3 => Mirror as reshare"],
|
||||||
"fetch_further_information" => ["type" => "tinyint unsigned", "comment" => "0 => None, 1 => Fetch information, 3 => Fetch keywords, 2 => Fetch both"],
|
"fetch_further_information" => ["type" => "tinyint unsigned", "comment" => "0 => None, 1 => Fetch information, 3 => Fetch keywords, 2 => Fetch both"],
|
||||||
"ffi_keyword_denylist" => ["type" => "text", "comment" => ""],
|
"ffi_keyword_denylist" => ["type" => "text", "comment" => ""],
|
||||||
"subhub" => ["type" => "boolean", "comment" => ""],
|
|
||||||
"hub-verify" => ["type" => "varbinary(383)", "comment" => ""],
|
"hub-verify" => ["type" => "varbinary(383)", "comment" => ""],
|
||||||
"protocol" => ["type" => "char(4)", "comment" => "Protocol of the contact"],
|
"protocol" => ["type" => "char(4)", "comment" => "Protocol of the contact"],
|
||||||
"rating" => ["type" => "tinyint", "comment" => "Automatically detected feed poll frequency"],
|
"rating" => ["type" => "tinyint", "comment" => "Automatically detected feed poll frequency"],
|
||||||
|
|
|
@ -1450,7 +1450,6 @@
|
||||||
"poll" => ["contact", "poll"],
|
"poll" => ["contact", "poll"],
|
||||||
"confirm" => ["contact", "confirm"],
|
"confirm" => ["contact", "confirm"],
|
||||||
"poco" => ["contact", "poco"],
|
"poco" => ["contact", "poco"],
|
||||||
"subhub" => ["contact", "subhub"],
|
|
||||||
"hub-verify" => ["contact", "hub-verify"],
|
"hub-verify" => ["contact", "hub-verify"],
|
||||||
"last-update" => ["contact", "last-update"],
|
"last-update" => ["contact", "last-update"],
|
||||||
"success_update" => ["contact", "success_update"],
|
"success_update" => ["contact", "success_update"],
|
||||||
|
@ -1499,8 +1498,6 @@
|
||||||
"theme" => ["user", "theme"],
|
"theme" => ["user", "theme"],
|
||||||
"upubkey" => ["user", "pubkey"],
|
"upubkey" => ["user", "pubkey"],
|
||||||
"uprvkey" => ["user", "prvkey"],
|
"uprvkey" => ["user", "prvkey"],
|
||||||
"sprvkey" => ["user", "sprvkey"],
|
|
||||||
"spubkey" => ["user", "spubkey"],
|
|
||||||
"verified" => ["user", "verified"],
|
"verified" => ["user", "verified"],
|
||||||
"blockwall" => ["user", "blockwall"],
|
"blockwall" => ["user", "blockwall"],
|
||||||
"hidewall" => ["user", "hidewall"],
|
"hidewall" => ["user", "hidewall"],
|
||||||
|
@ -1693,7 +1690,6 @@
|
||||||
"readonly" => ["ucontact", "readonly"],
|
"readonly" => ["ucontact", "readonly"],
|
||||||
"blocked" => ["ucontact", "blocked"],
|
"blocked" => ["ucontact", "blocked"],
|
||||||
"block_reason" => ["ucontact", "block_reason"],
|
"block_reason" => ["ucontact", "block_reason"],
|
||||||
"subhub" => ["ucontact", "subhub"],
|
|
||||||
"hub-verify" => ["ucontact", "hub-verify"],
|
"hub-verify" => ["ucontact", "hub-verify"],
|
||||||
"reason" => ["ucontact", "reason"],
|
"reason" => ["ucontact", "reason"],
|
||||||
"dfrn-notify" => ["contact", "notify"],
|
"dfrn-notify" => ["contact", "notify"],
|
||||||
|
|
|
@ -412,7 +412,7 @@ return [
|
||||||
'/credits' => [Module\Credits::class, [R::GET]],
|
'/credits' => [Module\Credits::class, [R::GET]],
|
||||||
'/delegation' => [Module\User\Delegation::class, [R::GET, R::POST]],
|
'/delegation' => [Module\User\Delegation::class, [R::GET, R::POST]],
|
||||||
'/dfrn_notify[/{nickname}]' => [Module\DFRN\Notify::class, [ R::POST]],
|
'/dfrn_notify[/{nickname}]' => [Module\DFRN\Notify::class, [ R::POST]],
|
||||||
'/dfrn_poll/{nickname}' => [Module\DFRN\Poll::class, [R::GET]],
|
'/dfrn_poll/{nickname}' => [Module\Feed::class, [R::GET]],
|
||||||
'/dirfind' => [Module\Search\Directory::class, [R::GET]],
|
'/dirfind' => [Module\Search\Directory::class, [R::GET]],
|
||||||
'/directory' => [Module\Directory::class, [R::GET]],
|
'/directory' => [Module\Directory::class, [R::GET]],
|
||||||
|
|
||||||
|
@ -510,7 +510,6 @@ return [
|
||||||
'/users/deleted' => [Module\Moderation\Users\Deleted::class, [R::GET ]],
|
'/users/deleted' => [Module\Moderation\Users\Deleted::class, [R::GET ]],
|
||||||
'/users/create' => [Module\Moderation\Users\Create::class, [R::GET, R::POST]],
|
'/users/create' => [Module\Moderation\Users\Create::class, [R::GET, R::POST]],
|
||||||
],
|
],
|
||||||
'/modexp/{nick}' => [Module\PublicRSAKey::class, [R::GET]],
|
|
||||||
'/newmember' => [Module\Welcome::class, [R::GET]],
|
'/newmember' => [Module\Welcome::class, [R::GET]],
|
||||||
'/nodeinfo/1.0' => [Module\NodeInfo110::class, [R::GET]],
|
'/nodeinfo/1.0' => [Module\NodeInfo110::class, [R::GET]],
|
||||||
'/nodeinfo/2.0' => [Module\NodeInfo120::class, [R::GET]],
|
'/nodeinfo/2.0' => [Module\NodeInfo120::class, [R::GET]],
|
||||||
|
@ -587,14 +586,8 @@ return [
|
||||||
'/u/{nickname}' => $profileRoutes,
|
'/u/{nickname}' => $profileRoutes,
|
||||||
'/~{nickname}' => $profileRoutes,
|
'/~{nickname}' => $profileRoutes,
|
||||||
|
|
||||||
// OStatus stack modules
|
|
||||||
'/ostatus/repair' => [Module\OStatus\Repair::class, [R::GET ]],
|
|
||||||
'/ostatus/subscribe' => [Module\OStatus\Subscribe::class, [R::GET ]],
|
'/ostatus/subscribe' => [Module\OStatus\Subscribe::class, [R::GET ]],
|
||||||
'/poco' => [Module\User\PortableContacts::class, [R::GET ]],
|
'/poco' => [Module\User\PortableContacts::class, [R::GET ]],
|
||||||
'/pubsub' => [Module\OStatus\PubSub::class, [R::GET, R::POST]],
|
|
||||||
'/pubsub/{nickname}[/{cid:\d+}]' => [Module\OStatus\PubSub::class, [R::GET, R::POST]],
|
|
||||||
'/pubsubhubbub[/{nickname}]' => [Module\OStatus\PubSubHubBub::class, [ R::POST]],
|
|
||||||
'/salmon[/{nickname}]' => [Module\OStatus\Salmon::class, [ R::POST]],
|
|
||||||
|
|
||||||
'/search' => [
|
'/search' => [
|
||||||
'[/]' => [Module\Search\Index::class, [R::GET ]],
|
'[/]' => [Module\Search\Index::class, [R::GET ]],
|
||||||
|
|
|
@ -452,7 +452,7 @@ function pre_update_1364()
|
||||||
return Update::FAILED;
|
return Update::FAILED;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!DBA::e("DELETE FROM `push_subscriber` WHERE NOT `uid` IN (SELECT `uid` FROM `user`)")) {
|
if (DBStructure::existsTable('push_subscriber') && !DBA::e("DELETE FROM `push_subscriber` WHERE NOT `uid` IN (SELECT `uid` FROM `user`)")) {
|
||||||
return Update::FAILED;
|
return Update::FAILED;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -75,8 +75,6 @@
|
||||||
</div>
|
</div>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
|
||||||
{{include file="field_checkbox.tpl" field=$ostatus_enabled}}
|
|
||||||
|
|
||||||
{{if $diaspora_able}}
|
{{if $diaspora_able}}
|
||||||
{{include file="field_checkbox.tpl" field=$diaspora_enabled}}
|
{{include file="field_checkbox.tpl" field=$diaspora_enabled}}
|
||||||
{{else}}
|
{{else}}
|
||||||
|
|
|
@ -27,8 +27,6 @@
|
||||||
{{include file="field_select.tpl" field=$article_mode}}
|
{{include file="field_select.tpl" field=$article_mode}}
|
||||||
{{include file="field_input.tpl" field=$legacy_contact}}
|
{{include file="field_input.tpl" field=$legacy_contact}}
|
||||||
|
|
||||||
<p><a href="{{$repair_ostatus_url}}">{{$repair_ostatus_text}}</a></p>
|
|
||||||
|
|
||||||
<div class="settings-submit-wrapper">
|
<div class="settings-submit-wrapper">
|
||||||
<input type="submit" id="general-submit" name="general-submit" class="settings-submit" value="{{$submit}}"/>
|
<input type="submit" id="general-submit" name="general-submit" class="settings-submit" value="{{$submit}}"/>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -153,8 +153,6 @@
|
||||||
</div>
|
</div>
|
||||||
{{/if}}
|
{{/if}}
|
||||||
|
|
||||||
{{include file="field_checkbox.tpl" field=$ostatus_enabled}}
|
|
||||||
|
|
||||||
{{if $diaspora_able}}
|
{{if $diaspora_able}}
|
||||||
{{include file="field_checkbox.tpl" field=$diaspora_enabled}}
|
{{include file="field_checkbox.tpl" field=$diaspora_enabled}}
|
||||||
{{else}}
|
{{else}}
|
||||||
|
|
|
@ -41,8 +41,6 @@
|
||||||
{{include file="field_select.tpl" field=$article_mode}}
|
{{include file="field_select.tpl" field=$article_mode}}
|
||||||
|
|
||||||
{{include file="field_input.tpl" field=$legacy_contact}}
|
{{include file="field_input.tpl" field=$legacy_contact}}
|
||||||
|
|
||||||
<p><a href="{{$repair_ostatus_url}}">{{$repair_ostatus_text}}</a></p>
|
|
||||||
</div>
|
</div>
|
||||||
<div class="panel-footer">
|
<div class="panel-footer">
|
||||||
<button type="submit" id="general-submit" name="general-submit" class="btn btn-primary" value="{{$submit}}">{{$submit}}</button>
|
<button type="submit" id="general-submit" name="general-submit" class="btn btn-primary" value="{{$submit}}">{{$submit}}</button>
|
||||||
|
|
Loading…
Reference in a new issue