| @@ -22,10 +22,8 @@ | ||
| 22 | 22 | */ |
| 23 | 23 | public static function init() { |
| 24 | 24 | \add_filter( 'webfinger_user_data', array( self::class, 'add_user_discovery' ), 1, 3 ); |
| 25 | 25 | \add_filter( 'webfinger_data', array( self::class, 'add_pseudo_user_discovery' ), 1, 2 ); |
| 26 | - | |
| 27 | - \add_filter( 'webfinger_data', array( self::class, 'add_interaction_links' ), 11 ); | |
| 28 | 26 | } |
| 29 | 27 | |
| 30 | 28 | /** |
| 31 | 29 | * Add WebFinger discovery links. |
| @@ -56,8 +54,13 @@ | ||
| 56 | 54 | 'type' => 'application/activity+json', |
| 57 | 55 | 'href' => $user->get_id(), |
| 58 | 56 | ); |
| 59 | 57 | |
| 58 | + $jrd['links'][] = array( | |
| 59 | + 'rel' => 'http://ostatus.org/schema/1.0/subscribe', | |
| 60 | + 'template' => get_rest_url_by_path( 'interactions?uri={uri}' ), | |
| 61 | + ); | |
| 62 | + | |
| 60 | 63 | return $jrd; |
| 61 | 64 | } |
| 62 | 65 | |
| 63 | 66 | /** |
| @@ -97,8 +100,12 @@ | ||
| 97 | 100 | 'rel' => 'http://webfinger.net/rel/profile-page', |
| 98 | 101 | 'type' => 'text/html', |
| 99 | 102 | 'href' => $user->get_id(), |
| 100 | 103 | ), |
| 104 | + array( | |
| 105 | + 'rel' => 'http://ostatus.org/schema/1.0/subscribe', | |
| 106 | + 'template' => get_rest_url_by_path( 'interactions?uri={uri}' ), | |
| 107 | + ), | |
| 101 | 108 | ), |
| 102 | 109 | ); |
| 103 | 110 | |
| 104 | 111 | if ( 'Person' !== $user->get_type() ) { |
| @@ -107,44 +114,6 @@ | ||
| 107 | 114 | ); |
| 108 | 115 | } |
| 109 | 116 | |
| 110 | 117 | return $profile; |
| 111 | - } | |
| 112 | - | |
| 113 | - /** | |
| 114 | - * Add interaction links to the WebFinger data. | |
| 115 | - * | |
| 116 | - * @see https://codeberg.org/fediverse/fep/src/branch/main/fep/3b86/fep-3b86.md | |
| 117 | - * | |
| 118 | - * @param array $jrd The jrd array. | |
| 119 | - * | |
| 120 | - * @return array The jrd array. | |
| 121 | - */ | |
| 122 | - public static function add_interaction_links( $jrd ) { | |
| 123 | - if ( ! is_array( $jrd ) ) { | |
| 124 | - return $jrd; | |
| 125 | - } | |
| 126 | - | |
| 127 | - $jrd['links'][] = array( | |
| 128 | - 'rel' => 'http://ostatus.org/schema/1.0/subscribe', | |
| 129 | - 'template' => get_rest_url_by_path( 'interactions?uri={uri}' ), | |
| 130 | - ); | |
| 131 | - | |
| 132 | - /* | |
| 133 | - * Note: The parameter name `{inReplyTo}` is used here for all 'Create' intents, | |
| 134 | - * not just replies, to maintain compatibility with existing implementations and | |
| 135 | - * the FEP-3b86 specification. If a more generic parameter name is adopted in the | |
| 136 | - * future, this should be updated accordingly. | |
| 137 | - */ | |
| 138 | - $jrd['links'][] = array( | |
| 139 | - 'rel' => 'https://w3id.org/fep/3b86/Create', | |
| 140 | - 'template' => get_rest_url_by_path( 'interactions?uri={inReplyTo}&intent=create' ), | |
| 141 | - ); | |
| 142 | - | |
| 143 | - $jrd['links'][] = array( | |
| 144 | - 'rel' => 'https://w3id.org/fep/3b86/Follow', | |
| 145 | - 'template' => get_rest_url_by_path( 'interactions?uri={object}&intent=follow' ), | |
| 146 | - ); | |
| 147 | - | |
| 148 | - return $jrd; | |
| 149 | 118 | } |
| 150 | 119 | } |