Skip to content

Commit e05176c

Browse files
authored
Add a ACTIVITYPUB_DISABLE_REWRITES constant (#490)
1 parent 9907585 commit e05176c

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

activitypub.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ function define_constants() {
3131
\defined( 'ACTIVITYPUB_USERNAME_REGEXP' ) || \define( 'ACTIVITYPUB_USERNAME_REGEXP', '(?:([A-Za-z0-9_-]+)@((?:[A-Za-z0-9_-]+\.)+[A-Za-z]+))' );
3232
\defined( 'ACTIVITYPUB_CUSTOM_POST_CONTENT' ) || \define( 'ACTIVITYPUB_CUSTOM_POST_CONTENT', "<strong>[ap_title]</strong>\n\n[ap_content]\n\n[ap_hashtags]\n\n[ap_shortlink]" );
3333
\defined( 'ACTIVITYPUB_AUTHORIZED_FETCH' ) || \define( 'ACTIVITYPUB_AUTHORIZED_FETCH', false );
34+
\defined( 'ACTIVITYPUB_DISABLE_REWRITES' ) || \define( 'ACTIVITYPUB_DISABLE_REWRITES', false );
3435

3536
\define( 'ACTIVITYPUB_PLUGIN_DIR', plugin_dir_path( __FILE__ ) );
3637
\define( 'ACTIVITYPUB_PLUGIN_BASENAME', plugin_basename( __FILE__ ) );

includes/class-activitypub.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -227,6 +227,12 @@ public static function untrash_post( $post_id ) {
227227
* Add rewrite rules
228228
*/
229229
public static function add_rewrite_rules() {
230+
// If another system needs to take precedence over the ActivityPub rewrite rules,
231+
// they can define their own and will manually call the appropriate functions as required.
232+
if ( ACTIVITYPUB_DISABLE_REWRITES ) {
233+
return;
234+
}
235+
230236
if ( ! \class_exists( 'Webfinger' ) ) {
231237
\add_rewrite_rule(
232238
'^.well-known/webfinger',

0 commit comments

Comments
 (0)