Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,7 @@ Release pending.
* Added: Caching of ActivityPub Endpoints in WP REST API
* Added: Fade out WB REST CACHE Icon @ Admin Bar
* Added: Disable UpdraftPlus @ Admin Bar
* Fixed: Content Type Return @ WP REST CACHE

### 0.8

Expand Down
14 changes: 8 additions & 6 deletions unmus_cache.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
* @package unmus
* @since 0.9
*
* @link https://epiph.yt/en/blog/2025/activitypub-plugin-and-accidental-ddos/
* @link https://epiph.yt/blog/2025/das-activitypub-plugin-und-der-versehentliche-ddos/
*/

// Security: Stops code execution if WordPress is not loaded
Expand Down Expand Up @@ -111,7 +111,8 @@ function unmus_is_activitypub_endpoint( string $uri ) :bool {
function unmus_cache_determine_object_type( $object_type, $cache_key, $data, $uri ) {

if (unmus_is_activitypub_endpoint( $uri ) ) {
$object_type = 'ActivityPub';
return 'ActivityPub';
} else {
return $object_type;
}
}
Expand Down Expand Up @@ -153,13 +154,14 @@ function unmus_cache_reset_by_transition_post_status( string $new_status, string
* Always return false for ActivityPub endpoints,
* since cache entries cannot be flushed otherwise.
*
* @param bool $is_single Whether the current cache represents a single item
* @param mixed $data Data to cache
* @param string $uri Request URI
* @return bool Whether the cache represents a single item
* @param bool $is_single Whether the current cache represents a single item
* @param mixed $data Data to cache
* @param string $uri Request URI
* @return bool Whether the cache represents a single item
*/

function set_is_single_item( bool $is_single, mixed $data, string $uri ): bool {

if ( unmus_is_activitypub_endpoint( $uri ) ) {
return false;
}
Expand Down