@@ -66,28 +66,6 @@ public static function register_routes() {
6666 ),
6767 )
6868 );
69-
70- register_rest_route (
71- 'serviceinfo ' ,
72- '/(?P<version>[\.\d]+) ' ,
73- array (
74- array (
75- 'methods ' => WP_REST_Server::READABLE ,
76- 'callback ' => array ( 'Nodeinfo_Endpoint ' , 'render_serviceinfo ' ),
77- 'permission_callback ' => '__return_true ' ,
78- 'args ' => array (
79- 'version ' => array (
80- 'required ' => true ,
81- 'type ' => 'string ' ,
82- 'description ' => __ ( 'The version of the ServiceInfo scheme ' , 'nodeinfo ' ),
83- 'enum ' => array (
84- '1.0 ' ,
85- ),
86- ),
87- ),
88- ),
89- )
90- );
9169 }
9270
9371 /**
@@ -156,28 +134,18 @@ public static function render_nodeinfo2( WP_REST_Request $request ) {
156134 return new WP_REST_Response ( $ nodeinfo2 ->to_array () );
157135 }
158136
159- /**
160- * Render the ServiceInfo file.
161- *
162- * @param WP_REST_Request $request the request object
163- * @return WP_REST_Response the response object
164- */
165- public static function render_serviceinfo ( WP_REST_Request $ request ) {
166- require_once ( 'class-serviceinfo.php ' );
167-
168- $ serviceinfo = new Serviceinfo ( $ request ->get_param ( 'version ' ) );
169-
170- // Create the response object
171- return new WP_REST_Response ( $ serviceinfo ->to_array () );
172- }
173-
174137 /**
175138 * Add Host-Meta and WebFinger discovery links
176139 *
177140 * @param array $jrd the JRD file used by Host-Meta and WebFinger
178141 * @return array the extended JRD file
179142 */
180143 public static function render_jrd ( $ jrd ) {
144+ $ jrd ['links ' ][] = array (
145+ 'rel ' => 'http://nodeinfo.diaspora.software/ns/schema/2.1 ' ,
146+ 'href ' => get_rest_url ( null , '/nodeinfo/2.1 ' ),
147+ );
148+
181149 $ jrd ['links ' ][] = array (
182150 'rel ' => 'http://nodeinfo.diaspora.software/ns/schema/2.0 ' ,
183151 'href ' => get_rest_url ( null , '/nodeinfo/2.0 ' ),
@@ -193,15 +161,6 @@ public static function render_jrd( $jrd ) {
193161 'href ' => get_rest_url ( null , '/nodeinfo/1.0 ' ),
194162 );
195163
196- $ jrd ['links ' ][] = array (
197- 'rel ' => 'https://feneas.org/ns/serviceinfo ' ,
198- 'type ' => 'application/ld+json ' ,
199- 'href ' => get_rest_url ( null , '/serviceinfo/1.0 ' ),
200- 'properties ' => array (
201- 'https://feneas.org/ns/serviceinfo#software.name ' => get_bloginfo ( 'name ' , 'esc_attr ' ),
202- ),
203- );
204-
205164 return $ jrd ;
206165 }
207166}
0 commit comments