updated plugin ActivityPub version 8.3.0
@ -3,12 +3,12 @@
|
||||
* Plugin Name: ActivityPub
|
||||
* Plugin URI: https://github.com/Automattic/wordpress-activitypub
|
||||
* Description: The ActivityPub protocol is a decentralized social networking protocol based upon the ActivityStreams 2.0 data format.
|
||||
* Version: 5.8.0
|
||||
* Version: 8.3.0
|
||||
* Author: Matthias Pfefferle & Automattic
|
||||
* Author URI: https://automattic.com/
|
||||
* License: MIT
|
||||
* License URI: http://opensource.org/licenses/MIT
|
||||
* Requires PHP: 7.2
|
||||
* Requires PHP: 7.4
|
||||
* Text Domain: activitypub
|
||||
* Domain Path: /languages
|
||||
*
|
||||
@ -17,9 +17,7 @@
|
||||
|
||||
namespace Activitypub;
|
||||
|
||||
use WP_CLI;
|
||||
|
||||
\define( 'ACTIVITYPUB_PLUGIN_VERSION', '5.8.0' );
|
||||
\define( 'ACTIVITYPUB_PLUGIN_VERSION', '8.3.0' );
|
||||
|
||||
// Plugin related constants.
|
||||
\define( 'ACTIVITYPUB_PLUGIN_DIR', plugin_dir_path( __FILE__ ) );
|
||||
@ -29,37 +27,58 @@ use WP_CLI;
|
||||
|
||||
require_once __DIR__ . '/includes/class-autoloader.php';
|
||||
require_once __DIR__ . '/includes/compat.php';
|
||||
require_once __DIR__ . '/includes/functions.php';
|
||||
require_once __DIR__ . '/includes/constants.php';
|
||||
require_once __DIR__ . '/includes/functions.php';
|
||||
require_once __DIR__ . '/includes/functions-activity.php';
|
||||
require_once __DIR__ . '/includes/functions-comment.php';
|
||||
require_once __DIR__ . '/includes/functions-federation.php';
|
||||
require_once __DIR__ . '/includes/functions-media.php';
|
||||
require_once __DIR__ . '/includes/functions-post.php';
|
||||
require_once __DIR__ . '/includes/functions-request.php';
|
||||
require_once __DIR__ . '/includes/functions-url.php';
|
||||
require_once __DIR__ . '/includes/functions-user.php';
|
||||
require_once __DIR__ . '/integration/load.php';
|
||||
|
||||
Autoloader::register_path( __NAMESPACE__, __DIR__ . '/includes' );
|
||||
|
||||
\register_activation_hook( __FILE__, array( Activitypub::class, 'activate' ) );
|
||||
\register_deactivation_hook( __FILE__, array( Activitypub::class, 'deactivate' ) );
|
||||
\register_uninstall_hook( __FILE__, array( Activitypub::class, 'uninstall' ) );
|
||||
|
||||
/**
|
||||
* Initialize REST routes.
|
||||
*/
|
||||
function rest_init() {
|
||||
Rest\Server::init();
|
||||
Rest\Post::init();
|
||||
( new Rest\Actors_Controller() )->register_routes();
|
||||
( new Rest\Actors_Inbox_Controller() )->register_routes();
|
||||
( new Rest\Admin\Actions_Controller() )->register_routes();
|
||||
( new Rest\Admin\Statistics_Controller() )->register_routes();
|
||||
( new Rest\Application_Controller() )->register_routes();
|
||||
( new Rest\Stats_Image_Controller() )->register_routes();
|
||||
( new Rest\Collections_Controller() )->register_routes();
|
||||
( new Rest\Comments_Controller() )->register_routes();
|
||||
( new Rest\Followers_Controller() )->register_routes();
|
||||
( new Rest\Following_Controller() )->register_routes();
|
||||
( new Rest\Liked_Controller() )->register_routes();
|
||||
( new Rest\Inbox_Controller() )->register_routes();
|
||||
( new Rest\Interaction_Controller() )->register_routes();
|
||||
( new Rest\Moderators_Controller() )->register_routes();
|
||||
if ( \get_option( 'activitypub_api', false ) ) {
|
||||
( new Rest\OAuth\Authorization_Controller() )->register_routes();
|
||||
( new Rest\OAuth\Clients_Controller() )->register_routes();
|
||||
( new Rest\OAuth\Token_Controller() )->register_routes();
|
||||
}
|
||||
( new Rest\Outbox_Controller() )->register_routes();
|
||||
( new Rest\Post_Controller() )->register_routes();
|
||||
( new Rest\Replies_Controller() )->register_routes();
|
||||
( new Rest\URL_Validator_Controller() )->register_routes();
|
||||
( new Rest\Webfinger_Controller() )->register_routes();
|
||||
|
||||
// Load NodeInfo endpoints only if blog is public.
|
||||
if ( is_blog_public() ) {
|
||||
( new Rest\Nodeinfo_Controller() )->register_routes();
|
||||
}
|
||||
( new Rest\Proxy_Controller() )->register_routes();
|
||||
}
|
||||
\add_action( 'rest_api_init', __NAMESPACE__ . '\rest_init' );
|
||||
|
||||
@ -68,8 +87,14 @@ function rest_init() {
|
||||
*/
|
||||
function plugin_init() {
|
||||
\add_action( 'init', array( __NAMESPACE__ . '\Activitypub', 'init' ) );
|
||||
\add_action( 'init', array( __NAMESPACE__ . '\Avatars', 'init' ) );
|
||||
\add_action( 'init', array( __NAMESPACE__ . '\Cache', 'init' ) );
|
||||
\add_action( 'init', array( __NAMESPACE__ . '\Comment', 'init' ) );
|
||||
\add_action( 'init', array( __NAMESPACE__ . '\Dispatcher', 'init' ) );
|
||||
\add_action( 'init', array( __NAMESPACE__ . '\Embed', 'init' ) );
|
||||
if ( \get_option( 'activitypub_api', false ) ) {
|
||||
\add_action( 'init', array( __NAMESPACE__ . '\Event_Stream', 'init' ) );
|
||||
}
|
||||
\add_action( 'init', array( __NAMESPACE__ . '\Handler', 'init' ) );
|
||||
\add_action( 'init', array( __NAMESPACE__ . '\Hashtag', 'init' ) );
|
||||
\add_action( 'init', array( __NAMESPACE__ . '\Link', 'init' ) );
|
||||
@ -78,16 +103,32 @@ function plugin_init() {
|
||||
\add_action( 'init', array( __NAMESPACE__ . '\Migration', 'init' ), 1 );
|
||||
\add_action( 'init', array( __NAMESPACE__ . '\Move', 'init' ) );
|
||||
\add_action( 'init', array( __NAMESPACE__ . '\Options', 'init' ) );
|
||||
\add_action( 'init', array( __NAMESPACE__ . '\Scheduler', 'init' ) );
|
||||
\add_action( 'init', array( __NAMESPACE__ . '\Post_Types', 'init' ) );
|
||||
\add_action( 'init', array( __NAMESPACE__ . '\Router', 'init' ) );
|
||||
// Priority 0 ensures Scheduler hooks are registered before Migration (priority 1) runs.
|
||||
\add_action( 'init', array( __NAMESPACE__ . '\Scheduler', 'init' ), 0 );
|
||||
\add_action( 'init', array( __NAMESPACE__ . '\Search', 'init' ) );
|
||||
\add_action( 'init', array( __NAMESPACE__ . '\Signature', 'init' ) );
|
||||
// Only load OAuth Server if the ActivityPub API is enabled.
|
||||
if ( \get_option( 'activitypub_api', false ) ) {
|
||||
\add_action( 'init', array( __NAMESPACE__ . '\OAuth\Server', 'init' ) );
|
||||
}
|
||||
|
||||
if ( site_supports_blocks() ) {
|
||||
\add_action( 'init', array( __NAMESPACE__ . '\Blocks', 'init' ) );
|
||||
}
|
||||
|
||||
$debug_file = __DIR__ . '/includes/debug.php';
|
||||
if ( \WP_DEBUG && file_exists( $debug_file ) && is_readable( $debug_file ) ) {
|
||||
require_once $debug_file;
|
||||
Debug::init();
|
||||
// Only load relay if relay mode is enabled.
|
||||
if ( \get_option( 'activitypub_relay_mode', false ) ) {
|
||||
\add_action( 'init', array( __NAMESPACE__ . '\Relay', 'init' ) );
|
||||
}
|
||||
|
||||
// Load development tools.
|
||||
if ( 'local' === wp_get_environment_type() ) {
|
||||
$loader_file = __DIR__ . '/local/load.php';
|
||||
if ( \file_exists( $loader_file ) && \is_readable( $loader_file ) ) {
|
||||
require_once $loader_file;
|
||||
}
|
||||
}
|
||||
}
|
||||
\add_action( 'plugins_loaded', __NAMESPACE__ . '\plugin_init' );
|
||||
@ -96,16 +137,21 @@ function plugin_init() {
|
||||
* Initialize plugin admin.
|
||||
*/
|
||||
function plugin_admin_init() {
|
||||
// Menus are registered before `admin_init`, because of course they are.
|
||||
\add_action( 'admin_menu', array( __NAMESPACE__ . '\WP_Admin\Menu', 'admin_menu' ) );
|
||||
// Screen Options and Menus are set before `admin_init`.
|
||||
\add_action( 'init', array( __NAMESPACE__ . '\WP_Admin\Heartbeat', 'init' ), 9 ); // Before script loader.
|
||||
\add_filter( 'init', array( __NAMESPACE__ . '\WP_Admin\Screen_Options', 'init' ) );
|
||||
\add_action( 'init', array( __NAMESPACE__ . '\WP_Admin\Menu', 'init' ) );
|
||||
|
||||
\add_action( 'admin_init', array( __NAMESPACE__ . '\WP_Admin\Admin', 'init' ) );
|
||||
\add_action( 'admin_init', array( __NAMESPACE__ . '\WP_Admin\Advanced_Settings_Fields', 'init' ) );
|
||||
\add_action( 'admin_init', array( __NAMESPACE__ . '\WP_Admin\App', 'init' ), 0 ); // Before admin bar init.
|
||||
\add_action( 'admin_init', array( __NAMESPACE__ . '\WP_Admin\Blog_Settings_Fields', 'init' ) );
|
||||
\add_action( 'admin_init', array( __NAMESPACE__ . '\WP_Admin\Health_Check', 'init' ) );
|
||||
\add_action( 'admin_init', array( __NAMESPACE__ . '\WP_Admin\Settings', 'init' ) );
|
||||
\add_action( 'admin_init', array( __NAMESPACE__ . '\WP_Admin\Settings_Fields', 'init' ) );
|
||||
\add_action( 'admin_init', array( __NAMESPACE__ . '\WP_Admin\Welcome_Fields', 'init' ) );
|
||||
\add_action( 'admin_init', array( __NAMESPACE__ . '\WP_Admin\Advanced_Settings_Fields', 'init' ) );
|
||||
\add_action( 'admin_init', array( __NAMESPACE__ . '\WP_Admin\Blog_Settings_Fields', 'init' ) );
|
||||
\add_action( 'admin_init', array( __NAMESPACE__ . '\WP_Admin\Dashboard', 'init' ) );
|
||||
\add_action( 'admin_init', array( __NAMESPACE__ . '\WP_Admin\User_Settings_Fields', 'init' ) );
|
||||
\add_action( 'admin_init', array( __NAMESPACE__ . '\WP_Admin\Welcome_Fields', 'init' ) );
|
||||
|
||||
if ( defined( 'WP_LOAD_IMPORTERS' ) && WP_LOAD_IMPORTERS ) {
|
||||
require_once __DIR__ . '/includes/wp-admin/import/load.php';
|
||||
@ -114,14 +160,6 @@ function plugin_admin_init() {
|
||||
}
|
||||
\add_action( 'plugins_loaded', __NAMESPACE__ . '\plugin_admin_init' );
|
||||
|
||||
\register_activation_hook(
|
||||
__FILE__,
|
||||
array(
|
||||
__NAMESPACE__ . '\Activitypub',
|
||||
'activate',
|
||||
)
|
||||
);
|
||||
|
||||
/**
|
||||
* Redirect to the welcome page after plugin activation.
|
||||
*
|
||||
@ -135,72 +173,10 @@ function activation_redirect( $plugin ) {
|
||||
}
|
||||
\add_action( 'activated_plugin', __NAMESPACE__ . '\activation_redirect' );
|
||||
|
||||
\register_deactivation_hook(
|
||||
__FILE__,
|
||||
array(
|
||||
__NAMESPACE__ . '\Activitypub',
|
||||
'deactivate',
|
||||
)
|
||||
);
|
||||
|
||||
\register_uninstall_hook(
|
||||
__FILE__,
|
||||
array(
|
||||
__NAMESPACE__ . '\Activitypub',
|
||||
'uninstall',
|
||||
)
|
||||
);
|
||||
|
||||
|
||||
/**
|
||||
* `get_plugin_data` wrapper.
|
||||
*
|
||||
* @deprecated 4.2.0 Use `get_plugin_data` instead.
|
||||
*
|
||||
* @param array $default_headers Optional. The default plugin headers. Default empty array.
|
||||
* @return array The plugin metadata array.
|
||||
*/
|
||||
function get_plugin_meta( $default_headers = array() ) {
|
||||
_deprecated_function( __FUNCTION__, '4.2.0', 'get_plugin_data' );
|
||||
|
||||
if ( ! $default_headers ) {
|
||||
$default_headers = array(
|
||||
'Name' => 'Plugin Name',
|
||||
'PluginURI' => 'Plugin URI',
|
||||
'Version' => 'Version',
|
||||
'Description' => 'Description',
|
||||
'Author' => 'Author',
|
||||
'AuthorURI' => 'Author URI',
|
||||
'TextDomain' => 'Text Domain',
|
||||
'DomainPath' => 'Domain Path',
|
||||
'Network' => 'Network',
|
||||
'RequiresWP' => 'Requires at least',
|
||||
'RequiresPHP' => 'Requires PHP',
|
||||
'UpdateURI' => 'Update URI',
|
||||
);
|
||||
}
|
||||
|
||||
return \get_file_data( __FILE__, $default_headers, 'plugin' );
|
||||
}
|
||||
|
||||
/**
|
||||
* Plugin Version Number used for caching.
|
||||
*
|
||||
* @deprecated 4.2.0 Use constant ACTIVITYPUB_PLUGIN_VERSION directly.
|
||||
*/
|
||||
function get_plugin_version() {
|
||||
_deprecated_function( __FUNCTION__, '4.2.0', 'ACTIVITYPUB_PLUGIN_VERSION' );
|
||||
|
||||
return ACTIVITYPUB_PLUGIN_VERSION;
|
||||
}
|
||||
|
||||
// Check for CLI env, to add the CLI commands.
|
||||
if ( defined( 'WP_CLI' ) && WP_CLI ) {
|
||||
WP_CLI::add_command(
|
||||
'activitypub',
|
||||
'\Activitypub\Cli',
|
||||
array(
|
||||
'shortdesc' => 'ActivityPub related commands to manage plugin functionality and the federation of posts and comments.',
|
||||
)
|
||||
);
|
||||
Cli::register();
|
||||
}
|
||||
|
||||
// Register OAuth login form handler early (before wp-login.php processes).
|
||||
\add_action( 'login_form_activitypub_authorize', array( __NAMESPACE__ . '\OAuth\Server', 'login_form_authorize' ) );
|
||||
|
||||
@ -0,0 +1,7 @@
|
||||
/* Admin Bar Social Web Icon */
|
||||
#wpadminbar .activitypub-admin-bar-social-web .ab-item::before {
|
||||
content: "\2042"; /* ⁂ Asterism */
|
||||
font-family: Arial, Helvetica, sans-serif;
|
||||
font-weight: 700;
|
||||
top: 2px;
|
||||
}
|
||||
@ -4,12 +4,12 @@
|
||||
position: relative;
|
||||
}
|
||||
|
||||
.settings_page_activitypub .notice {
|
||||
.settings_page_activitypub div:not(.wrap) > .notice {
|
||||
max-width: 800px;
|
||||
margin: 0 auto 30px;
|
||||
}
|
||||
|
||||
.settings_page_activitypub .update-nag {
|
||||
.settings_page_activitypub div:not(.wrap) > .update-nag {
|
||||
margin: 25px 20px 15px 22px;
|
||||
}
|
||||
|
||||
@ -17,6 +17,10 @@
|
||||
padding-left: 22px;
|
||||
}
|
||||
|
||||
.activitypub-settings p.interactions {
|
||||
margin-bottom: 1em;
|
||||
}
|
||||
|
||||
.activitypub-settings-header {
|
||||
text-align: center;
|
||||
margin: 0 0 1rem;
|
||||
@ -45,6 +49,14 @@
|
||||
padding-left: 0;
|
||||
}
|
||||
|
||||
.activitypub-settings-tabs-scroller {
|
||||
overflow-x: auto;
|
||||
width: 100%;
|
||||
padding-top: 2px;
|
||||
-webkit-overflow-scrolling: touch;
|
||||
scroll-behavior: smooth;
|
||||
}
|
||||
|
||||
.activitypub-settings-tabs-wrapper {
|
||||
display: inline-flex;
|
||||
vertical-align: top;
|
||||
@ -61,9 +73,10 @@
|
||||
display: block;
|
||||
text-decoration: none;
|
||||
color: inherit;
|
||||
padding: .5rem 1rem 1rem;
|
||||
padding: 0.5rem 1rem 1rem;
|
||||
margin: 0 1rem;
|
||||
transition: box-shadow .5s ease-in-out;
|
||||
transition: box-shadow 0.5s ease-in-out;
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
.activitypub-settings .row {
|
||||
@ -91,6 +104,25 @@ summary {
|
||||
color: #2271b1;
|
||||
}
|
||||
|
||||
.activitypub-site-block-details {
|
||||
margin: 10px 0;
|
||||
}
|
||||
|
||||
.activitypub-site-block-details summary {
|
||||
padding: 8px 0;
|
||||
color: inherit;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
.activitypub-site-block-details table {
|
||||
max-width: 500px;
|
||||
margin-top: 10px;
|
||||
}
|
||||
|
||||
.activitypub-site-block-details td:last-child {
|
||||
width: 80px;
|
||||
}
|
||||
|
||||
.activitypub-settings-accordion {
|
||||
border: 1px solid #c3c4c7;
|
||||
}
|
||||
@ -133,13 +165,6 @@ summary {
|
||||
user-select: auto;
|
||||
}
|
||||
|
||||
.activitypub-settings-accordion-trigger {
|
||||
color: #2c3338;
|
||||
cursor: pointer;
|
||||
font-weight: 400;
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
.activitypub-settings-accordion-trigger .title {
|
||||
pointer-events: none;
|
||||
font-weight: 600;
|
||||
@ -150,19 +175,24 @@ summary {
|
||||
.activitypub-settings-accordion-viewed .icon {
|
||||
border: solid #50575e medium;
|
||||
border-width: 0 2px 2px 0;
|
||||
height: .5rem;
|
||||
height: 0.5rem;
|
||||
pointer-events: none;
|
||||
position: absolute;
|
||||
right: 1.5em;
|
||||
top: 50%;
|
||||
transform: translateY(-70%) rotate(45deg);
|
||||
width: .5rem;
|
||||
width: 0.5rem;
|
||||
}
|
||||
|
||||
.activitypub-settings-accordion-trigger[aria-expanded="true"] .icon {
|
||||
transform: translateY(-30%) rotate(-135deg);
|
||||
}
|
||||
|
||||
table.followings .dashicons {
|
||||
font-size: 1em;
|
||||
line-height: 1.7;
|
||||
}
|
||||
|
||||
.activitypub-settings-accordion-trigger:active,
|
||||
.activitypub-settings-accordion-trigger:hover {
|
||||
background: #f6f7f7;
|
||||
@ -189,8 +219,8 @@ input.blog-user-identifier {
|
||||
position: relative;
|
||||
display: block;
|
||||
margin-bottom: 40px;
|
||||
background-image: rgb(168,165,175);
|
||||
background-image: linear-gradient(180deg, red, yellow);
|
||||
background-image: rgb(168, 165, 175);
|
||||
background-image: linear-gradient(180deg, #f00, #ff0);
|
||||
background-size: cover;
|
||||
}
|
||||
|
||||
@ -207,66 +237,178 @@ input.blog-user-identifier {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
|
||||
/* stylelint-disable-next-line selector-id-pattern -- WordPress core ID */
|
||||
#dashboard_right_now li a.activitypub-followers::before {
|
||||
content: "\f307";
|
||||
/* stylelint-disable-next-line font-family-no-missing-generic-family-keyword */
|
||||
font-family: dashicons;
|
||||
}
|
||||
|
||||
.repost .dashboard-comment-wrap,
|
||||
.like .dashboard-comment-wrap {
|
||||
.activitypub-comment .dashboard-comment-wrap {
|
||||
padding-inline-start: 63px;
|
||||
}
|
||||
|
||||
.repost .dashboard-comment-wrap .comment-author,
|
||||
.like .dashboard-comment-wrap .comment-author {
|
||||
.activitypub-comment .dashboard-comment-wrap .comment-author {
|
||||
margin-block: 0;
|
||||
}
|
||||
|
||||
.activitypub-settings .welcome-tab-close {
|
||||
position: absolute;
|
||||
top: 0px;
|
||||
right: 0px;
|
||||
font-size: 13px;
|
||||
padding: 0 5px 0 20px;
|
||||
text-decoration: none;
|
||||
z-index: 1;
|
||||
}
|
||||
|
||||
.activitypub-settings .welcome-tab-close::before {
|
||||
position: absolute;
|
||||
top: 0px;
|
||||
left: 0;
|
||||
transition: all .1s ease-in-out;
|
||||
font: normal 16px/20px dashicons;
|
||||
content: '\f335';
|
||||
font-size: 20px;
|
||||
}
|
||||
|
||||
.activitypub-notice .count {
|
||||
display: inline-block;
|
||||
vertical-align: top;
|
||||
box-sizing: border-box;
|
||||
margin: 1px 0 -1px 2px;
|
||||
padding: 0 5px;
|
||||
min-width: 18px;
|
||||
height: 18px;
|
||||
border-radius: 9px;
|
||||
background-color: #dba617;
|
||||
color: #fff;
|
||||
font-size: 11px;
|
||||
line-height: 1.6;
|
||||
text-align: center;
|
||||
z-index: 26;
|
||||
}
|
||||
|
||||
.activitypub-notice .dashicons-warning {
|
||||
color: #dba617;
|
||||
}
|
||||
|
||||
.extra-fields-nav a + a {
|
||||
margin-left: 8px;
|
||||
}
|
||||
|
||||
.rtl .extra-fields-nav a + a {
|
||||
margin-left: auto;
|
||||
margin-right: 8px;
|
||||
}
|
||||
|
||||
.contextual-help-tabs-wrap dt {
|
||||
font-weight: 600;
|
||||
}
|
||||
|
||||
.contextual-help-tabs-wrap .activitypub-block-screenshot {
|
||||
margin: 10px 0;
|
||||
}
|
||||
|
||||
.contextual-help-tabs-wrap .activitypub-block-screenshot img {
|
||||
border: 1px solid #ddd;
|
||||
border-radius: 4px;
|
||||
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
|
||||
height: auto;
|
||||
max-width: 100%;
|
||||
}
|
||||
|
||||
.contextual-help-tabs-wrap .activitypub-block-screenshot figcaption {
|
||||
color: #555;
|
||||
font-style: italic;
|
||||
font-size: 0.9em;
|
||||
margin-top: 5px;
|
||||
}
|
||||
|
||||
/* Blockquote Styles */
|
||||
.contextual-help-tabs-wrap blockquote {
|
||||
border-left: 4px solid #3582c4;
|
||||
background-color: #f6f7f7;
|
||||
padding: 16px 20px;
|
||||
margin: 0 0 20px;
|
||||
}
|
||||
|
||||
.contextual-help-tabs-wrap blockquote p {
|
||||
margin: 0 0 10px;
|
||||
line-height: 1.5;
|
||||
}
|
||||
|
||||
.contextual-help-tabs-wrap blockquote p:last-child {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
|
||||
.contextual-help-tabs-wrap blockquote cite {
|
||||
display: block;
|
||||
font-weight: 600;
|
||||
margin-top: 8px;
|
||||
font-size: 0.9em;
|
||||
color: #50575e;
|
||||
}
|
||||
|
||||
.contextual-help-tabs-wrap blockquote cite::before {
|
||||
content: "—";
|
||||
}
|
||||
|
||||
/* Plugin List Styles */
|
||||
.plugin-list {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 16px;
|
||||
align-items: stretch;
|
||||
}
|
||||
|
||||
.plugin-list .plugin-card {
|
||||
flex: 1 1 300px;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
box-sizing: border-box;
|
||||
border-radius: 4px;
|
||||
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.plugin-list .plugin-card .desc {
|
||||
flex: 1 1 auto;
|
||||
}
|
||||
|
||||
.plugin-list .plugin-action-buttons li {
|
||||
display: inline-block;
|
||||
vertical-align: middle;
|
||||
margin: 0 0 10px 0;
|
||||
}
|
||||
|
||||
.plugin-list .plugin-card .action-links {
|
||||
position: static;
|
||||
margin-left: 148px;
|
||||
width: auto;
|
||||
}
|
||||
|
||||
.plugin-list .plugin-action-buttons {
|
||||
float: none;
|
||||
margin: 1em 0 0;
|
||||
text-align: left;
|
||||
}
|
||||
|
||||
.plugin-list .plugin-action-buttons li .button {
|
||||
margin-right: 20px;
|
||||
}
|
||||
|
||||
.plugin-list .plugin-card h3 {
|
||||
margin-right: 24px;
|
||||
}
|
||||
|
||||
/* stylelint-disable no-descending-specificity */
|
||||
.plugin-list .plugin-card .name,
|
||||
.plugin-list .plugin-card .desc,
|
||||
.plugin-card .desc > p {
|
||||
margin-right: 0;
|
||||
}
|
||||
/* stylelint-enable no-descending-specificity */
|
||||
|
||||
.plugin-list .plugin-card .desc p:first-of-type {
|
||||
margin-top: 0;
|
||||
}
|
||||
|
||||
/* RTL Support for blockquotes */
|
||||
.rtl .contextual-help-tabs-wrap blockquote {
|
||||
border-left: none;
|
||||
border-right: 4px solid #3582c4;
|
||||
padding: 16px 20px;
|
||||
}
|
||||
|
||||
#activitypub-follow-form .highlight {
|
||||
animation: highlight-fade 3s ease-in-out;
|
||||
border-color: #3582c4 !important;
|
||||
box-shadow: 0 0 0 1px #3582c4;
|
||||
}
|
||||
|
||||
@keyframes highlight-fade {
|
||||
|
||||
0% {
|
||||
background-color: #e7f3ff;
|
||||
border-color: #3582c4;
|
||||
box-shadow: 0 0 0 1px #3582c4;
|
||||
}
|
||||
|
||||
100% {
|
||||
background-color: #fff;
|
||||
border-color: #8c8f94;
|
||||
box-shadow: none;
|
||||
}
|
||||
}
|
||||
|
||||
@media screen and (max-width: 782px) {
|
||||
|
||||
.activitypub-settings {
|
||||
margin: 0 22px;
|
||||
}
|
||||
|
||||
.activitypub-settings .row > div {
|
||||
max-width: calc(100% - 36px);
|
||||
width: 100%;
|
||||
}
|
||||
}
|
||||
|
||||
@ -67,13 +67,53 @@
|
||||
.activitypub-embed-content .ap-preview {
|
||||
border: 1px solid #e6e6e6;
|
||||
border-radius: 8px;
|
||||
box-sizing: border-box;
|
||||
display: grid;
|
||||
gap: 2px;
|
||||
grid-template-columns: 1fr 1fr;
|
||||
grid-template-rows: 1fr 1fr;
|
||||
margin: 1em 0 0;
|
||||
min-height: 64px;
|
||||
overflow: hidden;
|
||||
position: relative;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.activitypub-embed-content .ap-preview img {
|
||||
width: 100%;
|
||||
height: auto;
|
||||
border: 0;
|
||||
box-sizing: border-box;
|
||||
display: block;
|
||||
height: 100%;
|
||||
object-fit: cover;
|
||||
overflow: hidden;
|
||||
position: relative;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.activitypub-embed-content .ap-preview video,
|
||||
.activitypub-embed-content .ap-preview audio {
|
||||
max-width: 100%;
|
||||
display: block;
|
||||
grid-column: 1 / span 2;
|
||||
}
|
||||
|
||||
.activitypub-embed-content .ap-preview audio {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.activitypub-embed-content .ap-preview.layout-1 {
|
||||
grid-template-columns: 1fr;
|
||||
grid-template-rows: 1fr;
|
||||
}
|
||||
|
||||
.activitypub-embed-content .ap-preview.layout-2 {
|
||||
aspect-ratio: auto;
|
||||
grid-template-rows: 1fr;
|
||||
height: auto;
|
||||
}
|
||||
|
||||
.activitypub-embed-content .ap-preview.layout-3 > img:first-child {
|
||||
grid-row: span 2;
|
||||
}
|
||||
|
||||
.activitypub-embed-content .ap-preview-text {
|
||||
@ -94,7 +134,9 @@
|
||||
align-items: center;
|
||||
gap: 5px;
|
||||
}
|
||||
|
||||
@media only screen and (max-width: 399px) {
|
||||
|
||||
.activitypub-embed-meta span.ap-stat {
|
||||
display: none !important;
|
||||
}
|
||||
|
||||
@ -0,0 +1,201 @@
|
||||
body {
|
||||
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
|
||||
font-size: 1em;
|
||||
line-height: 1.5;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
main {
|
||||
flex: 1;
|
||||
border: 1px solid #ccc;
|
||||
border-radius: 4px;
|
||||
background-color: #fff;
|
||||
margin: 1em;
|
||||
max-width: 600px;
|
||||
}
|
||||
|
||||
main p {
|
||||
margin-bottom: 1em;
|
||||
}
|
||||
|
||||
hr {
|
||||
background: transparent;
|
||||
border: 0;
|
||||
border-top: 1px solid #ccc;
|
||||
flex: 0 0 auto;
|
||||
margin: 10px 0;
|
||||
}
|
||||
|
||||
.columns {
|
||||
display: flex;
|
||||
flex-direction: row;
|
||||
justify-content: space-between;
|
||||
margin: 0 auto;
|
||||
max-width: 1200px;
|
||||
}
|
||||
|
||||
.sidebar {
|
||||
flex: 1;
|
||||
padding: 1em;
|
||||
max-width: 285px;
|
||||
}
|
||||
|
||||
.sidebar h1 {
|
||||
font-size: 1.5em;
|
||||
margin-bottom: 1em;
|
||||
margin-top: 0;
|
||||
padding: 5px 10px;
|
||||
border-radius: 4px;
|
||||
background-color: #6364ff;
|
||||
color: #fff;
|
||||
display: inline-block;
|
||||
}
|
||||
|
||||
.sidebar ul {
|
||||
list-style-type: none;
|
||||
padding: 0;
|
||||
}
|
||||
|
||||
.sidebar ul li {
|
||||
padding: 5px;
|
||||
color: #ccc;
|
||||
}
|
||||
|
||||
.sidebar input[type="search"],
|
||||
.sidebar textarea {
|
||||
background-color: #f6f6f6;
|
||||
border: 1px solid #ccc;
|
||||
border-radius: 4px;
|
||||
box-sizing: border-box;
|
||||
color: #333;
|
||||
display: block;
|
||||
font-size: 1em;
|
||||
margin-bottom: 1em;
|
||||
padding: 0.5em;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.sidebar > div,
|
||||
main address {
|
||||
align-items: center;
|
||||
display: flex;
|
||||
margin-bottom: 1em;
|
||||
font-style: normal;
|
||||
}
|
||||
|
||||
.name {
|
||||
color: #ccc;
|
||||
font-weight: 700;
|
||||
display: block;
|
||||
}
|
||||
|
||||
.webfinger {
|
||||
color: #ccc;
|
||||
font-size: 0.8em;
|
||||
font-weight: 700;
|
||||
display: block;
|
||||
margin-top: 0.5em;
|
||||
}
|
||||
|
||||
main address .name,
|
||||
main address .webfinger {
|
||||
color: #000;
|
||||
}
|
||||
|
||||
address img,
|
||||
.sidebar .fake-image {
|
||||
border-radius: 8px;
|
||||
margin-right: 1em;
|
||||
width: 48px;
|
||||
height: 48px;
|
||||
background-color: #333;
|
||||
}
|
||||
|
||||
main article {
|
||||
padding: 1em;
|
||||
}
|
||||
|
||||
main .content {
|
||||
margin: 1em 0;
|
||||
font-size: 1.2em;
|
||||
}
|
||||
|
||||
main .content h2 {
|
||||
font-size: 1.2em;
|
||||
}
|
||||
|
||||
main .attachments {
|
||||
border-radius: 8px;
|
||||
box-sizing: border-box;
|
||||
display: grid;
|
||||
gap: 2px;
|
||||
grid-template-columns: 1fr 1fr;
|
||||
grid-template-rows: 1fr 1fr;
|
||||
margin: 1em 0;
|
||||
min-height: 64px;
|
||||
overflow: hidden;
|
||||
position: relative;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
main .attachments.layout-1 {
|
||||
grid-template-columns: 1fr;
|
||||
grid-template-rows: 1fr;
|
||||
}
|
||||
|
||||
main .attachments.layout-2 {
|
||||
aspect-ratio: auto;
|
||||
grid-template-rows: 1fr;
|
||||
height: auto;
|
||||
}
|
||||
|
||||
main .attachments img {
|
||||
border: 0;
|
||||
box-sizing: border-box;
|
||||
display: inline-block;
|
||||
height: 100%;
|
||||
object-fit: cover;
|
||||
overflow: hidden;
|
||||
position: relative;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
main .attachments.layout-3 > img:first-child {
|
||||
grid-row: span 2;
|
||||
}
|
||||
|
||||
main .attachments video,
|
||||
main .attachments audio {
|
||||
max-width: 100%;
|
||||
margin: 1em 0;
|
||||
display: block;
|
||||
grid-column: 1 / span 2;
|
||||
}
|
||||
|
||||
main .attachments audio {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
main .tags a {
|
||||
background-color: #f6f6f6;
|
||||
border-radius: 4px;
|
||||
color: #333;
|
||||
display: inline-block;
|
||||
margin-right: 0.5em;
|
||||
padding: 0.5em;
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
main .tags a:hover {
|
||||
background-color: #e6e6e6;
|
||||
text-decoration: underline;
|
||||
}
|
||||
|
||||
main .column-header {
|
||||
font-size: 1.5em;
|
||||
margin: 0;
|
||||
padding: 5px 10px;
|
||||
border-bottom: 1px solid #ccc;
|
||||
vertical-align: middle;
|
||||
}
|
||||
@ -0,0 +1,310 @@
|
||||
/* ActivityPub Welcome Page Styles */
|
||||
|
||||
.activitypub-welcome-container {
|
||||
max-width: 800px;
|
||||
margin: 40px auto;
|
||||
background-color: #fff;
|
||||
border-radius: 8px;
|
||||
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
|
||||
padding: 30px;
|
||||
}
|
||||
|
||||
/* Header Styles */
|
||||
.activitypub-welcome-header {
|
||||
text-align: center;
|
||||
margin-bottom: 30px;
|
||||
position: relative;
|
||||
}
|
||||
|
||||
/* Progress Circle */
|
||||
.activitypub-progress-circle {
|
||||
position: relative;
|
||||
width: 120px;
|
||||
height: 120px;
|
||||
margin: 0 auto 20px;
|
||||
}
|
||||
|
||||
.activitypub-progress-circle-content {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
font-size: 16px;
|
||||
font-weight: 500;
|
||||
color: #1e1e1e;
|
||||
z-index: 2;
|
||||
}
|
||||
|
||||
.activitypub-progress-ring {
|
||||
transform: rotate(-90deg);
|
||||
overflow: visible;
|
||||
}
|
||||
|
||||
.activitypub-progress-ring-bg {
|
||||
fill: none;
|
||||
stroke: #f0f0f1;
|
||||
stroke-width: 6;
|
||||
}
|
||||
|
||||
.activitypub-progress-ring-circle {
|
||||
fill: none;
|
||||
stroke: #2271b1;
|
||||
stroke-width: 6;
|
||||
stroke-linecap: round;
|
||||
transition: stroke-dashoffset 0.5s ease;
|
||||
}
|
||||
|
||||
.activitypub-welcome-title {
|
||||
font-size: 28px;
|
||||
margin: 20px 0 10px;
|
||||
font-weight: 400;
|
||||
}
|
||||
|
||||
.activitypub-welcome-subtitle {
|
||||
font-size: 16px;
|
||||
color: #646970;
|
||||
margin: 0 0 20px;
|
||||
font-weight: 400;
|
||||
}
|
||||
|
||||
/* Steps Styles */
|
||||
.activitypub-onboarding-step {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
padding: 20px;
|
||||
border-radius: 4px;
|
||||
background-color: #f6f7f7;
|
||||
margin-bottom: 15px;
|
||||
transition: background-color 0.2s ease;
|
||||
}
|
||||
|
||||
.activitypub-onboarding-step:last-child {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
|
||||
.activitypub-onboarding-step:hover {
|
||||
background-color: #f0f0f1;
|
||||
}
|
||||
|
||||
.step-indicator {
|
||||
margin-right: 15px;
|
||||
flex-shrink: 0;
|
||||
}
|
||||
|
||||
.step-icon {
|
||||
width: 24px;
|
||||
height: 24px;
|
||||
font-size: 24px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
.dashicons-warning {
|
||||
color: #dba617;
|
||||
}
|
||||
|
||||
.step-content {
|
||||
flex-grow: 1;
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
align-items: center;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.step-text {
|
||||
flex-grow: 1;
|
||||
}
|
||||
|
||||
.step-text h3 {
|
||||
margin: 0 0 5px;
|
||||
font-size: 16px;
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
.step-text p {
|
||||
margin: 0;
|
||||
color: #646970;
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
.step-action {
|
||||
flex-shrink: 0;
|
||||
margin-left: 20px;
|
||||
}
|
||||
|
||||
.activitypub-step-completed {
|
||||
background-color: #f0f7ee;
|
||||
}
|
||||
|
||||
.activitypub-step-completed:hover {
|
||||
background-color: #e2f1dc;
|
||||
}
|
||||
|
||||
.activitypub-step-completed .step-text h3 {
|
||||
margin: 0;
|
||||
}
|
||||
|
||||
.activitypub-step-completed .step-text h3::after {
|
||||
content: ".";
|
||||
}
|
||||
|
||||
.activitypub-step-completed .step-text p,
|
||||
.activitypub-step-completed .step-action {
|
||||
display: none;
|
||||
}
|
||||
|
||||
.activitypub-step-completed .step-icon {
|
||||
color: #008a20;
|
||||
}
|
||||
|
||||
.step-action .button {
|
||||
min-width: 120px;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
/* Profiles Section */
|
||||
.activitypub-profiles-section {
|
||||
margin-top: 40px;
|
||||
border-top: 1px solid #f0f0f1;
|
||||
padding-top: 30px;
|
||||
}
|
||||
|
||||
.profiles-description {
|
||||
margin-bottom: 20px;
|
||||
font-size: 16px;
|
||||
color: #1e1e1e;
|
||||
}
|
||||
|
||||
.activitypub-profiles-container {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
gap: 20px;
|
||||
margin-bottom: 30px;
|
||||
}
|
||||
|
||||
.activitypub-profile-card {
|
||||
flex: 1;
|
||||
min-width: 300px;
|
||||
background-color: #fff;
|
||||
border: 1px solid #c3c4c7;
|
||||
border-radius: 4px;
|
||||
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
|
||||
}
|
||||
|
||||
.profile-card-header {
|
||||
background-color: #f0f0f1;
|
||||
padding: 15px;
|
||||
border-bottom: 1px solid #c3c4c7;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.profile-icon {
|
||||
margin-right: 10px;
|
||||
}
|
||||
|
||||
.profile-icon .dashicons {
|
||||
font-size: 20px;
|
||||
width: 20px;
|
||||
height: 20px;
|
||||
}
|
||||
|
||||
/* stylelint-disable-next-line no-descending-specificity */
|
||||
.profile-card-header h3 {
|
||||
margin: 0;
|
||||
font-size: 16px;
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
.profile-card-content {
|
||||
padding: 15px;
|
||||
}
|
||||
|
||||
.extra-field {
|
||||
margin-bottom: 15px;
|
||||
}
|
||||
|
||||
.extra-field label {
|
||||
display: block;
|
||||
margin-bottom: 5px;
|
||||
font-weight: 500;
|
||||
font-size: 13px;
|
||||
color: #646970;
|
||||
}
|
||||
|
||||
.extra-field input {
|
||||
width: 100%;
|
||||
padding: 8px;
|
||||
font-size: 13px;
|
||||
background-color: #f6f7f7;
|
||||
border: 1px solid #dcdcde;
|
||||
border-radius: 3px;
|
||||
}
|
||||
|
||||
.profile-description {
|
||||
font-size: 13px;
|
||||
color: #646970;
|
||||
margin: 15px 0;
|
||||
line-height: 1.5;
|
||||
}
|
||||
|
||||
.profile-card-content .button {
|
||||
width: 100%;
|
||||
text-align: center;
|
||||
margin-top: 10px;
|
||||
}
|
||||
|
||||
/* Footer Styles */
|
||||
.activitypub-welcome-footer {
|
||||
margin-top: 30px;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.skip-steps-link {
|
||||
color: #2271b1;
|
||||
text-decoration: none;
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
.skip-steps-link:hover {
|
||||
color: #135e96;
|
||||
text-decoration: underline;
|
||||
}
|
||||
|
||||
/* Responsive Adjustments */
|
||||
@media screen and (max-width: 782px) {
|
||||
|
||||
.activitypub-welcome-container {
|
||||
margin: 20px;
|
||||
padding: 20px;
|
||||
}
|
||||
|
||||
.step-content {
|
||||
flex-direction: column;
|
||||
align-items: flex-start;
|
||||
}
|
||||
|
||||
.step-action {
|
||||
margin-left: 0;
|
||||
margin-top: 15px;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.step-action .button {
|
||||
width: 100%;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.activitypub-profiles-container {
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.activitypub-profile-card {
|
||||
width: 100%;
|
||||
}
|
||||
}
|
||||
BIN
wp-content/plugins/activitypub/assets/img/follow-me.png
Normal file
|
After Width: | Height: | Size: 21 KiB |
BIN
wp-content/plugins/activitypub/assets/img/followers.png
Normal file
|
After Width: | Height: | Size: 27 KiB |
|
Before Width: | Height: | Size: 3.3 KiB After Width: | Height: | Size: 2.7 KiB |
BIN
wp-content/plugins/activitypub/assets/img/reactions.png
Normal file
|
After Width: | Height: | Size: 62 KiB |
BIN
wp-content/plugins/activitypub/assets/img/reply.png
Normal file
|
After Width: | Height: | Size: 47 KiB |
|
Before Width: | Height: | Size: 12 KiB After Width: | Height: | Size: 8.1 KiB |
@ -17,5 +17,4 @@ jQuery( function( $ ) {
|
||||
$( '.activate-now' ).removeClass( 'thickbox open-plugin-details-modal' );
|
||||
}, 1200 );
|
||||
} );
|
||||
|
||||
} );
|
||||
|
||||
@ -0,0 +1,364 @@
|
||||
/**
|
||||
* ActivityPub Connected Applications JavaScript.
|
||||
*
|
||||
* Handles registering OAuth clients, deleting clients, and revoking
|
||||
* OAuth tokens from the user profile, following the WordPress core
|
||||
* Application Passwords UI pattern.
|
||||
*/
|
||||
|
||||
/* global activitypubConnectedApps, jQuery, ClipboardJS */
|
||||
|
||||
( function( $ ) {
|
||||
var $section = $( '#activitypub-connected-apps-section' ),
|
||||
$newAppForm = $section.find( '.create-application-password' ),
|
||||
$newAppFields = $newAppForm.find( '.input' ),
|
||||
$newAppButton = $newAppForm.find( '.button' ),
|
||||
$appsWrapper = $section.find( '#activitypub-registered-apps-wrapper' ),
|
||||
$appsTbody = $section.find( '#activitypub-registered-apps-tbody' ),
|
||||
$tokensWrapper = $section.find( '.activitypub-connected-apps-list-table-wrapper' ),
|
||||
$tokensTbody = $section.find( '#activitypub-connected-apps-tbody' ),
|
||||
$revokeAll = $section.find( '#activitypub-revoke-all-tokens' ),
|
||||
$deleteAll = $section.find( '#activitypub-delete-all-clients' );
|
||||
|
||||
// Register a new application.
|
||||
$newAppButton.on( 'click', function( e ) {
|
||||
e.preventDefault();
|
||||
|
||||
if ( $newAppButton.prop( 'aria-disabled' ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
var $name = $( '#activitypub-new-app-name' );
|
||||
var $redirectUri = $( '#activitypub-new-app-redirect-uri' );
|
||||
|
||||
if ( 0 === $name.val().trim().length ) {
|
||||
$name.trigger( 'focus' );
|
||||
return;
|
||||
}
|
||||
|
||||
if ( 0 === $redirectUri.val().trim().length ) {
|
||||
$redirectUri.trigger( 'focus' );
|
||||
return;
|
||||
}
|
||||
|
||||
clearNotices();
|
||||
$newAppButton.prop( 'aria-disabled', true ).addClass( 'disabled' );
|
||||
|
||||
$.ajax( {
|
||||
url: activitypubConnectedApps.ajaxUrl,
|
||||
method: 'POST',
|
||||
data: {
|
||||
action: 'activitypub_register_oauth_client',
|
||||
name: $name.val().trim(),
|
||||
redirect_uri: $redirectUri.val().trim(),
|
||||
_wpnonce: activitypubConnectedApps.nonce
|
||||
}
|
||||
} ).always( function() {
|
||||
$newAppButton.removeProp( 'aria-disabled' ).removeClass( 'disabled' );
|
||||
} ).done( function( response ) {
|
||||
if ( ! response.success ) {
|
||||
addNotice(
|
||||
response.data && response.data.message ? response.data.message : activitypubConnectedApps.registerError,
|
||||
'error'
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
// Build credential notice (matches core's tmpl-new-application-password).
|
||||
var $notice = $( '<div></div>' )
|
||||
.attr( 'role', 'alert' )
|
||||
.attr( 'tabindex', '-1' )
|
||||
.addClass( 'notice notice-success is-dismissible new-application-password-notice' );
|
||||
|
||||
// Client ID row.
|
||||
var $clientIdRow = $( '<p></p>' ).addClass( 'application-password-display' )
|
||||
.append( $( '<label></label>' ).text( activitypubConnectedApps.clientIdLabel ) )
|
||||
.append( $( '<input>' ).attr( { type: 'text', readonly: 'readonly' } ).addClass( 'code' ).val( response.data.client_id ) )
|
||||
.append(
|
||||
$( '<button>' ).attr( 'type', 'button' ).addClass( 'button copy-button' )
|
||||
.attr( 'data-clipboard-text', response.data.client_id )
|
||||
.text( activitypubConnectedApps.copy )
|
||||
)
|
||||
.append( $( '<span>' ).addClass( 'success hidden' ).attr( 'aria-hidden', 'true' ).text( activitypubConnectedApps.copied ) );
|
||||
|
||||
$notice.append( $clientIdRow );
|
||||
|
||||
// Client Secret row (if present).
|
||||
if ( response.data.client_secret ) {
|
||||
var $secretRow = $( '<p></p>' ).addClass( 'application-password-display' )
|
||||
.append( $( '<label></label>' ).text( activitypubConnectedApps.clientSecretLabel ) )
|
||||
.append( $( '<input>' ).attr( { type: 'text', readonly: 'readonly' } ).addClass( 'code' ).val( response.data.client_secret ) )
|
||||
.append(
|
||||
$( '<button>' ).attr( 'type', 'button' ).addClass( 'button copy-button' )
|
||||
.attr( 'data-clipboard-text', response.data.client_secret )
|
||||
.text( activitypubConnectedApps.copy )
|
||||
)
|
||||
.append( $( '<span>' ).addClass( 'success hidden' ).attr( 'aria-hidden', 'true' ).text( activitypubConnectedApps.copied ) );
|
||||
|
||||
$notice.append( $secretRow );
|
||||
}
|
||||
|
||||
$notice.append( $( '<p></p>' ).text( activitypubConnectedApps.saveWarning ) );
|
||||
|
||||
// Dismiss button (matches core's tmpl-new-application-password).
|
||||
$notice.append(
|
||||
$( '<button>' ).attr( 'type', 'button' ).addClass( 'notice-dismiss' )
|
||||
.append( $( '<span>' ).addClass( 'screen-reader-text' ).text( activitypubConnectedApps.dismiss ) )
|
||||
);
|
||||
|
||||
// Insert after the form (not inside it), same as core.
|
||||
$newAppForm.after( $notice );
|
||||
$notice.trigger( 'focus' );
|
||||
|
||||
// Initialize ClipboardJS for the new notice.
|
||||
if ( 'undefined' !== typeof ClipboardJS ) {
|
||||
new ClipboardJS( '.new-application-password-notice .copy-button' )
|
||||
.on( 'success', function( clipEvent ) {
|
||||
var $btn = $( clipEvent.trigger );
|
||||
$btn.siblings( '.success' ).removeClass( 'hidden' );
|
||||
setTimeout( function() {
|
||||
$btn.siblings( '.success' ).addClass( 'hidden' );
|
||||
}, 3000 );
|
||||
} );
|
||||
}
|
||||
|
||||
// Add the new client to the registered apps table.
|
||||
var $row = $( '<tr>' )
|
||||
.attr( 'data-client-id', response.data.client_id )
|
||||
.append( $( '<td>' ).text( $name.val().trim() ) )
|
||||
.append( $( '<td>' ).text( $redirectUri.val().trim() ) )
|
||||
.append( $( '<td>' ).text( response.data.created ) )
|
||||
.append(
|
||||
$( '<td>' ).append(
|
||||
$( '<button>' )
|
||||
.addClass( 'button delete' )
|
||||
.text( activitypubConnectedApps.deleteLabel )
|
||||
)
|
||||
);
|
||||
|
||||
$appsTbody.prepend( $row );
|
||||
$appsWrapper.show();
|
||||
|
||||
// Clear the form fields.
|
||||
$name.val( '' );
|
||||
$redirectUri.val( '' );
|
||||
} ).fail( function( xhr, textStatus, errorThrown ) {
|
||||
var errorMessage = errorThrown;
|
||||
|
||||
if ( xhr.responseJSON && xhr.responseJSON.message ) {
|
||||
errorMessage = xhr.responseJSON.message;
|
||||
}
|
||||
|
||||
addNotice( errorMessage || activitypubConnectedApps.registerError, 'error' );
|
||||
} );
|
||||
} );
|
||||
|
||||
// Delete a registered client.
|
||||
$appsTbody.on( 'click', '.delete', function( e ) {
|
||||
e.preventDefault();
|
||||
|
||||
if ( ! window.confirm( activitypubConnectedApps.confirmDelete ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
var $button = $( this ),
|
||||
$tr = $button.closest( 'tr' ),
|
||||
clientId = $tr.data( 'client-id' );
|
||||
|
||||
clearNotices();
|
||||
$button.prop( 'disabled', true );
|
||||
|
||||
$.ajax( {
|
||||
url: activitypubConnectedApps.ajaxUrl,
|
||||
method: 'POST',
|
||||
data: {
|
||||
action: 'activitypub_delete_oauth_client',
|
||||
client_id: clientId,
|
||||
_wpnonce: activitypubConnectedApps.nonce
|
||||
}
|
||||
} ).always( function() {
|
||||
$button.prop( 'disabled', false );
|
||||
} ).done( function( response ) {
|
||||
if ( response.success && response.data.deleted ) {
|
||||
if ( 0 === $tr.siblings().length ) {
|
||||
$appsWrapper.hide();
|
||||
}
|
||||
$tr.remove();
|
||||
|
||||
addNotice( activitypubConnectedApps.appDeleted, 'success' ).trigger( 'focus' );
|
||||
}
|
||||
} ).fail( handleErrorResponse );
|
||||
} );
|
||||
|
||||
// Delete all registered clients.
|
||||
$deleteAll.on( 'click', function( e ) {
|
||||
e.preventDefault();
|
||||
|
||||
if ( ! window.confirm( activitypubConnectedApps.confirmDeleteAll ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
var $button = $( this );
|
||||
|
||||
clearNotices();
|
||||
$button.prop( 'disabled', true );
|
||||
|
||||
$.ajax( {
|
||||
url: activitypubConnectedApps.ajaxUrl,
|
||||
method: 'POST',
|
||||
data: {
|
||||
action: 'activitypub_delete_all_oauth_clients',
|
||||
_wpnonce: activitypubConnectedApps.nonce
|
||||
}
|
||||
} ).always( function() {
|
||||
$button.prop( 'disabled', false );
|
||||
} ).done( function( response ) {
|
||||
if ( response.success && response.data.deleted ) {
|
||||
$appsTbody.children().remove();
|
||||
$appsWrapper.hide();
|
||||
|
||||
addNotice( activitypubConnectedApps.allAppsDeleted, 'success' ).trigger( 'focus' );
|
||||
}
|
||||
} ).fail( handleErrorResponse );
|
||||
} );
|
||||
|
||||
// Revoke a single token.
|
||||
$tokensTbody.on( 'click', '.delete', function( e ) {
|
||||
e.preventDefault();
|
||||
|
||||
if ( ! window.confirm( activitypubConnectedApps.confirm ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
var $button = $( this ),
|
||||
$tr = $button.closest( 'tr' ),
|
||||
metaKey = $tr.data( 'meta-key' );
|
||||
|
||||
clearNotices();
|
||||
$button.prop( 'disabled', true );
|
||||
|
||||
$.ajax( {
|
||||
url: activitypubConnectedApps.ajaxUrl,
|
||||
method: 'POST',
|
||||
data: {
|
||||
action: 'activitypub_revoke_oauth_token',
|
||||
meta_key: metaKey,
|
||||
_wpnonce: activitypubConnectedApps.nonce
|
||||
}
|
||||
} ).always( function() {
|
||||
$button.prop( 'disabled', false );
|
||||
} ).done( function( response ) {
|
||||
if ( response.success && response.data.deleted ) {
|
||||
if ( 0 === $tr.siblings().length ) {
|
||||
$tokensWrapper.hide();
|
||||
}
|
||||
$tr.remove();
|
||||
|
||||
addNotice( activitypubConnectedApps.appRevoked, 'success' ).trigger( 'focus' );
|
||||
}
|
||||
} ).fail( handleErrorResponse );
|
||||
} );
|
||||
|
||||
// Revoke all tokens.
|
||||
$revokeAll.on( 'click', function( e ) {
|
||||
e.preventDefault();
|
||||
|
||||
if ( ! window.confirm( activitypubConnectedApps.confirmAll ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
var $button = $( this );
|
||||
|
||||
clearNotices();
|
||||
$button.prop( 'disabled', true );
|
||||
|
||||
$.ajax( {
|
||||
url: activitypubConnectedApps.ajaxUrl,
|
||||
method: 'POST',
|
||||
data: {
|
||||
action: 'activitypub_revoke_all_oauth_tokens',
|
||||
_wpnonce: activitypubConnectedApps.nonce
|
||||
}
|
||||
} ).always( function() {
|
||||
$button.prop( 'disabled', false );
|
||||
} ).done( function( response ) {
|
||||
if ( response.success && response.data.deleted ) {
|
||||
$tokensTbody.children().remove();
|
||||
$section.children( '.new-application-password-notice' ).remove();
|
||||
$tokensWrapper.hide();
|
||||
|
||||
addNotice( activitypubConnectedApps.allAppsRevoked, 'success' ).trigger( 'focus' );
|
||||
}
|
||||
} ).fail( handleErrorResponse );
|
||||
} );
|
||||
|
||||
// Dismiss notices via event delegation on the section (same as core).
|
||||
$section.on( 'click', '.notice-dismiss', function( e ) {
|
||||
e.preventDefault();
|
||||
var $el = $( this ).parent();
|
||||
$el.removeAttr( 'role' );
|
||||
$el.fadeTo( 100, 0, function() {
|
||||
$el.slideUp( 100, function() {
|
||||
$el.remove();
|
||||
$newAppFields.first().trigger( 'focus' );
|
||||
} );
|
||||
} );
|
||||
} );
|
||||
|
||||
// Submit form on Enter key in input fields (same as core).
|
||||
$newAppFields.on( 'keypress', function( e ) {
|
||||
if ( 13 === e.which ) {
|
||||
e.preventDefault();
|
||||
$newAppButton.trigger( 'click' );
|
||||
}
|
||||
} );
|
||||
|
||||
/**
|
||||
* Handles an error response from the AJAX call.
|
||||
*
|
||||
* @param {jqXHR} xhr The XHR object from the ajax call.
|
||||
* @param {string} textStatus The string categorizing the ajax request's status.
|
||||
* @param {string} errorThrown The HTTP status error text.
|
||||
*/
|
||||
function handleErrorResponse( xhr, textStatus, errorThrown ) {
|
||||
var errorMessage = errorThrown;
|
||||
|
||||
if ( xhr.responseJSON && xhr.responseJSON.data && xhr.responseJSON.data.message ) {
|
||||
errorMessage = xhr.responseJSON.data.message;
|
||||
}
|
||||
|
||||
addNotice( errorMessage, 'error' );
|
||||
}
|
||||
|
||||
/**
|
||||
* Displays a notice message in the Connected Applications section.
|
||||
*
|
||||
* @param {string} message The message to display.
|
||||
* @param {string} type The notice type. Either 'success' or 'error'.
|
||||
* @returns {jQuery} The notice element.
|
||||
*/
|
||||
function addNotice( message, type ) {
|
||||
var $notice = $( '<div></div>' )
|
||||
.attr( 'role', 'alert' )
|
||||
.attr( 'tabindex', '-1' )
|
||||
.addClass( 'is-dismissible notice notice-' + type )
|
||||
.append( $( '<p></p>' ).text( message ) )
|
||||
.append(
|
||||
$( '<button></button>' )
|
||||
.attr( 'type', 'button' )
|
||||
.addClass( 'notice-dismiss' )
|
||||
.append( $( '<span></span>' ).addClass( 'screen-reader-text' ).text( activitypubConnectedApps.dismiss ) )
|
||||
);
|
||||
|
||||
$newAppForm.after( $notice );
|
||||
|
||||
return $notice;
|
||||
}
|
||||
|
||||
/**
|
||||
* Clears notice messages from the Connected Applications section.
|
||||
*/
|
||||
function clearNotices() {
|
||||
$( '.notice', $section ).remove();
|
||||
}
|
||||
}( jQuery ) );
|
||||
@ -0,0 +1,129 @@
|
||||
/**
|
||||
* ActivityPub Following List Table Polling.
|
||||
*
|
||||
* Adds polling functionality to the Following list table to check for status updates
|
||||
* of pending follow requests without requiring manual page refresh.
|
||||
*
|
||||
* @package Activitypub
|
||||
*/
|
||||
|
||||
( function ( $ ) {
|
||||
'use strict';
|
||||
|
||||
/**
|
||||
* Following List Table Polling.
|
||||
*/
|
||||
var ActivityPubFollowing = {
|
||||
/**
|
||||
* Initialize the polling functionality.
|
||||
*/
|
||||
init: function () {
|
||||
this.setupHeartbeatListeners();
|
||||
|
||||
// Check every 5 seconds. It'll automatically slow down after 2 mins 30 secs.
|
||||
window.wp.heartbeat.interval( 'fast' );
|
||||
},
|
||||
|
||||
/**
|
||||
* Set up WordPress Heartbeat API listeners.
|
||||
*/
|
||||
setupHeartbeatListeners: function () {
|
||||
// Add our data to the Heartbeat API request.
|
||||
$( document ).on( 'heartbeat-send.activitypub_following', function ( e, data ) {
|
||||
data.activitypub_following_check = {
|
||||
user_id: ActivityPubFollowingSettings.user_id,
|
||||
pending_ids: ActivityPubFollowing.getPendingIds(),
|
||||
};
|
||||
} );
|
||||
|
||||
// Process the Heartbeat API response.
|
||||
$( document ).on( 'heartbeat-tick.activitypub_following', function ( e, data ) {
|
||||
if ( data.activitypub_following ) {
|
||||
ActivityPubFollowing.processUpdates( data.activitypub_following );
|
||||
}
|
||||
} );
|
||||
},
|
||||
|
||||
/**
|
||||
* Get IDs of all pending follow requests currently displayed in the table.
|
||||
*
|
||||
* @return {Array} Array of pending follow request IDs.
|
||||
*/
|
||||
getPendingIds: function () {
|
||||
var pendingIds = [];
|
||||
|
||||
// Find all rows with pending status.
|
||||
$( '.wp-list-table tr.status-pending' ).each( function () {
|
||||
var id = $( this ).attr( 'id' );
|
||||
|
||||
if ( id ) {
|
||||
// Extract the numeric ID from the row ID (e.g., "following-123" -> "123").
|
||||
pendingIds.push( id.replace( /^following-(\d+)$/, '$1' ) );
|
||||
}
|
||||
} );
|
||||
|
||||
return pendingIds;
|
||||
},
|
||||
|
||||
/**
|
||||
* Process updates received from the server.
|
||||
*
|
||||
* @param {Object} response Response data from the server.
|
||||
*/
|
||||
processUpdates: function ( response ) {
|
||||
if ( response.counts ) {
|
||||
// Update the counts in the views navigation.
|
||||
if ( Object.hasOwn( response.counts, 'all' ) ) {
|
||||
$( '.subsubsub .all .count' ).text( '(' + response.counts.all + ')' );
|
||||
}
|
||||
if ( Object.hasOwn( response.counts, 'accepted' ) ) {
|
||||
$( '.subsubsub .accepted .count' ).text( '(' + response.counts.accepted + ')' );
|
||||
}
|
||||
if ( Object.hasOwn( response.counts, 'pending' ) ) {
|
||||
$( '.subsubsub .pending .count' ).text( '(' + response.counts.pending + ')' );
|
||||
|
||||
// Remove heartbeat listeners when there are no more pending follows.
|
||||
if ( 0 === response.counts.pending ) {
|
||||
$( document ).off( 'heartbeat-send.activitypub_following' );
|
||||
$( document ).off( 'heartbeat-tick.activitypub_following' );
|
||||
window.wp.heartbeat.interval( 60 );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! response.updated_items || ! response.updated_items.length ) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Remove any existing notices.
|
||||
$( 'div.notice' ).remove();
|
||||
|
||||
var $listTable = $( '#the-list' );
|
||||
|
||||
// Process each updated item.
|
||||
$.each( response.updated_items, function ( index, item ) {
|
||||
var $row = $( '#following-' + item.id );
|
||||
|
||||
if ( $row.length && item.status === 'accepted' ) {
|
||||
// Remove the row when we're in the "Pending" view.
|
||||
if ( 'pending' === new URLSearchParams( window.location.search ).get( 'status' ) ) {
|
||||
$row.remove();
|
||||
} else {
|
||||
$row.find( 'strong.pending' ).remove();
|
||||
}
|
||||
|
||||
if ( 0 === $listTable.children().length ) {
|
||||
$listTable.append(
|
||||
'<tr class="no-items"><td class="colspanchange" colspan="5">' + response.no_items + '</td></tr>'
|
||||
);
|
||||
}
|
||||
}
|
||||
} );
|
||||
},
|
||||
};
|
||||
|
||||
// Initialize on document ready.
|
||||
$( document ).ready( function () {
|
||||
ActivityPubFollowing.init();
|
||||
} );
|
||||
} )( jQuery );
|
||||
@ -0,0 +1,440 @@
|
||||
/**
|
||||
* ActivityPub Moderation Admin JavaScript
|
||||
*/
|
||||
|
||||
/* global activitypubModerationL10n, jQuery */
|
||||
|
||||
/**
|
||||
* @param {Object} $ - jQuery
|
||||
* @param {Object} wp - WordPress global object
|
||||
* @param {Object} wp.i18n - Internationalization functions
|
||||
* @param {Object} wp.a11y - Accessibility functions
|
||||
* @param {Object} wp.ajax - AJAX functions
|
||||
*/
|
||||
(function( $, wp ) {
|
||||
'use strict';
|
||||
|
||||
var __ = wp.i18n.__;
|
||||
var _n = wp.i18n._n;
|
||||
var sprintf = wp.i18n.sprintf;
|
||||
|
||||
/**
|
||||
* Helper function to show a message using wp.a11y and alert
|
||||
*
|
||||
* @param {string} message - The message to display
|
||||
*/
|
||||
function showMessage( message ) {
|
||||
if ( wp.a11y && wp.a11y.speak ) {
|
||||
wp.a11y.speak( message, 'assertive' );
|
||||
}
|
||||
alert( message );
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper function to validate domain format
|
||||
*
|
||||
* @param {string} domain - The domain to validate
|
||||
* @return {boolean} Whether the domain is valid
|
||||
*/
|
||||
function isValidDomain( domain ) {
|
||||
// Basic domain validation - must contain at least one dot and valid characters
|
||||
var domainRegex = /^[a-zA-Z0-9]([a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(\.[a-zA-Z0-9]([a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$/;
|
||||
return domainRegex.test( domain ) && domain.includes( '.' ) && domain.length > 3;
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper function to check if a term already exists in the UI
|
||||
*
|
||||
* @param {string} type - The type of block (domain or keyword)
|
||||
* @param {string} value - The value to check
|
||||
* @param {string} context - The context (user or site)
|
||||
* @param {number|null} userId - The user ID (for user context)
|
||||
* @return {boolean} Whether the term is already blocked
|
||||
*/
|
||||
function isTermAlreadyBlocked( type, value, context, userId ) {
|
||||
var selector;
|
||||
if ( context === 'user' ) {
|
||||
selector = '.activitypub-user-block-list[data-user-id="' + userId + '"] .remove-user-block-btn[data-type="' + type + '"][data-value="' + value + '"]';
|
||||
} else if ( context === 'site' ) {
|
||||
selector = '.remove-site-block-btn[data-type="' + type + '"][data-value="' + value + '"]';
|
||||
}
|
||||
return $( selector ).length > 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Validate a blocked term value
|
||||
*
|
||||
* @param {string} type - The type of block (domain or keyword)
|
||||
* @param {string} value - The value to validate
|
||||
* @param {string} context - The context (user or site)
|
||||
* @param {number|null} userId - The user ID (for user context)
|
||||
* @return {boolean} Whether the value is valid
|
||||
*/
|
||||
function validateBlockedTerm( type, value, context, userId ) {
|
||||
if ( ! value ) {
|
||||
showMessage( __( 'Please enter a value to block.', 'activitypub' ) );
|
||||
return false;
|
||||
}
|
||||
|
||||
if ( type === 'domain' && ! isValidDomain( value ) ) {
|
||||
showMessage( __( 'Please enter a valid domain (e.g., example.com).', 'activitypub' ) );
|
||||
return false;
|
||||
}
|
||||
|
||||
if ( isTermAlreadyBlocked( type, value, context, userId ) ) {
|
||||
showMessage( __( 'This term is already blocked.', 'activitypub' ) );
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a table row for a blocked term.
|
||||
*
|
||||
* @param {string} type - The type of block (domain or keyword)
|
||||
* @param {string} value - The blocked value
|
||||
* @param {string} context - The context (user or site)
|
||||
* @return {jQuery} The constructed table row
|
||||
*/
|
||||
function createBlockedTermRow( type, value, context ) {
|
||||
var $button = $( '<button>', {
|
||||
type: 'button',
|
||||
'class': 'button button-small remove-' + context + '-block-btn',
|
||||
'data-type': type,
|
||||
'data-value': value,
|
||||
text: __( 'Remove', 'activitypub' )
|
||||
} );
|
||||
|
||||
return $( '<tr>' ).append( $( '<td>' ).text( value ), $( '<td>' ).append( $button ) );
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper function to add a blocked term to the UI
|
||||
*/
|
||||
function addBlockedTermToUI( type, value, context, userId ) {
|
||||
var table;
|
||||
|
||||
if ( context === 'user' ) {
|
||||
// For user moderation, add to the appropriate table
|
||||
var container = $( '.activitypub-user-block-list[data-user-id="' + userId + '"]' );
|
||||
|
||||
table = container.find( '.activitypub-blocked-' + type );
|
||||
if ( table.length === 0 ) {
|
||||
table = $( '<table class="widefat striped activitypub-blocked-' + type + '" role="presentation" style="max-width: 500px; margin: 15px 0;"><tbody></tbody></table>' );
|
||||
container.find( '#new_user_' + type ).closest( '.add-user-block-form' ).before( table );
|
||||
}
|
||||
table.find( 'tbody' ).append( createBlockedTermRow( type, value, context ) );
|
||||
} else if ( context === 'site' ) {
|
||||
// For site moderation, add to the table inside the details element
|
||||
var details = $( '.activitypub-site-block-details[data-type="' + type + '"]' );
|
||||
table = details.find( '.activitypub-site-blocked-' + type );
|
||||
|
||||
if ( table.length === 0 ) {
|
||||
// Create table inside the details element (after summary)
|
||||
table = $( '<table class="widefat striped activitypub-site-blocked-' + type + '" role="presentation"><tbody></tbody></table>' );
|
||||
details.find( 'summary' ).after( table );
|
||||
}
|
||||
|
||||
table.find( 'tbody' ).append( createBlockedTermRow( type, value, context ) );
|
||||
|
||||
updateSiteBlockSummary( type );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper function to update the site block summary count
|
||||
*/
|
||||
function updateSiteBlockSummary( type ) {
|
||||
var details = $( '.activitypub-site-block-details[data-type="' + type + '"]' );
|
||||
var table = details.find( '.activitypub-site-blocked-' + type );
|
||||
var count = table.find( 'tbody tr' ).length || table.find( 'tr' ).length;
|
||||
var summary = details.find( 'summary' );
|
||||
|
||||
if ( count === 0 ) {
|
||||
// Empty state
|
||||
var emptyText = type === 'domain'
|
||||
? __( 'No blocked domains', 'activitypub' )
|
||||
: __( 'No blocked keywords', 'activitypub' );
|
||||
summary.text( emptyText );
|
||||
details.attr( 'open', '' );
|
||||
table.remove();
|
||||
} else {
|
||||
// Has items - use _n for proper pluralization
|
||||
var text = type === 'domain'
|
||||
? _n( '%s blocked domain', '%s blocked domains', count, 'activitypub' )
|
||||
: _n( '%s blocked keyword', '%s blocked keywords', count, 'activitypub' );
|
||||
summary.text( sprintf( text, count ) );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper function to remove a blocked term from the UI
|
||||
*/
|
||||
function removeBlockedTermFromUI( type, value, context ) {
|
||||
// Find and remove the specific blocked term element
|
||||
var selector = '.remove-' + context + '-block-btn[data-type="' + type + '"][data-value="' + value + '"]';
|
||||
var button = $( selector );
|
||||
|
||||
if ( button.length > 0 ) {
|
||||
// Remove the parent table row
|
||||
button.closest( 'tr' ).remove();
|
||||
|
||||
// Update the summary count for site blocks
|
||||
if ( context === 'site' ) {
|
||||
updateSiteBlockSummary( type );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Initialize moderation functionality
|
||||
*/
|
||||
function init() {
|
||||
// User moderation management.
|
||||
initUserModeration();
|
||||
|
||||
// Site moderation management.
|
||||
initSiteModeration();
|
||||
|
||||
// Blocklist subscriptions management.
|
||||
initBlocklistSubscriptions();
|
||||
}
|
||||
|
||||
/**
|
||||
* Initialize user moderation management
|
||||
*/
|
||||
function initUserModeration() {
|
||||
// Function to add user blocked term.
|
||||
function addUserBlockedTerm( type, userId ) {
|
||||
var input = $( '#new_user_' + type );
|
||||
var value = input.val().trim();
|
||||
|
||||
if ( ! validateBlockedTerm( type, value, 'user', userId ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
wp.ajax.post( 'activitypub_moderation_settings', {
|
||||
context: 'user',
|
||||
operation: 'add',
|
||||
user_id: userId,
|
||||
type: type,
|
||||
value: value,
|
||||
_wpnonce: activitypubModerationL10n.nonce
|
||||
}).done( function() {
|
||||
// Clear input and add item to the UI.
|
||||
input.val( '' );
|
||||
addBlockedTermToUI( type, value, 'user', userId );
|
||||
}).fail( function( response ) {
|
||||
var message = response && response.message ? response.message : __( 'Failed to add block.', 'activitypub' );
|
||||
showMessage( message );
|
||||
});
|
||||
}
|
||||
|
||||
// Function to remove user blocked term.
|
||||
function removeUserBlockedTerm( type, value, userId ) {
|
||||
wp.ajax.post( 'activitypub_moderation_settings', {
|
||||
context: 'user',
|
||||
operation: 'remove',
|
||||
user_id: userId,
|
||||
type: type,
|
||||
value: value,
|
||||
_wpnonce: activitypubModerationL10n.nonce
|
||||
}).done( function() {
|
||||
removeBlockedTermFromUI( type, value, 'user' );
|
||||
}).fail( function( response ) {
|
||||
var message = response && response.message ? response.message : __( 'Failed to remove block.', 'activitypub' );
|
||||
showMessage( message );
|
||||
});
|
||||
}
|
||||
|
||||
// Add user block functionality (button click).
|
||||
$( document ).on( 'click', '.add-user-block-btn', function( e ) {
|
||||
e.preventDefault();
|
||||
var type = $( this ).data( 'type' );
|
||||
var userId = $( this ).closest( '.activitypub-user-block-list' ).data( 'user-id' );
|
||||
addUserBlockedTerm( type, userId );
|
||||
});
|
||||
|
||||
// Add user block functionality (Enter key).
|
||||
$( document ).on( 'keypress', '#new_user_domain, #new_user_keyword', function( e ) {
|
||||
if ( e.which === 13 ) { // Enter key.
|
||||
e.preventDefault();
|
||||
var inputId = $( this ).attr( 'id' );
|
||||
var type = inputId.replace( 'new_user_', '' );
|
||||
var userId = $( this ).closest( '.activitypub-user-block-list' ).data( 'user-id' );
|
||||
addUserBlockedTerm( type, userId );
|
||||
}
|
||||
});
|
||||
|
||||
// Remove user block functionality.
|
||||
$( document ).on( 'click', '.remove-user-block-btn', function( e ) {
|
||||
e.preventDefault();
|
||||
var type = $( this ).data( 'type' );
|
||||
var value = $( this ).data( 'value' );
|
||||
var userId = $( this ).closest( '.activitypub-user-block-list' ).data( 'user-id' );
|
||||
removeUserBlockedTerm( type, value, userId );
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Initialize site moderation management
|
||||
*/
|
||||
function initSiteModeration() {
|
||||
// Function to add site blocked term.
|
||||
function addSiteBlockedTerm( type ) {
|
||||
var input = $( '#new_site_' + type );
|
||||
var value = input.val().trim();
|
||||
|
||||
if ( ! validateBlockedTerm( type, value, 'site', null ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
wp.ajax.post( 'activitypub_moderation_settings', {
|
||||
context: 'site',
|
||||
operation: 'add',
|
||||
type: type,
|
||||
value: value,
|
||||
_wpnonce: activitypubModerationL10n.nonce
|
||||
}).done( function() {
|
||||
// Clear input and add item to the UI.
|
||||
input.val( '' );
|
||||
addBlockedTermToUI( type, value, 'site' );
|
||||
}).fail( function( response ) {
|
||||
var message = response && response.message ? response.message : __( 'Failed to add block.', 'activitypub' );
|
||||
showMessage( message );
|
||||
});
|
||||
}
|
||||
|
||||
// Function to remove site blocked term.
|
||||
function removeSiteBlockedTerm( type, value ) {
|
||||
wp.ajax.post( 'activitypub_moderation_settings', {
|
||||
context: 'site',
|
||||
operation: 'remove',
|
||||
type: type,
|
||||
value: value,
|
||||
_wpnonce: activitypubModerationL10n.nonce
|
||||
}).done( function() {
|
||||
removeBlockedTermFromUI( type, value, 'site' );
|
||||
}).fail( function( response ) {
|
||||
var message = response && response.message ? response.message : __( 'Failed to remove block.', 'activitypub' );
|
||||
showMessage( message );
|
||||
});
|
||||
}
|
||||
|
||||
// Add site block functionality (button click).
|
||||
$( document ).on( 'click', '.add-site-block-btn', function( e ) {
|
||||
e.preventDefault();
|
||||
var type = $( this ).data( 'type' );
|
||||
addSiteBlockedTerm( type );
|
||||
});
|
||||
|
||||
// Add site block functionality (Enter key).
|
||||
$( document ).on( 'keypress', '#new_site_domain, #new_site_keyword', function( e ) {
|
||||
if ( e.which === 13 ) { // Enter key.
|
||||
e.preventDefault();
|
||||
var inputId = $( this ).attr( 'id' );
|
||||
var type = inputId.replace( 'new_site_', '' );
|
||||
addSiteBlockedTerm( type );
|
||||
}
|
||||
});
|
||||
|
||||
// Remove site block functionality.
|
||||
$( document ).on( 'click', '.remove-site-block-btn', function( e ) {
|
||||
e.preventDefault();
|
||||
var type = $( this ).data( 'type' );
|
||||
var value = $( this ).data( 'value' );
|
||||
removeSiteBlockedTerm( type, value );
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Initialize blocklist subscriptions management
|
||||
*/
|
||||
function initBlocklistSubscriptions() {
|
||||
// Function to add a blocklist subscription.
|
||||
function addBlocklistSubscription( url ) {
|
||||
if ( ! url ) {
|
||||
var message = activitypubModerationL10n.enterUrl || 'Please enter a URL.';
|
||||
if ( wp.a11y && wp.a11y.speak ) {
|
||||
wp.a11y.speak( message, 'assertive' );
|
||||
}
|
||||
alert( message );
|
||||
return;
|
||||
}
|
||||
|
||||
// Disable the button while processing.
|
||||
var button = $( '.add-blocklist-subscription-btn' );
|
||||
button.prop( 'disabled', true );
|
||||
|
||||
wp.ajax.post( 'activitypub_blocklist_subscription', {
|
||||
operation: 'add',
|
||||
url: url,
|
||||
_wpnonce: activitypubModerationL10n.nonce
|
||||
}).done( function() {
|
||||
// Reload the page to show the updated list.
|
||||
window.location.reload();
|
||||
}).fail( function( response ) {
|
||||
var message = response && response.message ? response.message : activitypubModerationL10n.subscriptionFailed || 'Failed to add subscription.';
|
||||
if ( wp.a11y && wp.a11y.speak ) {
|
||||
wp.a11y.speak( message, 'assertive' );
|
||||
}
|
||||
alert( message );
|
||||
button.prop( 'disabled', false );
|
||||
});
|
||||
}
|
||||
|
||||
// Function to remove a blocklist subscription.
|
||||
function removeBlocklistSubscription( url ) {
|
||||
wp.ajax.post( 'activitypub_blocklist_subscription', {
|
||||
operation: 'remove',
|
||||
url: url,
|
||||
_wpnonce: activitypubModerationL10n.nonce
|
||||
}).done( function() {
|
||||
// Remove the row from the UI.
|
||||
$( '.remove-blocklist-subscription-btn' ).filter( function() {
|
||||
return $( this ).data( 'url' ) === url;
|
||||
}).closest( 'tr' ).remove();
|
||||
|
||||
// If no more subscriptions, remove the table.
|
||||
var table = $( '.activitypub-blocklist-subscriptions table' );
|
||||
if ( table.find( 'tbody tr' ).length === 0 ) {
|
||||
table.remove();
|
||||
}
|
||||
}).fail( function( response ) {
|
||||
var message = response && response.message ? response.message : activitypubModerationL10n.removeSubscriptionFailed || 'Failed to remove subscription.';
|
||||
if ( wp.a11y && wp.a11y.speak ) {
|
||||
wp.a11y.speak( message, 'assertive' );
|
||||
}
|
||||
alert( message );
|
||||
});
|
||||
}
|
||||
|
||||
// Add subscription functionality (button click).
|
||||
$( document ).on( 'click', '.add-blocklist-subscription-btn', function( e ) {
|
||||
e.preventDefault();
|
||||
var url = $( this ).data( 'url' ) || $( '#new_blocklist_subscription_url' ).val().trim();
|
||||
addBlocklistSubscription( url );
|
||||
});
|
||||
|
||||
// Add subscription functionality (Enter key).
|
||||
$( document ).on( 'keypress', '#new_blocklist_subscription_url', function( e ) {
|
||||
if ( e.which === 13 ) { // Enter key.
|
||||
e.preventDefault();
|
||||
var url = $( this ).val().trim();
|
||||
addBlocklistSubscription( url );
|
||||
}
|
||||
});
|
||||
|
||||
// Remove subscription functionality.
|
||||
$( document ).on( 'click', '.remove-blocklist-subscription-btn', function( e ) {
|
||||
e.preventDefault();
|
||||
var url = $( this ).data( 'url' );
|
||||
removeBlocklistSubscription( url );
|
||||
});
|
||||
}
|
||||
|
||||
// Initialize when document is ready.
|
||||
$( document ).ready( init );
|
||||
|
||||
})( jQuery, wp );
|
||||
11
wp-content/plugins/activitypub/build/app/block.json
Normal file
@ -0,0 +1,11 @@
|
||||
{
|
||||
"$schema": "https://schemas.wp.org/trunk/block.json",
|
||||
"apiVersion": 3,
|
||||
"name": "activitypub/app",
|
||||
"title": "ActivityPub App",
|
||||
"category": "widgets",
|
||||
"description": "Manage ActivityPub settings, followers, and federation from the WordPress admin.",
|
||||
"icon": "smartphone",
|
||||
"textdomain": "activitypub",
|
||||
"editorScript": "file:./index.js"
|
||||
}
|
||||
@ -0,0 +1 @@
|
||||
"use strict";(globalThis.webpackChunkwordpress_activitypub=globalThis.webpackChunkwordpress_activitypub||[]).push([[843],{4831(s,t,p){p.r(t),p.d(t,{route:()=>r});const r={inspector:({search:s})=>!!s.postId}}}]);
|
||||
1
wp-content/plugins/activitypub/build/app/index.asset.php
Normal file
@ -0,0 +1 @@
|
||||
<?php return array('dependencies' => array('react', 'react-dom', 'react-jsx-runtime', 'wp-commands', 'wp-components', 'wp-compose', 'wp-core-data', 'wp-data', 'wp-data-controls', 'wp-date', 'wp-dom', 'wp-element', 'wp-hooks', 'wp-html-entities', 'wp-i18n', 'wp-keyboard-shortcuts', 'wp-keycodes', 'wp-notices', 'wp-preferences', 'wp-primitives', 'wp-url'), 'version' => '3b7e2c6f3b9b959e939d');
|
||||
4
wp-content/plugins/activitypub/build/app/index.js
Normal file
10
wp-content/plugins/activitypub/build/app/style-index-rtl.css
Normal file
@ -0,0 +1,10 @@
|
||||
.themed-surface{background:#fff;border-radius:0;display:flex;flex:1;flex-direction:column;min-height:0;overflow:hidden}@media(min-width:782px){.themed-surface{border-radius:var(--wpds-border-radius-large,8px)}}
|
||||
.panel{display:flex;flex:1;flex-direction:column;margin:0;min-height:0}@media(min-width:782px){.panel{margin:var(--wpds-spacing-40,16px) 0 var(--wpds-spacing-40,16px) var(--wpds-spacing-40,16px)}}
|
||||
.site-icon{align-items:center;display:flex;justify-content:center}.site-icon__image{aspect-ratio:1/1;background:#333;height:100%;-o-object-fit:cover;object-fit:cover;width:100%}.site-icon__icon{fill:currentcolor}
|
||||
.site-hub{align-items:center;display:flex;gap:var(--wpds-spacing-20,8px);height:var(--wpds-spacing-160,64px);justify-content:space-between;margin-left:var(--wpds-spacing-30,12px)}.site-hub__actions{flex-shrink:0}.site-hub__icon-container{flex-shrink:0;height:var(--wpds-spacing-160,64px);width:var(--wpds-spacing-160,64px)}.site-hub__icon-container.has-transparent-background .site-hub__icon-container{background:transparent}.site-hub__icon-button.components-button{align-items:center;background:#1e1e1e;border-radius:0;color:#fff;display:flex;height:var(--wpds-spacing-160,64px);justify-content:center;overflow:hidden;padding:0;position:relative;view-transition-name:toggle;width:var(--wpds-spacing-160,64px)}.site-hub__icon-button.components-button:active,.site-hub__icon-button.components-button:hover{color:#fff}.site-hub__icon-button.components-button:focus,.site-hub__icon-button.components-button:focus-visible{box-shadow:0 0 0 3px #1e1e1e,0 0 0 6px var(--wp-admin-theme-color);outline:4px solid transparent;outline-offset:4px}.site-hub__icon-button.components-button:before{border-radius:var(--wpds-border-radius-large,8px);bottom:calc(var(--wpds-spacing-20, 8px) + var(--wpds-border-width-focus, 1px));box-shadow:none;content:"";display:block;right:calc(var(--wpds-spacing-40, 16px) + var(--wpds-border-width-focus, 1px));position:absolute;left:calc(var(--wpds-spacing-20, 8px) + var(--wpds-border-width-focus, 1px));top:calc(var(--wpds-spacing-20, 8px) + var(--wpds-border-width-focus, 1px))}@media not (prefers-reduced-motion){.site-hub__icon-button.components-button:before{transition:box-shadow .1s ease}}.site-hub__icon-button.components-button .site-icon{height:var(--wpds-spacing-160,64px);width:var(--wpds-spacing-160,64px)}.site-hub__icon-button.components-button .site-icon__icon{height:100%;width:100%}.site-hub__title .components-button{color:#e0e0e0;display:block;flex-grow:1;font-size:var(--wpds-font-size-medium,15px);font-weight:var(--wpds-font-weight-medium,500);margin-right:-4px;overflow:hidden;padding-left:var(--wpds-spacing-40,16px);position:relative;text-decoration:none;text-overflow:ellipsis;white-space:nowrap}.site-hub__title .components-button:active,.site-hub__title .components-button:focus,.site-hub__title .components-button:hover{color:#e0e0e0}.site-hub__title .components-button:focus{box-shadow:none;outline:none}.site-hub__title .components-button:focus-visible{box-shadow:0 0 0 var(--wp-admin-border-width-focus) #1e1e1e,0 0 0 calc(var(--wp-admin-border-width-focus)*2) var(--wp-admin-theme-color);outline:2px solid transparent;outline-offset:2px}.site-hub__title .components-button:after{content:"↗";font-weight:400;opacity:0;position:absolute;left:0}@media not (prefers-reduced-motion){.site-hub__title .components-button:after{transition:opacity .1s linear}}.site-hub__title .components-button:active:after,.site-hub__title .components-button:focus:after,.site-hub__title .components-button:hover:after{opacity:1}.site-hub__command-button{color:#e0e0e0}.site-hub__command-button:active svg,.site-hub__command-button:hover svg{fill:#f0f0f0}.site-hub-mobile{align-items:center;background:#1e1e1e;border-bottom:1px solid hsla(0,0%,100%,.1);display:flex;flex-shrink:0;height:56px;justify-content:space-between;padding:0 var(--wpds-spacing-30,12px)}.site-hub-mobile__title{color:#fff;font-size:var(--wpds-font-size-medium,16px);font-weight:var(--wpds-font-weight-medium,500)}.site-hub-mobile__button.components-button{color:#e0e0e0}.site-hub-mobile__button.components-button:focus:not(:disabled),.site-hub-mobile__button.components-button:hover:not(:disabled){color:#fff}.site-hub-mobile__button.components-button:focus-visible{box-shadow:0 0 0 var(--wp-admin-border-width-focus) var(--wp-admin-theme-color);outline:2px solid transparent}
|
||||
.activitypub-avatar{background-color:#f0f0f0;border-radius:50%;flex-shrink:0;height:var(--wpds-spacing-120,48px);-o-object-fit:cover;object-fit:cover;width:var(--wpds-spacing-120,48px)}
|
||||
.actor-switcher{align-items:center;color:#e0e0e0;display:flex;min-width:0;padding-right:2px;text-decoration:none;transition:color .2s ease}.actor-switcher:hover:not(:disabled){color:#fff}.actor-switcher__avatar{border-radius:50%;flex-shrink:0;height:32px;width:32px}.actor-switcher__name{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
|
||||
.popular-tags{background:transparent!important;border-bottom:none!important;border-right:none!important;border-left:none!important;border-top:1px solid hsla(0,0%,100%,.1);box-shadow:none!important;padding:0 var(--wpds-spacing-30,12px) var(--wpds-spacing-30,12px)}.popular-tags__title{color:#949494;font-size:11px;font-weight:500;letter-spacing:.5px;margin:var(--wpds-spacing-30,12px) 0 var(--wpds-spacing-20,8px) 0;padding:0 var(--wpds-spacing-20,8px);text-transform:uppercase}.popular-tags__loading{color:#ccc;font-size:13px;padding:var(--wpds-spacing-20,8px)}.popular-tags .components-menu-group{background:transparent!important;border:none!important;box-shadow:none!important;margin:0;padding:0}.popular-tags .menu-item{align-items:center;color:#e0e0e0;display:flex;gap:var(--wpds-spacing-20,8px)}.popular-tags .menu-item:hover{background-color:hsla(0,0%,100%,.1);color:#fff}.popular-tags .menu-item.is-pressed{background-color:hsla(0,0%,100%,.15);color:#fff}.popular-tags .menu-item svg{flex-shrink:0}
|
||||
.sidebar{background-color:#1e1e1e;color:#ccc;display:flex;flex:1;flex-direction:column}.sidebar .nav{flex:1;overflow-y:auto;padding:0 var(--wpds-spacing-30,12px)}.sidebar .sidebar-navigation__icon-title{background:#1e1e1e;margin-bottom:var(--wpds-spacing-20,8px);padding-bottom:var(--wpds-spacing-20,8px);padding-top:var(--wpds-spacing-120,48px);position:sticky;top:0}.sidebar .sidebar-navigation__button{color:#e0e0e0;flex-shrink:0}.sidebar .sidebar-navigation__button:focus:not(:disabled){box-shadow:none;outline:none}.sidebar .sidebar-navigation__button:focus-visible:not(:disabled){box-shadow:0 0 0 var(--wpds-border-width-focus,1.5px) var(--wp-admin-theme-color);outline:3px solid transparent}.sidebar .sidebar-navigation__button:focus,.sidebar .sidebar-navigation__button:focus-visible,.sidebar .sidebar-navigation__button:hover:not(:disabled,[aria-disabled=true]),.sidebar .sidebar-navigation__button:not(:disabled,[aria-disabled=true]):active,.sidebar .sidebar-navigation__button[aria-expanded=true]{color:#f0f0f0}.sidebar .sidebar-navigation__title{color:#e0e0e0;flex-grow:1;line-height:var(--wpds-spacing-80,32px);overflow-wrap:break-word}.sidebar .sidebar-description{margin:0 0 var(--wpds-spacing-80,32px) 0;padding:0 var(--wpds-spacing-40,16px)}.sidebar .menu-item{color:#e0e0e0;transition:none!important}.sidebar .menu-item:focus{box-shadow:none!important;outline:none!important}.sidebar .menu-item:focus-visible{box-shadow:0 0 0 var(--wpds-border-width-focus,1.5px) var(--wp-admin-theme-color)!important;outline:3px solid transparent!important}.sidebar .menu-item:hover{color:#fff!important}.sidebar .menu-item:active,.sidebar .menu-item:hover{background-color:hsla(0,0%,100%,.1)!important}.sidebar .menu-item.is-selected,.sidebar .menu-item[aria-pressed=true]{background-color:hsla(0,0%,100%,.15)!important;color:#fff!important}.sidebar .menu-item.is-selected:active,.sidebar .menu-item.is-selected:hover,.sidebar .menu-item[aria-pressed=true]:active,.sidebar .menu-item[aria-pressed=true]:hover{background-color:hsla(0,0%,100%,.15)!important}.sidebar .menu-item svg{margin-left:var(--wpds-spacing-10,8px)}.sidebar .object-types-menu{margin-top:var(--wpds-spacing-10,4px)}.sidebar .object-types{padding:var(--wpds-spacing-20,8px) var(--wpds-spacing-30,12px)}.sidebar .object-types__loading{color:#ccc;font-size:13px}.sidebar .footer{border-top:1px solid hsla(0,0%,100%,.1);padding:var(--wpds-spacing-40,16px)}.sidebar .footer>.components-h-stack{padding:2px 0}.sidebar .footer .footer-settings-button{color:#e0e0e0;flex-shrink:0}.sidebar .footer .footer-settings-button:hover:not(:disabled){color:#fff}
|
||||
#activitypub-app-root>div{height:100%}.app-layout{background-color:#1e1e1e;display:flex;flex-direction:column;height:100%;isolation:isolate;overflow:hidden;width:100%}.sidebar-backdrop{background-color:rgba(0,0,0,.5);cursor:pointer;inset:0;position:fixed;z-index:100002}.app-content{background-color:#1e1e1e;display:flex;flex-grow:1;height:100%;overflow:hidden;width:100%}.app-content.is-mobile,.sidebar-region{flex-direction:column}.sidebar-region{display:flex;flex-shrink:0;height:100%;width:300px}.sidebar-region.is-mobile{background-color:#1e1e1e;bottom:0;box-shadow:-2px 0 8px rgba(0,0,0,.3);right:0;max-width:85vw;position:fixed;top:0;width:300px;z-index:100003}.inspector-region,.stage-region{bottom:0;display:flex;flex-direction:column;height:calc(100vh - 56px);right:0;overflow:hidden;position:fixed;left:0;top:56px;width:100vw}@media(min-width:782px){.inspector-region,.stage-region{bottom:auto;height:auto;right:auto;position:static;left:auto;top:auto;width:auto}}.stage-region{z-index:2}@media(min-width:782px){.stage-region{flex:1 1 auto;min-width:0;z-index:auto}}.inspector-region{z-index:3}@media(min-width:782px){.inspector-region{flex:0 0 var(--sw-inspector-width,380px);z-index:auto}}.components-snackbar-list{bottom:20px;right:20px;position:fixed;z-index:100000}@media(max-width:782px){.components-snackbar-list{bottom:10px;right:10px;left:10px}}
|
||||
:root{--sw-sidebar-width:300px;--sw-inspector-width:50%}.activitypub-app-layout{bottom:0;right:0;position:fixed;left:0;top:0}#wpfooter{display:none}
|
||||
10
wp-content/plugins/activitypub/build/app/style-index.css
Normal file
@ -0,0 +1,10 @@
|
||||
.themed-surface{background:#fff;border-radius:0;display:flex;flex:1;flex-direction:column;min-height:0;overflow:hidden}@media(min-width:782px){.themed-surface{border-radius:var(--wpds-border-radius-large,8px)}}
|
||||
.panel{display:flex;flex:1;flex-direction:column;margin:0;min-height:0}@media(min-width:782px){.panel{margin:var(--wpds-spacing-40,16px) var(--wpds-spacing-40,16px) var(--wpds-spacing-40,16px) 0}}
|
||||
.site-icon{align-items:center;display:flex;justify-content:center}.site-icon__image{aspect-ratio:1/1;background:#333;height:100%;-o-object-fit:cover;object-fit:cover;width:100%}.site-icon__icon{fill:currentcolor}
|
||||
.site-hub{align-items:center;display:flex;gap:var(--wpds-spacing-20,8px);height:var(--wpds-spacing-160,64px);justify-content:space-between;margin-right:var(--wpds-spacing-30,12px)}.site-hub__actions{flex-shrink:0}.site-hub__icon-container{flex-shrink:0;height:var(--wpds-spacing-160,64px);width:var(--wpds-spacing-160,64px)}.site-hub__icon-container.has-transparent-background .site-hub__icon-container{background:transparent}.site-hub__icon-button.components-button{align-items:center;background:#1e1e1e;border-radius:0;color:#fff;display:flex;height:var(--wpds-spacing-160,64px);justify-content:center;overflow:hidden;padding:0;position:relative;view-transition-name:toggle;width:var(--wpds-spacing-160,64px)}.site-hub__icon-button.components-button:active,.site-hub__icon-button.components-button:hover{color:#fff}.site-hub__icon-button.components-button:focus,.site-hub__icon-button.components-button:focus-visible{box-shadow:0 0 0 3px #1e1e1e,0 0 0 6px var(--wp-admin-theme-color);outline:4px solid transparent;outline-offset:4px}.site-hub__icon-button.components-button:before{border-radius:var(--wpds-border-radius-large,8px);bottom:calc(var(--wpds-spacing-20, 8px) + var(--wpds-border-width-focus, 1px));box-shadow:none;content:"";display:block;left:calc(var(--wpds-spacing-40, 16px) + var(--wpds-border-width-focus, 1px));position:absolute;right:calc(var(--wpds-spacing-20, 8px) + var(--wpds-border-width-focus, 1px));top:calc(var(--wpds-spacing-20, 8px) + var(--wpds-border-width-focus, 1px))}@media not (prefers-reduced-motion){.site-hub__icon-button.components-button:before{transition:box-shadow .1s ease}}.site-hub__icon-button.components-button .site-icon{height:var(--wpds-spacing-160,64px);width:var(--wpds-spacing-160,64px)}.site-hub__icon-button.components-button .site-icon__icon{height:100%;width:100%}.site-hub__title .components-button{color:#e0e0e0;display:block;flex-grow:1;font-size:var(--wpds-font-size-medium,15px);font-weight:var(--wpds-font-weight-medium,500);margin-left:-4px;overflow:hidden;padding-right:var(--wpds-spacing-40,16px);position:relative;text-decoration:none;text-overflow:ellipsis;white-space:nowrap}.site-hub__title .components-button:active,.site-hub__title .components-button:focus,.site-hub__title .components-button:hover{color:#e0e0e0}.site-hub__title .components-button:focus{box-shadow:none;outline:none}.site-hub__title .components-button:focus-visible{box-shadow:0 0 0 var(--wp-admin-border-width-focus) #1e1e1e,0 0 0 calc(var(--wp-admin-border-width-focus)*2) var(--wp-admin-theme-color);outline:2px solid transparent;outline-offset:2px}.site-hub__title .components-button:after{content:"↗";font-weight:400;opacity:0;position:absolute;right:0}@media not (prefers-reduced-motion){.site-hub__title .components-button:after{transition:opacity .1s linear}}.site-hub__title .components-button:active:after,.site-hub__title .components-button:focus:after,.site-hub__title .components-button:hover:after{opacity:1}.site-hub__command-button{color:#e0e0e0}.site-hub__command-button:active svg,.site-hub__command-button:hover svg{fill:#f0f0f0}.site-hub-mobile{align-items:center;background:#1e1e1e;border-bottom:1px solid hsla(0,0%,100%,.1);display:flex;flex-shrink:0;height:56px;justify-content:space-between;padding:0 var(--wpds-spacing-30,12px)}.site-hub-mobile__title{color:#fff;font-size:var(--wpds-font-size-medium,16px);font-weight:var(--wpds-font-weight-medium,500)}.site-hub-mobile__button.components-button{color:#e0e0e0}.site-hub-mobile__button.components-button:focus:not(:disabled),.site-hub-mobile__button.components-button:hover:not(:disabled){color:#fff}.site-hub-mobile__button.components-button:focus-visible{box-shadow:0 0 0 var(--wp-admin-border-width-focus) var(--wp-admin-theme-color);outline:2px solid transparent}
|
||||
.activitypub-avatar{background-color:#f0f0f0;border-radius:50%;flex-shrink:0;height:var(--wpds-spacing-120,48px);-o-object-fit:cover;object-fit:cover;width:var(--wpds-spacing-120,48px)}
|
||||
.actor-switcher{align-items:center;color:#e0e0e0;display:flex;min-width:0;padding-left:2px;text-decoration:none;transition:color .2s ease}.actor-switcher:hover:not(:disabled){color:#fff}.actor-switcher__avatar{border-radius:50%;flex-shrink:0;height:32px;width:32px}.actor-switcher__name{overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
|
||||
.popular-tags{background:transparent!important;border-bottom:none!important;border-left:none!important;border-right:none!important;border-top:1px solid hsla(0,0%,100%,.1);box-shadow:none!important;padding:0 var(--wpds-spacing-30,12px) var(--wpds-spacing-30,12px)}.popular-tags__title{color:#949494;font-size:11px;font-weight:500;letter-spacing:.5px;margin:var(--wpds-spacing-30,12px) 0 var(--wpds-spacing-20,8px) 0;padding:0 var(--wpds-spacing-20,8px);text-transform:uppercase}.popular-tags__loading{color:#ccc;font-size:13px;padding:var(--wpds-spacing-20,8px)}.popular-tags .components-menu-group{background:transparent!important;border:none!important;box-shadow:none!important;margin:0;padding:0}.popular-tags .menu-item{align-items:center;color:#e0e0e0;display:flex;gap:var(--wpds-spacing-20,8px)}.popular-tags .menu-item:hover{background-color:hsla(0,0%,100%,.1);color:#fff}.popular-tags .menu-item.is-pressed{background-color:hsla(0,0%,100%,.15);color:#fff}.popular-tags .menu-item svg{flex-shrink:0}
|
||||
.sidebar{background-color:#1e1e1e;color:#ccc;display:flex;flex:1;flex-direction:column}.sidebar .nav{flex:1;overflow-y:auto;padding:0 var(--wpds-spacing-30,12px)}.sidebar .sidebar-navigation__icon-title{background:#1e1e1e;margin-bottom:var(--wpds-spacing-20,8px);padding-bottom:var(--wpds-spacing-20,8px);padding-top:var(--wpds-spacing-120,48px);position:sticky;top:0}.sidebar .sidebar-navigation__button{color:#e0e0e0;flex-shrink:0}.sidebar .sidebar-navigation__button:focus:not(:disabled){box-shadow:none;outline:none}.sidebar .sidebar-navigation__button:focus-visible:not(:disabled){box-shadow:0 0 0 var(--wpds-border-width-focus,1.5px) var(--wp-admin-theme-color);outline:3px solid transparent}.sidebar .sidebar-navigation__button:focus,.sidebar .sidebar-navigation__button:focus-visible,.sidebar .sidebar-navigation__button:hover:not(:disabled,[aria-disabled=true]),.sidebar .sidebar-navigation__button:not(:disabled,[aria-disabled=true]):active,.sidebar .sidebar-navigation__button[aria-expanded=true]{color:#f0f0f0}.sidebar .sidebar-navigation__title{color:#e0e0e0;flex-grow:1;line-height:var(--wpds-spacing-80,32px);overflow-wrap:break-word}.sidebar .sidebar-description{margin:0 0 var(--wpds-spacing-80,32px) 0;padding:0 var(--wpds-spacing-40,16px)}.sidebar .menu-item{color:#e0e0e0;transition:none!important}.sidebar .menu-item:focus{box-shadow:none!important;outline:none!important}.sidebar .menu-item:focus-visible{box-shadow:0 0 0 var(--wpds-border-width-focus,1.5px) var(--wp-admin-theme-color)!important;outline:3px solid transparent!important}.sidebar .menu-item:hover{color:#fff!important}.sidebar .menu-item:active,.sidebar .menu-item:hover{background-color:hsla(0,0%,100%,.1)!important}.sidebar .menu-item.is-selected,.sidebar .menu-item[aria-pressed=true]{background-color:hsla(0,0%,100%,.15)!important;color:#fff!important}.sidebar .menu-item.is-selected:active,.sidebar .menu-item.is-selected:hover,.sidebar .menu-item[aria-pressed=true]:active,.sidebar .menu-item[aria-pressed=true]:hover{background-color:hsla(0,0%,100%,.15)!important}.sidebar .menu-item svg{margin-right:var(--wpds-spacing-10,8px)}.sidebar .object-types-menu{margin-top:var(--wpds-spacing-10,4px)}.sidebar .object-types{padding:var(--wpds-spacing-20,8px) var(--wpds-spacing-30,12px)}.sidebar .object-types__loading{color:#ccc;font-size:13px}.sidebar .footer{border-top:1px solid hsla(0,0%,100%,.1);padding:var(--wpds-spacing-40,16px)}.sidebar .footer>.components-h-stack{padding:2px 0}.sidebar .footer .footer-settings-button{color:#e0e0e0;flex-shrink:0}.sidebar .footer .footer-settings-button:hover:not(:disabled){color:#fff}
|
||||
#activitypub-app-root>div{height:100%}.app-layout{background-color:#1e1e1e;display:flex;flex-direction:column;height:100%;isolation:isolate;overflow:hidden;width:100%}.sidebar-backdrop{background-color:rgba(0,0,0,.5);cursor:pointer;inset:0;position:fixed;z-index:100002}.app-content{background-color:#1e1e1e;display:flex;flex-grow:1;height:100%;overflow:hidden;width:100%}.app-content.is-mobile,.sidebar-region{flex-direction:column}.sidebar-region{display:flex;flex-shrink:0;height:100%;width:300px}.sidebar-region.is-mobile{background-color:#1e1e1e;bottom:0;box-shadow:2px 0 8px rgba(0,0,0,.3);left:0;max-width:85vw;position:fixed;top:0;width:300px;z-index:100003}.inspector-region,.stage-region{bottom:0;display:flex;flex-direction:column;height:calc(100vh - 56px);left:0;overflow:hidden;position:fixed;right:0;top:56px;width:100vw}@media(min-width:782px){.inspector-region,.stage-region{bottom:auto;height:auto;left:auto;position:static;right:auto;top:auto;width:auto}}.stage-region{z-index:2}@media(min-width:782px){.stage-region{flex:1 1 auto;min-width:0;z-index:auto}}.inspector-region{z-index:3}@media(min-width:782px){.inspector-region{flex:0 0 var(--sw-inspector-width,380px);z-index:auto}}.components-snackbar-list{bottom:20px;left:20px;position:fixed;z-index:100000}@media(max-width:782px){.components-snackbar-list{bottom:10px;left:10px;right:10px}}
|
||||
:root{--sw-sidebar-width:300px;--sw-inspector-width:50%}.activitypub-app-layout{bottom:0;left:0;position:fixed;right:0;top:0}#wpfooter{display:none}
|
||||
@ -0,0 +1 @@
|
||||
<?php return array('dependencies' => array(), 'version' => '574f62b8c694f733dfd4');
|
||||
@ -0,0 +1 @@
|
||||
<?php return array('dependencies' => array(), 'version' => '753d276871f3f5b80028');
|
||||
176
wp-content/plugins/activitypub/build/app/vendors.js
Normal file
@ -0,0 +1,11 @@
|
||||
{
|
||||
"$schema": "https://schemas.wp.org/trunk/block.json",
|
||||
"apiVersion": 3,
|
||||
"name": "activitypub/command-palette",
|
||||
"title": "ActivityPub Command Palette",
|
||||
"category": "widgets",
|
||||
"description": "Registers ActivityPub commands for the WordPress Command Palette.",
|
||||
"icon": "search",
|
||||
"textdomain": "activitypub",
|
||||
"editorScript": "file:./plugin.js"
|
||||
}
|
||||
@ -0,0 +1 @@
|
||||
<?php return array('dependencies' => array('react', 'react-jsx-runtime', 'wp-core-data', 'wp-data', 'wp-element', 'wp-i18n'), 'version' => '3383a2857e2bafe956a9');
|
||||
@ -0,0 +1,3 @@
|
||||
(()=>{"use strict";window.React;const e=window.wp.i18n,t=window.wp.data,i=window.wp.coreData,a=window.wp.element,o=window.ReactJSXRuntime,l=(0,o.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 80 80",width:"24",height:"24",children:[(0,o.jsx)("rect",{width:"80",height:"80",fill:"#f1027e"}),(0,o.jsx)("path",{d:"M42.9 19.8L72 36.6v6.7L42.9 60.2v-6.7L66.2 40 42.9 26.6v-6.8z",fillRule:"evenodd",clipRule:"evenodd",fill:"white"}),(0,o.jsx)("path",{d:"M42.9 33.3L54.5 40l-11.6 6.7V33.3z",fillRule:"evenodd",clipRule:"evenodd",fill:"white"}),(0,o.jsx)("path",{d:"M37.1 19.8L8 36.6v6.7l23.3-13.4v26.9l5.8 3.4V19.8zM25.5 40L13.8 46.7l11.6 6.7V40z",fillRule:"evenodd",clipRule:"evenodd",fill:"white"})]}),{actorMode:c,canManageOptions:n,followingEnabled:s}=window.activitypubCommandPalette||{followingEnabled:!1,actorMode:"actor",canManageOptions:!1},r=e=>{try{(0,t.dispatch)("core/commands").registerCommand(e)}catch(t){console.error("Failed to register ActivityPub command:",e.name,t)}},d=e=>{try{(0,t.dispatch)("core/commands").registerCommandLoader(e)}catch(t){console.error("Failed to register ActivityPub command loader:",e.name,t)}};"actor"!==c&&"actor_blog"!==c||(r({name:"activitypub/navigate-user-followers",label:(0,e.__)("ActivityPub: View Your Followers","activitypub"),icon:l,callback:({close:e})=>{document.location.href="users.php?page=activitypub-followers-list",e()}}),s&&r({name:"activitypub/navigate-user-following",label:(0,e.__)("ActivityPub: View Who You Follow","activitypub"),icon:l,callback:({close:e})=>{document.location.href="users.php?page=activitypub-following-list",e()}}),r({name:"activitypub/navigate-extra-fields",label:(0,e.__)("ActivityPub: View Extra Fields","activitypub"),icon:l,callback:({close:e})=>{document.location.href="edit.php?post_type=ap_extrafield",e()}}),r({name:"activitypub/add-extra-field",label:(0,e.__)("ActivityPub: Add New Extra Field","activitypub"),icon:l,callback:({close:e})=>{document.location.href="post-new.php?post_type=ap_extrafield",e()}}),d({name:"activitypub/extra-fields-search",hook:({search:o})=>{const{records:c,isLoading:n}=(0,t.useSelect)(e=>{const t=e(i.store),a=t.getCurrentUser(),l={search:o||void 0,per_page:10,orderby:o?"relevance":"date",status:"any",author:a?.id};return{records:t.getEntityRecords("postType","ap_extrafield",l),isLoading:!t.hasFinishedResolution("getEntityRecords",["postType","ap_extrafield",l])}},[o]);return{commands:(0,a.useMemo)(()=>(c??[]).slice(0,10).map(t=>{const i=(t.title?.rendered||(0,e.__)("(no title)","activitypub")).replace(/["'`]/g,"");return{name:`activitypub/edit-extra-field/${t.id}`,label:(0,e.sprintf)(/* translators: %s: Extra field title */ /* translators: %s: Extra field title */
|
||||
(0,e.__)("ActivityPub: Edit - %s","activitypub"),i),icon:l,callback:({close:e})=>{document.location=`post.php?post=${t.id}&action=edit`,e()}}}),[c]),isLoading:n}}}),r({name:"activitypub/navigate-blocked-actors",label:(0,e.__)("ActivityPub: View Blocked Actors","activitypub"),icon:l,callback:({close:e})=>{document.location.href="users.php?page=activitypub-blocked-actors-list",e()}})),!n||"blog"!==c&&"actor_blog"!==c||(r({name:"activitypub/navigate-blog-followers",label:(0,e.__)("ActivityPub: View Blog Followers","activitypub"),icon:l,callback:({close:e})=>{document.location.href="options-general.php?page=activitypub&tab=followers",e()}}),s&&r({name:"activitypub/navigate-blog-following",label:(0,e.__)("ActivityPub: View Blog Following","activitypub"),icon:l,callback:({close:e})=>{document.location.href="options-general.php?page=activitypub&tab=following",e()}}),r({name:"activitypub/navigate-settings",label:(0,e.__)("ActivityPub: View Settings","activitypub"),icon:l,callback:({close:e})=>{document.location.href="options-general.php?page=activitypub&tab=settings",e()}}),r({name:"activitypub/navigate-blog-extra-fields",label:(0,e.__)("ActivityPub: View Blog Extra Fields","activitypub"),icon:l,callback:({close:e})=>{document.location.href="edit.php?post_type=ap_extrafield_blog",e()}}),r({name:"activitypub/add-blog-extra-field",label:(0,e.__)("ActivityPub: Add New Blog Extra Field","activitypub"),icon:l,callback:({close:e})=>{document.location.href="post-new.php?post_type=ap_extrafield_blog",e()}}),d({name:"activitypub/blog-extra-fields-search",hook:({search:o})=>{const{records:c,isLoading:n}=(0,t.useSelect)(e=>{const t=e(i.store),a={search:o||void 0,per_page:10,orderby:o?"relevance":"date",status:"any"};return{records:t.getEntityRecords("postType","ap_extrafield_blog",a),isLoading:!t.hasFinishedResolution("getEntityRecords",["postType","ap_extrafield_blog",a])}},[o]);return{commands:(0,a.useMemo)(()=>(c??[]).slice(0,10).map(t=>{const i=(t.title?.rendered||(0,e.__)("(no title)","activitypub")).replace(/["'`]/g,"");return{name:`activitypub/edit-blog-extra-field/${t.id}`,label:(0,e.sprintf)(/* translators: %s: Blog extra field title */ /* translators: %s: Blog extra field title */
|
||||
(0,e.__)("ActivityPub: Edit Blog - %s","activitypub"),i),icon:l,callback:({close:e})=>{document.location=`post.php?post=${t.id}&action=edit`,e()}}}),[c]),isLoading:n}}}))})();
|
||||
@ -0,0 +1,10 @@
|
||||
{
|
||||
"$schema": "https://schemas.wp.org/trunk/block.json",
|
||||
"apiVersion": 3,
|
||||
"name": "activitypub/dashboard-stats",
|
||||
"title": "ActivityPub Dashboard Stats",
|
||||
"category": "widgets",
|
||||
"description": "ActivityPub statistics dashboard widget",
|
||||
"textdomain": "activitypub",
|
||||
"editorScript": "file:./index.js"
|
||||
}
|
||||
@ -0,0 +1 @@
|
||||
<?php return array('dependencies' => array('react-jsx-runtime', 'wp-api-fetch', 'wp-components', 'wp-compose', 'wp-core-data', 'wp-data', 'wp-element', 'wp-i18n'), 'version' => '018706e2c6de03ab04d1');
|
||||
@ -0,0 +1 @@
|
||||
.activitypub-stats-widget{margin:-6px -12px -12px}.activitypub-stats-widget h3{color:var(--wp-admin--color--text,#1d2327);font-size:14px;font-weight:400;margin:0 12px 8px;padding:0}.activitypub-stats-loading{display:flex;justify-content:center;padding:24px 12px}.activitypub-stats-empty{color:var(--wp-admin--color--text-secondary,#646970);margin:0;padding:24px 12px;text-align:center}.activitypub-stats-highlights{padding:0 12px 11px}.activitypub-stats-highlights h3{margin-right:0;margin-left:0}.activitypub-stats-highlights ul{display:inline-block;margin:0;width:100%}.activitypub-stats-highlights li{float:right;margin-bottom:10px;width:50%}.activitypub-stats-highlights li a:before,.activitypub-stats-highlights li>span:not(.stat-change):before{color:var(--wp-admin--color--text-secondary,#646970);content:"";display:inline-block;font:400 20px/1 dashicons,sans-serif;padding:0 0 0 5px;position:relative;vertical-align:top;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;text-decoration:none}.activitypub-stats-highlights .activitypub-followers-count a:before{content:""}.activitypub-stats-highlights .activitypub-posts-count a:before{content:""}.activitypub-stats-highlights .activitypub-like-count a:before,.activitypub-stats-highlights .activitypub-likes-count a:before{content:""}.activitypub-stats-highlights .activitypub-repost-count a:before,.activitypub-stats-highlights .activitypub-reposts-count a:before{content:""}.activitypub-stats-highlights .activitypub-comment-count a:before,.activitypub-stats-highlights .activitypub-comments-count a:before{content:""}.activitypub-stats-highlights .stat-change{color:var(--wp-admin--color--text-secondary,#646970)}.activitypub-stats-highlights .stat-change.positive{color:var(--wp-admin--color--success,#00a32a)}.activitypub-stats-highlights .stat-change.negative{color:var(--wp-admin--color--error,#d63638)}.activitypub-stats-sub{background:var(--wp-admin--color--body-background,#f6f7f7);border-top:1px solid var(--wp-admin--color--border,#f0f0f1);padding:10px 12px 6px}.activitypub-stats-sub,.activitypub-stats-sub h3{color:var(--wp-admin--color--text-secondary,#50575e)}.activitypub-stats-sub h3{margin-right:0;margin-left:0}.activitypub-stats-chart{border-top:1px solid var(--wp-admin--color--border,#f0f0f1);padding:8px 12px 4px}.activitypub-stats-chart h3{margin-right:0;margin-left:0}.activitypub-chart-container{background:var(--wp-admin--color--body-background,#f6f7f7);border-bottom:1px solid var(--wp-admin--color--border,#f0f0f1);margin:0 -12px 6px;padding:8px 12px}.activitypub-line-chart{display:block;height:auto;width:100%}.activitypub-line-chart .chart-label{fill:var(--wp-admin--color--text-secondary,#646970);font-size:10px}.activitypub-chart-legend{border-top:1px solid var(--wp-admin--color--border,#f0f0f1);display:flex;flex-wrap:wrap;gap:12px;margin-top:8px;padding-top:8px}.activitypub-legend-item{align-items:center;color:var(--wp-admin--color--text-secondary,#50575e);display:flex;font-size:11px}.activitypub-legend-item .legend-color{border-radius:1px;height:3px;margin-left:6px;width:12px}.activitypub-stats-multiplicator{border-top:1px solid var(--wp-admin--color--border,#f0f0f1);padding:12px}.activitypub-stats-multiplicator h3{margin-bottom:4px;margin-right:0;margin-left:0}.activitypub-stats-multiplicator p{color:var(--wp-admin--color--text-secondary,#50575e);margin:0}.activitypub-stats-multiplicator a{font-weight:600;text-decoration:none}.activitypub-stats-top-posts{border-top:1px solid var(--wp-admin--color--border,#f0f0f1);padding:12px}.activitypub-stats-top-posts h3{margin-right:0;margin-left:0}.activitypub-stats-top-posts ul{list-style:none;margin:0;padding:0}.activitypub-stats-top-posts li{align-items:center;color:var(--wp-admin--color--text-secondary,#50575e);display:flex;justify-content:space-between;padding:4px 0}.activitypub-stats-top-posts a{flex:1;margin-left:10px;overflow:hidden;text-decoration:none;text-overflow:ellipsis;white-space:nowrap}.activitypub-stats-top-posts .engagement-count{color:var(--wp-admin--color--text-secondary,#646970);font-size:12px;white-space:nowrap}@media screen and (max-width:782px){.activitypub-stats-highlights li{width:100%}}
|
||||
@ -0,0 +1 @@
|
||||
.activitypub-stats-widget{margin:-6px -12px -12px}.activitypub-stats-widget h3{color:var(--wp-admin--color--text,#1d2327);font-size:14px;font-weight:400;margin:0 12px 8px;padding:0}.activitypub-stats-loading{display:flex;justify-content:center;padding:24px 12px}.activitypub-stats-empty{color:var(--wp-admin--color--text-secondary,#646970);margin:0;padding:24px 12px;text-align:center}.activitypub-stats-highlights{padding:0 12px 11px}.activitypub-stats-highlights h3{margin-left:0;margin-right:0}.activitypub-stats-highlights ul{display:inline-block;margin:0;width:100%}.activitypub-stats-highlights li{float:left;margin-bottom:10px;width:50%}.activitypub-stats-highlights li a:before,.activitypub-stats-highlights li>span:not(.stat-change):before{color:var(--wp-admin--color--text-secondary,#646970);content:"";display:inline-block;font:400 20px/1 dashicons,sans-serif;padding:0 5px 0 0;position:relative;vertical-align:top;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;text-decoration:none}.activitypub-stats-highlights .activitypub-followers-count a:before{content:""}.activitypub-stats-highlights .activitypub-posts-count a:before{content:""}.activitypub-stats-highlights .activitypub-like-count a:before,.activitypub-stats-highlights .activitypub-likes-count a:before{content:""}.activitypub-stats-highlights .activitypub-repost-count a:before,.activitypub-stats-highlights .activitypub-reposts-count a:before{content:""}.activitypub-stats-highlights .activitypub-comment-count a:before,.activitypub-stats-highlights .activitypub-comments-count a:before{content:""}.activitypub-stats-highlights .stat-change{color:var(--wp-admin--color--text-secondary,#646970)}.activitypub-stats-highlights .stat-change.positive{color:var(--wp-admin--color--success,#00a32a)}.activitypub-stats-highlights .stat-change.negative{color:var(--wp-admin--color--error,#d63638)}.activitypub-stats-sub{background:var(--wp-admin--color--body-background,#f6f7f7);border-top:1px solid var(--wp-admin--color--border,#f0f0f1);padding:10px 12px 6px}.activitypub-stats-sub,.activitypub-stats-sub h3{color:var(--wp-admin--color--text-secondary,#50575e)}.activitypub-stats-sub h3{margin-left:0;margin-right:0}.activitypub-stats-chart{border-top:1px solid var(--wp-admin--color--border,#f0f0f1);padding:8px 12px 4px}.activitypub-stats-chart h3{margin-left:0;margin-right:0}.activitypub-chart-container{background:var(--wp-admin--color--body-background,#f6f7f7);border-bottom:1px solid var(--wp-admin--color--border,#f0f0f1);margin:0 -12px 6px;padding:8px 12px}.activitypub-line-chart{display:block;height:auto;width:100%}.activitypub-line-chart .chart-label{fill:var(--wp-admin--color--text-secondary,#646970);font-size:10px}.activitypub-chart-legend{border-top:1px solid var(--wp-admin--color--border,#f0f0f1);display:flex;flex-wrap:wrap;gap:12px;margin-top:8px;padding-top:8px}.activitypub-legend-item{align-items:center;color:var(--wp-admin--color--text-secondary,#50575e);display:flex;font-size:11px}.activitypub-legend-item .legend-color{border-radius:1px;height:3px;margin-right:6px;width:12px}.activitypub-stats-multiplicator{border-top:1px solid var(--wp-admin--color--border,#f0f0f1);padding:12px}.activitypub-stats-multiplicator h3{margin-bottom:4px;margin-left:0;margin-right:0}.activitypub-stats-multiplicator p{color:var(--wp-admin--color--text-secondary,#50575e);margin:0}.activitypub-stats-multiplicator a{font-weight:600;text-decoration:none}.activitypub-stats-top-posts{border-top:1px solid var(--wp-admin--color--border,#f0f0f1);padding:12px}.activitypub-stats-top-posts h3{margin-left:0;margin-right:0}.activitypub-stats-top-posts ul{list-style:none;margin:0;padding:0}.activitypub-stats-top-posts li{align-items:center;color:var(--wp-admin--color--text-secondary,#50575e);display:flex;justify-content:space-between;padding:4px 0}.activitypub-stats-top-posts a{flex:1;margin-right:10px;overflow:hidden;text-decoration:none;text-overflow:ellipsis;white-space:nowrap}.activitypub-stats-top-posts .engagement-count{color:var(--wp-admin--color--text-secondary,#646970);font-size:12px;white-space:nowrap}@media screen and (max-width:782px){.activitypub-stats-highlights li{width:100%}}
|
||||
@ -1,8 +1,11 @@
|
||||
{
|
||||
"name": "editor-plugin",
|
||||
"title": "Editor Plugin: not a block, but block.json is very useful.",
|
||||
"$schema": "https://schemas.wp.org/trunk/block.json",
|
||||
"apiVersion": 3,
|
||||
"name": "activitypub/editor-plugin",
|
||||
"title": "ActivityPub Editor Integration",
|
||||
"category": "widgets",
|
||||
"icon": "admin-comments",
|
||||
"keywords": [],
|
||||
"description": "Adds ActivityPub settings and controls to the WordPress block editor.",
|
||||
"icon": "screenoptions",
|
||||
"textdomain": "activitypub",
|
||||
"editorScript": "file:./plugin.js"
|
||||
}
|
||||
@ -1 +1 @@
|
||||
<?php return array('dependencies' => array('react', 'wp-components', 'wp-core-data', 'wp-data', 'wp-editor', 'wp-element', 'wp-i18n', 'wp-plugins', 'wp-primitives', 'wp-url'), 'version' => '293b8e75ac7a589c5096');
|
||||
<?php return array('dependencies' => array('react-jsx-runtime', 'wp-components', 'wp-core-data', 'wp-data', 'wp-edit-post', 'wp-editor', 'wp-element', 'wp-i18n', 'wp-plugins', 'wp-primitives', 'wp-url'), 'version' => 'a87121d13575d9f2d232');
|
||||
|
||||
78
wp-content/plugins/activitypub/build/extra-fields/block.json
Normal file
@ -0,0 +1,78 @@
|
||||
{
|
||||
"$schema": "https://schemas.wp.org/trunk/block.json",
|
||||
"name": "activitypub/extra-fields",
|
||||
"apiVersion": 3,
|
||||
"version": "8.3.0",
|
||||
"title": "Fediverse Extra Fields",
|
||||
"category": "widgets",
|
||||
"description": "Display extra fields from Fediverse user profiles.",
|
||||
"textdomain": "activitypub",
|
||||
"icon": "list-view",
|
||||
"keywords": [
|
||||
"fediverse",
|
||||
"activitypub",
|
||||
"profile",
|
||||
"fields"
|
||||
],
|
||||
"supports": {
|
||||
"html": false,
|
||||
"align": [
|
||||
"wide",
|
||||
"full"
|
||||
],
|
||||
"color": {
|
||||
"gradients": true,
|
||||
"link": true,
|
||||
"__experimentalDefaultControls": {
|
||||
"background": true,
|
||||
"text": true,
|
||||
"link": true
|
||||
}
|
||||
},
|
||||
"__experimentalBorder": {
|
||||
"radius": true,
|
||||
"width": true,
|
||||
"color": true,
|
||||
"style": true
|
||||
},
|
||||
"shadow": true,
|
||||
"typography": {
|
||||
"fontSize": true,
|
||||
"__experimentalDefaultControls": {
|
||||
"fontSize": true
|
||||
}
|
||||
}
|
||||
},
|
||||
"styles": [
|
||||
{
|
||||
"name": "compact",
|
||||
"label": "Compact",
|
||||
"isDefault": true
|
||||
},
|
||||
{
|
||||
"name": "stacked",
|
||||
"label": "Stacked"
|
||||
},
|
||||
{
|
||||
"name": "cards",
|
||||
"label": "Cards"
|
||||
}
|
||||
],
|
||||
"attributes": {
|
||||
"selectedUser": {
|
||||
"type": "string",
|
||||
"default": "blog"
|
||||
},
|
||||
"maxFields": {
|
||||
"type": "number",
|
||||
"default": 0
|
||||
}
|
||||
},
|
||||
"usesContext": [
|
||||
"postType",
|
||||
"postId"
|
||||
],
|
||||
"editorScript": "file:./index.js",
|
||||
"style": "file:./style-index.css",
|
||||
"render": "file:./render.php"
|
||||
}
|
||||
@ -0,0 +1 @@
|
||||
<?php return array('dependencies' => array('react-jsx-runtime', 'wp-api-fetch', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-data', 'wp-dom', 'wp-element', 'wp-i18n'), 'version' => 'c22c615ef19e14341c00');
|
||||
@ -0,0 +1,2 @@
|
||||
(()=>{"use strict";var e,t={6755(e,t,i){const r=window.wp.blocks,s=window.wp.i18n,n=window.wp.blockEditor,l=window.wp.components,a=window.wp.dom,o=window.wp.data,c=window.wp.element,d=window.wp.apiFetch;var u=i.n(d);function p(){return window._activityPubOptions||{}}const h=window.ReactJSXRuntime,b=JSON.parse('{"UU":"activitypub/extra-fields"}');(0,r.registerBlockType)(b.UU,{edit:function({attributes:e,setAttributes:t,context:i}){const{selectedUser:r,maxFields:d}=e,{postId:b,postType:v}=i??{},[y,f]=(0,c.useState)([]),[x,g]=(0,c.useState)(!1),[w,m]=(0,c.useState)(null),_=(0,o.useSelect)(e=>{if(b&&v){const t=e("core");if(t){const e=t.getEditedEntityRecord?.("postType",v,b)??null;if(e?.author)return e.author;const i=t.getEntityRecord?.("postType",v,b)??null;if(i?.author)return i.author}}const t=e("core/editor");return t&&t.getCurrentPostAttribute?t.getCurrentPostAttribute("author"):null},[b,v]),j="blog"===r?0:"inherit"===r?_||null:r,{namespace:k="activitypub/1.0",profileUrls:U={}}=p(),F="blog"===r?U.blog:U.user,C=(0,n.useBlockProps)({className:"activitypub-extra-fields-block-wrapper"}),O=function({withInherit:e=!1}){const{enabled:t,namespace:i}=p(),[r,n]=(0,c.useState)(!1),{fetchedUsers:l,isLoadingUsers:a}=(0,o.useSelect)(e=>{const{getUsers:i,getIsResolving:r}=e("core");return{fetchedUsers:t?.users?i({capabilities:"activitypub"}):null,isLoadingUsers:!!t?.users&&r("getUsers",[{capabilities:"activitypub"}])}},[t?.users]),d=(0,o.useSelect)(e=>l||a?null:e("core").getCurrentUser(),[l,a]);(0,c.useEffect)(()=>{!l&&!a&&d&&i&&u()({path:`/${i}/actors/${d.id}`,method:"HEAD",headers:{Accept:"application/activity+json"},parse:!1}).then(()=>n(!0)).catch(()=>n(!1))},[l,a,d,i]);const h=(0,c.useMemo)(()=>l||(d&&r?[{id:d.id,name:d.name}]:[]),[l,d,r]);return(0,c.useMemo)(()=>{if(!h.length)return[];const i=[];return t?.blog&&l&&i.push({label:(0,s.__)("Blog","activitypub"),value:"blog"}),e&&t?.users&&l&&i.push({label:(0,s.__)("Dynamic User","activitypub"),value:"inherit"}),h.reduce((e,t)=>(e.push({label:t.name,value:`${t.id}`}),e),i)},[h,t?.blog,t?.users,l,e])}({withInherit:!0});(0,c.useEffect)(()=>{null!==j?(g(!0),m(null),u()({path:`/${k}/actors/${j}`,headers:{Accept:"application/activity+json"}}).then(e=>{const t=(e.attachment||[]).filter(e=>"PropertyValue"===e.type);f(t),g(!1)}).catch(e=>{m(e.message),g(!1)})):f([])},[j,k]);const E=d>0?y.slice(0,d):y,S=(()=>{const t=e.className?.includes("is-style-cards");if(!t)return{};const i=e.style||{},r=e.backgroundColor,s=i.color?.background;return r?{backgroundColor:`var(--wp--preset--color--${r})`}:s?{backgroundColor:s}:{}})(),P=(0,h.jsx)(n.InspectorControls,{children:(0,h.jsxs)(l.PanelBody,{title:(0,s.__)("Settings","activitypub"),initialOpen:!0,children:[(0,h.jsx)(l.SelectControl,{label:(0,s.__)("User","activitypub"),value:r,options:O,onChange:e=>t({selectedUser:e})}),(0,h.jsx)(l.RangeControl,{label:(0,s.__)("Maximum Fields","activitypub"),value:d,onChange:e=>t({maxFields:e}),min:0,max:20,help:(0,s.__)("Limit the number of fields displayed. 0 = show all.","activitypub")})]})});return"inherit"!==r||_?x?(0,h.jsx)("div",{...C,children:(0,h.jsx)(l.Placeholder,{label:(0,s.__)("Fediverse Extra Fields","activitypub"),children:(0,h.jsx)(l.Spinner,{})})}):w?(0,h.jsx)("div",{...C,children:(0,h.jsx)(l.Placeholder,{label:(0,s.__)("Fediverse Extra Fields","activitypub"),children:(0,h.jsx)("p",{children:(0,s.sprintf)(/* translators: %s: Error message */ /* translators: %s: Error message */
|
||||
(0,s.__)("Error loading extra fields: %s","activitypub"),w)})})}):0===E.length?(0,h.jsxs)(h.Fragment,{children:[P,(0,h.jsx)("div",{...C,children:(0,h.jsx)(l.Placeholder,{label:(0,s.__)("Fediverse Extra Fields","activitypub"),children:(0,h.jsxs)("p",{children:[(0,s.__)("No extra fields found.","activitypub")," ",F&&(0,h.jsx)(l.Button,{variant:"link",onClick:()=>{window.location.href=F},children:(0,s.__)("Add fields in your profile settings","activitypub")})]})})})]}):(0,h.jsxs)(h.Fragment,{children:[P,(0,h.jsx)("div",{...C,children:(0,h.jsx)("dl",{className:"activitypub-extra-fields",children:E.map(e=>(0,h.jsxs)("div",{className:"activitypub-extra-field",style:S,children:[(0,h.jsx)("dt",{children:e.name}),(0,h.jsx)("dd",{dangerouslySetInnerHTML:{__html:(0,a.safeHTML)(e.value)}})]},`${e.name}-${e.value}`))})})]}):(0,h.jsxs)(h.Fragment,{children:[P,(0,h.jsx)("div",{...C,children:(0,h.jsx)(l.Placeholder,{label:(0,s.__)("Fediverse Extra Fields","activitypub"),children:(0,h.jsx)("p",{children:(0,s.__)("This block will display extra fields based on the post author when published.","activitypub")})})})]})},save:()=>null})}},i={};function r(e){var s=i[e];if(void 0!==s)return s.exports;var n=i[e]={exports:{}};return t[e](n,n.exports,r),n.exports}r.m=t,e=[],r.O=(t,i,s,n)=>{if(!i){var l=1/0;for(d=0;d<e.length;d++){for(var[i,s,n]=e[d],a=!0,o=0;o<i.length;o++)(!1&n||l>=n)&&Object.keys(r.O).every(e=>r.O[e](i[o]))?i.splice(o--,1):(a=!1,n<l&&(l=n));if(a){e.splice(d--,1);var c=s();void 0!==c&&(t=c)}}return t}n=n||0;for(var d=e.length;d>0&&e[d-1][2]>n;d--)e[d]=e[d-1];e[d]=[i,s,n]},r.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return r.d(t,{a:t}),t},r.d=(e,t)=>{for(var i in t)r.o(t,i)&&!r.o(e,i)&&Object.defineProperty(e,i,{enumerable:!0,get:t[i]})},r.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),(()=>{var e={914:0,678:0};r.O.j=t=>0===e[t];var t=(t,i)=>{var s,n,[l,a,o]=i,c=0;if(l.some(t=>0!==e[t])){for(s in a)r.o(a,s)&&(r.m[s]=a[s]);if(o)var d=o(r)}for(t&&t(i);c<l.length;c++)n=l[c],r.o(e,n)&&e[n]&&e[n][0](),e[n]=0;return r.O(d)},i=globalThis.webpackChunkwordpress_activitypub=globalThis.webpackChunkwordpress_activitypub||[];i.forEach(t.bind(null,0)),i.push=t.bind(null,i.push.bind(i))})();var s=r.O(void 0,[678],()=>r(6755));s=r.O(s)})();
|
||||
81
wp-content/plugins/activitypub/build/extra-fields/render.php
Normal file
@ -0,0 +1,81 @@
|
||||
<?php
|
||||
/**
|
||||
* Server-side rendering for the Extra Fields block.
|
||||
*
|
||||
* @package Activitypub
|
||||
*/
|
||||
|
||||
use Activitypub\Blocks;
|
||||
use Activitypub\Collection\Extra_Fields;
|
||||
|
||||
use function Activitypub\is_activitypub_request;
|
||||
|
||||
if ( is_activitypub_request() || is_feed() ) {
|
||||
return '';
|
||||
}
|
||||
|
||||
/**
|
||||
* Render callback for the Extra Fields block.
|
||||
*
|
||||
* @var array $attributes Block attributes.
|
||||
*/
|
||||
$attributes = wp_parse_args( $attributes );
|
||||
$user_id = Blocks::get_user_id( $attributes['selectedUser'] ?? 'blog' );
|
||||
|
||||
// If user ID couldn't be determined, return empty.
|
||||
if ( null === $user_id ) {
|
||||
return '';
|
||||
}
|
||||
|
||||
// Get extra fields for this user.
|
||||
$fields = Extra_Fields::get_actor_fields( $user_id );
|
||||
|
||||
// Apply max fields limit if set.
|
||||
$max_fields = $attributes['maxFields'] ?? 0;
|
||||
if ( $max_fields > 0 && count( $fields ) > $max_fields ) {
|
||||
$fields = array_slice( $fields, 0, $max_fields );
|
||||
}
|
||||
|
||||
// Return empty on frontend if no fields (hide block).
|
||||
if ( empty( $fields ) ) {
|
||||
return '';
|
||||
}
|
||||
|
||||
// Get block wrapper attributes.
|
||||
$wrapper_attributes = get_block_wrapper_attributes(
|
||||
array(
|
||||
'class' => 'activitypub-extra-fields-block-wrapper',
|
||||
)
|
||||
);
|
||||
|
||||
// Extract background color for cards style.
|
||||
$background_color = '';
|
||||
$card_style = '';
|
||||
|
||||
// Check if this is the cards style by looking at className attribute or wrapper classes.
|
||||
$is_cards_style = ( isset( $attributes['className'] ) && str_contains( $attributes['className'], 'is-style-cards' ) )
|
||||
|| str_contains( $wrapper_attributes, 'is-style-cards' );
|
||||
|
||||
if ( $is_cards_style ) {
|
||||
// Check for background color in various formats.
|
||||
if ( isset( $attributes['backgroundColor'] ) ) {
|
||||
$background_color = sprintf( 'var(--wp--preset--color--%s)', $attributes['backgroundColor'] );
|
||||
} elseif ( isset( $attributes['style']['color']['background'] ) ) {
|
||||
$background_color = $attributes['style']['color']['background'];
|
||||
}
|
||||
|
||||
if ( $background_color ) {
|
||||
$card_style = sprintf( ' style="background-color: %s;"', esc_attr( $background_color ) );
|
||||
}
|
||||
}
|
||||
?>
|
||||
<div <?php echo $wrapper_attributes; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>>
|
||||
<dl class="activitypub-extra-fields">
|
||||
<?php foreach ( $fields as $field ) : ?>
|
||||
<div class="activitypub-extra-field"<?php echo $card_style; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?>>
|
||||
<dt><?php echo esc_html( $field->post_title ); ?></dt>
|
||||
<dd><?php echo Extra_Fields::get_formatted_content( $field ); // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped ?></dd>
|
||||
</div>
|
||||
<?php endforeach; ?>
|
||||
</dl>
|
||||
</div>
|
||||
@ -0,0 +1 @@
|
||||
.activitypub-extra-fields{display:table;list-style:none;margin:0;padding:0;table-layout:fixed}.activitypub-extra-field{display:table-row;margin-bottom:0}.activitypub-extra-field dt{color:inherit;display:table-cell;font-weight:600;margin-bottom:0;padding-bottom:.5em;padding-left:10px;text-overflow:ellipsis;vertical-align:baseline;white-space:nowrap}.activitypub-extra-field dt:after{content:":"}.activitypub-extra-field dd{color:inherit;display:table-cell;margin-bottom:0;margin-right:0;padding-bottom:.5em;vertical-align:baseline;word-break:break-word}.activitypub-extra-field dd p{margin-bottom:.5em;margin-top:0}.activitypub-extra-field dd p:last-child{margin-bottom:0}.activitypub-extra-field dd a{color:inherit;text-decoration:underline}.activitypub-extra-field dd a:hover{text-decoration:none}.is-style-stacked .activitypub-extra-fields{display:block;table-layout:auto}.is-style-stacked .activitypub-extra-field{display:block;margin-bottom:1em}.is-style-stacked .activitypub-extra-field:last-child{margin-bottom:0}.is-style-stacked .activitypub-extra-field dt{display:block;margin-bottom:.25em;padding-bottom:0;padding-left:0;text-overflow:clip;white-space:normal}.is-style-stacked .activitypub-extra-field dt:after{content:none}.is-style-stacked .activitypub-extra-field dd{display:block;padding-bottom:0}.is-style-cards .activitypub-extra-fields{display:block;table-layout:auto}.is-style-cards .activitypub-extra-field{background:var(--wp--preset--color--base,#fff);border:1px solid var(--wp--preset--color--contrast-2,#ddd);border-radius:8px;box-shadow:0 1px 3px rgba(0,0,0,.05);display:block;margin-bottom:1em;padding:1em}.is-style-cards .activitypub-extra-field:last-child{margin-bottom:0}.is-style-cards .activitypub-extra-field dt{color:currentcolor;display:block;font-size:.9em;letter-spacing:.5px;margin-bottom:.5em;padding-bottom:0;padding-left:0;text-transform:uppercase;white-space:normal}.is-style-cards .activitypub-extra-field dt:after{content:none}.is-style-cards .activitypub-extra-field dd{display:block;font-size:1em;padding-bottom:0}.is-style-cards.has-background{background:transparent!important}.activitypub-extra-fields-block-wrapper.has-background .activitypub-extra-fields,.activitypub-extra-fields-block-wrapper.has-border .activitypub-extra-fields,.activitypub-extra-fields-block-wrapper.is-style-stacked.has-background .activitypub-extra-fields,.activitypub-extra-fields-block-wrapper.is-style-stacked.has-border .activitypub-extra-fields,.is-style-cards.has-background .activitypub-extra-fields{padding:1rem}.activitypub-extra-fields-block-wrapper.is-style-cards.has-background .activitypub-extra-fields,.activitypub-extra-fields-block-wrapper.is-style-cards.has-border .activitypub-extra-fields{padding:0}
|
||||
@ -0,0 +1 @@
|
||||
.activitypub-extra-fields{display:table;list-style:none;margin:0;padding:0;table-layout:fixed}.activitypub-extra-field{display:table-row;margin-bottom:0}.activitypub-extra-field dt{color:inherit;display:table-cell;font-weight:600;margin-bottom:0;padding-bottom:.5em;padding-right:10px;text-overflow:ellipsis;vertical-align:baseline;white-space:nowrap}.activitypub-extra-field dt:after{content:":"}.activitypub-extra-field dd{color:inherit;display:table-cell;margin-bottom:0;margin-left:0;padding-bottom:.5em;vertical-align:baseline;word-break:break-word}.activitypub-extra-field dd p{margin-bottom:.5em;margin-top:0}.activitypub-extra-field dd p:last-child{margin-bottom:0}.activitypub-extra-field dd a{color:inherit;text-decoration:underline}.activitypub-extra-field dd a:hover{text-decoration:none}.is-style-stacked .activitypub-extra-fields{display:block;table-layout:auto}.is-style-stacked .activitypub-extra-field{display:block;margin-bottom:1em}.is-style-stacked .activitypub-extra-field:last-child{margin-bottom:0}.is-style-stacked .activitypub-extra-field dt{display:block;margin-bottom:.25em;padding-bottom:0;padding-right:0;text-overflow:clip;white-space:normal}.is-style-stacked .activitypub-extra-field dt:after{content:none}.is-style-stacked .activitypub-extra-field dd{display:block;padding-bottom:0}.is-style-cards .activitypub-extra-fields{display:block;table-layout:auto}.is-style-cards .activitypub-extra-field{background:var(--wp--preset--color--base,#fff);border:1px solid var(--wp--preset--color--contrast-2,#ddd);border-radius:8px;box-shadow:0 1px 3px rgba(0,0,0,.05);display:block;margin-bottom:1em;padding:1em}.is-style-cards .activitypub-extra-field:last-child{margin-bottom:0}.is-style-cards .activitypub-extra-field dt{color:currentcolor;display:block;font-size:.9em;letter-spacing:.5px;margin-bottom:.5em;padding-bottom:0;padding-right:0;text-transform:uppercase;white-space:normal}.is-style-cards .activitypub-extra-field dt:after{content:none}.is-style-cards .activitypub-extra-field dd{display:block;font-size:1em;padding-bottom:0}.is-style-cards.has-background{background:transparent!important}.activitypub-extra-fields-block-wrapper.has-background .activitypub-extra-fields,.activitypub-extra-fields-block-wrapper.has-border .activitypub-extra-fields,.activitypub-extra-fields-block-wrapper.is-style-stacked.has-background .activitypub-extra-fields,.activitypub-extra-fields-block-wrapper.is-style-stacked.has-border .activitypub-extra-fields,.is-style-cards.has-background .activitypub-extra-fields{padding:1rem}.activitypub-extra-fields-block-wrapper.is-style-cards.has-background .activitypub-extra-fields,.activitypub-extra-fields-block-wrapper.is-style-cards.has-border .activitypub-extra-fields{padding:0}
|
||||
@ -2,14 +2,26 @@
|
||||
"$schema": "https://schemas.wp.org/trunk/block.json",
|
||||
"name": "activitypub/follow-me",
|
||||
"apiVersion": 3,
|
||||
"version": "1.0.0",
|
||||
"version": "8.3.0",
|
||||
"title": "Follow me on the Fediverse",
|
||||
"category": "widgets",
|
||||
"description": "Display your Fediverse profile so that visitors can follow you.",
|
||||
"textdomain": "activitypub",
|
||||
"icon": "groups",
|
||||
"keywords": [
|
||||
"fediverse",
|
||||
"activitypub",
|
||||
"follow",
|
||||
"mastodon"
|
||||
],
|
||||
"example": {
|
||||
"attributes": {
|
||||
"className": "is-style-default"
|
||||
}
|
||||
},
|
||||
"supports": {
|
||||
"html": false,
|
||||
"interactivity": true,
|
||||
"color": {
|
||||
"gradients": true,
|
||||
"link": true,
|
||||
@ -25,34 +37,38 @@
|
||||
"color": true,
|
||||
"style": true
|
||||
},
|
||||
"shadow": true,
|
||||
"typography": {
|
||||
"fontSize": true,
|
||||
"__experimentalDefaultControls": {
|
||||
"fontSize": true
|
||||
}
|
||||
},
|
||||
"innerBlocks": {
|
||||
"allowedBlocks": [
|
||||
"core/button"
|
||||
]
|
||||
}
|
||||
},
|
||||
"styles": [
|
||||
{
|
||||
"name": "default",
|
||||
"label": "Default",
|
||||
"isDefault": true
|
||||
},
|
||||
{
|
||||
"name": "button-only",
|
||||
"label": "Button"
|
||||
},
|
||||
{
|
||||
"name": "profile",
|
||||
"label": "Profile"
|
||||
}
|
||||
],
|
||||
"attributes": {
|
||||
"selectedUser": {
|
||||
"type": "string",
|
||||
"default": "site"
|
||||
},
|
||||
"buttonOnly": {
|
||||
"type": "boolean",
|
||||
"default": false
|
||||
},
|
||||
"buttonText": {
|
||||
"type": "string",
|
||||
"default": "Follow"
|
||||
},
|
||||
"buttonSize": {
|
||||
"type": "string",
|
||||
"default": "default",
|
||||
"enum": [
|
||||
"small",
|
||||
"default",
|
||||
"compact"
|
||||
]
|
||||
"default": "blog"
|
||||
}
|
||||
},
|
||||
"usesContext": [
|
||||
@ -60,9 +76,8 @@
|
||||
"postId"
|
||||
],
|
||||
"editorScript": "file:./index.js",
|
||||
"viewScript": "file:./view.js",
|
||||
"style": [
|
||||
"file:./style-view.css",
|
||||
"wp-components"
|
||||
]
|
||||
"viewScriptModule": "file:./view.js",
|
||||
"viewScript": "wp-api-fetch",
|
||||
"style": "file:./style-index.css",
|
||||
"render": "file:./render.php"
|
||||
}
|
||||
@ -1 +1 @@
|
||||
<?php return array('dependencies' => array('react', 'wp-api-fetch', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-compose', 'wp-core-data', 'wp-data', 'wp-element', 'wp-i18n', 'wp-primitives'), 'version' => '8f1a6f7e5f76d58a3204');
|
||||
<?php return array('dependencies' => array('react-jsx-runtime', 'wp-api-fetch', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-core-data', 'wp-data', 'wp-dom', 'wp-element', 'wp-i18n', 'wp-primitives'), 'version' => 'a7a6cb736043a8fe087f');
|
||||
|
||||
255
wp-content/plugins/activitypub/build/follow-me/render.php
Normal file
@ -0,0 +1,255 @@
|
||||
<?php
|
||||
/**
|
||||
* Server-side rendering of the `activitypub/follow-me` block.
|
||||
*
|
||||
* @package ActivityPub
|
||||
*/
|
||||
|
||||
use Activitypub\Blocks;
|
||||
use Activitypub\Collection\Actors;
|
||||
use Activitypub\Collection\Followers;
|
||||
|
||||
use function Activitypub\is_activitypub_request;
|
||||
|
||||
if ( is_activitypub_request() || is_feed() ) {
|
||||
return;
|
||||
}
|
||||
|
||||
/* @var array $attributes Block attributes. */
|
||||
$attributes = wp_parse_args( $attributes );
|
||||
|
||||
/* @var WP_Block $block Parsed block.*/
|
||||
$block = $block ?? null;
|
||||
|
||||
/* @var string $content Inner blocks content. */
|
||||
$content = $content ?? '';
|
||||
|
||||
// Get the user ID from the selected user attribute.
|
||||
$user_id = Blocks::get_user_id( $attributes['selectedUser'] ?? 'blog' );
|
||||
$actor = Actors::get_by_id( $user_id );
|
||||
if ( is_wp_error( $actor ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Generate a unique ID for the block.
|
||||
$block_id = 'activitypub-follow-me-block-' . wp_unique_id();
|
||||
|
||||
// Get block style information.
|
||||
$style = wp_get_global_styles();
|
||||
$background_color = $attributes['backgroundColor'] ?? $style['color']['background'] ?? '';
|
||||
$button_style = $attributes['style'] ?? array();
|
||||
|
||||
// Set up the Interactivity API config.
|
||||
wp_interactivity_config(
|
||||
'activitypub/follow-me',
|
||||
array(
|
||||
'namespace' => ACTIVITYPUB_REST_NAMESPACE,
|
||||
'i18n' => array(
|
||||
'copy' => __( 'Copy', 'activitypub' ),
|
||||
'copied' => __( 'Copied!', 'activitypub' ),
|
||||
'emptyProfileError' => __( 'Please enter a profile URL or handle.', 'activitypub' ),
|
||||
'genericError' => __( 'An error occurred. Please try again.', 'activitypub' ),
|
||||
'invalidProfileError' => __( 'Please enter a valid profile URL or handle.', 'activitypub' ),
|
||||
),
|
||||
)
|
||||
);
|
||||
|
||||
// Add the block wrapper attributes.
|
||||
$wrapper_attributes = array(
|
||||
'id' => $block_id,
|
||||
'class' => 'activitypub-follow-me-block-wrapper',
|
||||
'data-wp-interactive' => 'activitypub/follow-me',
|
||||
'data-wp-init' => 'callbacks.initButtonStyles',
|
||||
);
|
||||
if ( isset( $attributes['buttonOnly'] ) ) {
|
||||
$wrapper_attributes['class'] .= ' is-style-button-only';
|
||||
}
|
||||
|
||||
$wrapper_context = wp_interactivity_data_wp_context(
|
||||
array(
|
||||
'backgroundColor' => $background_color,
|
||||
'blockId' => $block_id,
|
||||
'buttonStyle' => $button_style,
|
||||
'copyButtonText' => __( 'Copy', 'activitypub' ),
|
||||
'errorMessage' => '',
|
||||
'isError' => false,
|
||||
'isLoading' => false,
|
||||
'modal' => array( 'isOpen' => false ),
|
||||
'remoteProfile' => '',
|
||||
'userId' => $user_id,
|
||||
'webfinger' => '@' . $actor->get_webfinger(),
|
||||
)
|
||||
);
|
||||
|
||||
if ( empty( $content ) ) {
|
||||
$button_text = $attributes['buttonText'] ?? __( 'Follow', 'activitypub' );
|
||||
$content = '<div class="wp-block-button"><a class="wp-element-button wp-block-button__link">' . esc_html( $button_text ) . '</a></div>';
|
||||
} else {
|
||||
$content = implode( PHP_EOL, wp_list_pluck( $block->parsed_block['innerBlocks'], 'innerHTML' ) );
|
||||
}
|
||||
|
||||
$content = Blocks::add_directions(
|
||||
$content,
|
||||
array( 'class_name' => 'wp-element-button' ),
|
||||
array(
|
||||
'data-wp-on--click' => 'actions.toggleModal',
|
||||
'data-wp-on--keydown' => 'actions.onKeydown',
|
||||
'data-wp-bind--aria-expanded' => 'context.modal.isOpen',
|
||||
'aria-label' => __( 'Follow me on the Fediverse', 'activitypub' ),
|
||||
'aria-haspopup' => 'dialog',
|
||||
'aria-controls' => $block_id . '-modal-title',
|
||||
'role' => 'button',
|
||||
'tabindex' => '0',
|
||||
)
|
||||
);
|
||||
|
||||
$header_image = $actor->get_image();
|
||||
$has_header = ! empty( $header_image['url'] ) && str_contains( $attributes['className'] ?? '', 'is-style-profile' );
|
||||
|
||||
$stats = array(
|
||||
'posts' => $user_id ? count_user_posts( $user_id, 'post', true ) : (int) wp_count_posts()->publish,
|
||||
'followers' => Followers::count( $user_id ),
|
||||
);
|
||||
|
||||
ob_start();
|
||||
?>
|
||||
<div class="activitypub-dialog__section">
|
||||
<h4><?php esc_html_e( 'My Profile', 'activitypub' ); ?></h4>
|
||||
<div class="activitypub-dialog__description">
|
||||
<?php esc_html_e( 'Paste my profile into the search field of your favorite open social app or platform.', 'activitypub' ); ?>
|
||||
</div>
|
||||
<div class="activitypub-dialog__button-group">
|
||||
<label for="<?php echo esc_attr( $block_id . '-profile-handle' ); ?>" class="screen-reader-text">
|
||||
<?php esc_html_e( 'My Fediverse handle', 'activitypub' ); ?>
|
||||
</label>
|
||||
<input
|
||||
aria-readonly="true"
|
||||
class="wp-block-search__input"
|
||||
id="<?php echo esc_attr( $block_id . '-profile-handle' ); ?>"
|
||||
readonly
|
||||
tabindex="-1"
|
||||
type="text"
|
||||
value="<?php echo esc_attr( '@' . $actor->get_webfinger() ); ?>"
|
||||
/>
|
||||
<button
|
||||
aria-label="<?php esc_attr_e( 'Copy handle to clipboard', 'activitypub' ); ?>"
|
||||
class="wp-element-button"
|
||||
data-wp-on--click="actions.copyToClipboard"
|
||||
type="button"
|
||||
>
|
||||
<span data-wp-text="context.copyButtonText"></span>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="activitypub-dialog__section">
|
||||
<h4><?php esc_html_e( 'Your Profile', 'activitypub' ); ?></h4>
|
||||
<div class="activitypub-dialog__description">
|
||||
<?php esc_html_e( 'Or, if you know your own profile, we can start things that way!', 'activitypub' ); ?>
|
||||
<?php Blocks::render_modal_help(); ?>
|
||||
</div>
|
||||
<div class="activitypub-dialog__button-group">
|
||||
<label for="<?php echo esc_attr( $block_id . '-remote-profile' ); ?>" class="screen-reader-text">
|
||||
<?php esc_html_e( 'Your Fediverse profile', 'activitypub' ); ?>
|
||||
</label>
|
||||
<input
|
||||
class="wp-block-search__input"
|
||||
data-wp-bind--aria-invalid="context.isError"
|
||||
data-wp-bind--value="context.remoteProfile"
|
||||
data-wp-on--input="actions.updateRemoteProfile"
|
||||
data-wp-on--keydown="actions.handleKeyDown"
|
||||
id="<?php echo esc_attr( $block_id . '-remote-profile' ); ?>"
|
||||
placeholder="<?php esc_attr_e( '@username@example.com', 'activitypub' ); ?>"
|
||||
type="text"
|
||||
/>
|
||||
<button
|
||||
aria-label="<?php esc_attr_e( 'Follow', 'activitypub' ); ?>"
|
||||
class="wp-element-button"
|
||||
data-wp-bind--disabled="context.isLoading"
|
||||
data-wp-on--click="actions.submitRemoteProfile"
|
||||
type="button"
|
||||
>
|
||||
<span data-wp-bind--hidden="context.isLoading"><?php esc_html_e( 'Follow', 'activitypub' ); ?></span>
|
||||
<span data-wp-bind--hidden="!context.isLoading"><?php esc_html_e( 'Loading…', 'activitypub' ); ?></span>
|
||||
</button>
|
||||
</div>
|
||||
<div
|
||||
class="activitypub-dialog__error"
|
||||
data-wp-bind--hidden="!context.isError"
|
||||
data-wp-text="context.errorMessage"
|
||||
></div>
|
||||
</div>
|
||||
<?php
|
||||
$modal_content = ob_get_clean();
|
||||
|
||||
?>
|
||||
<div
|
||||
<?php echo get_block_wrapper_attributes( $wrapper_attributes ); // phpcs:ignore WordPress.Security.EscapeOutput ?>
|
||||
<?php echo $wrapper_context; // phpcs:ignore WordPress.Security.EscapeOutput ?>
|
||||
>
|
||||
<div class="activitypub-profile p-author h-card">
|
||||
<?php if ( $has_header ) : ?>
|
||||
<div class="activitypub-profile__header" style="background-image: url('<?php echo esc_url( $header_image['url'] ); ?>');"></div>
|
||||
<?php endif; ?>
|
||||
|
||||
<div class="activitypub-profile__body">
|
||||
<img
|
||||
class="activitypub-profile__avatar u-photo"
|
||||
src="<?php echo esc_url( $actor->get_icon()['url'] ); ?>"
|
||||
alt="<?php echo esc_attr( $actor->get_name() ); ?>"
|
||||
/>
|
||||
|
||||
<div class="activitypub-profile__content">
|
||||
<div class="activitypub-profile__info">
|
||||
<div class="activitypub-profile__name p-name"><?php echo esc_html( $actor->get_name() ); ?></div>
|
||||
<?php /** Using `data-wp-text` to avoid @see enrich_content_data() turning it into a mention. */ ?>
|
||||
<div class="activitypub-profile__handle p-nickname p-x-webfinger" data-wp-text="context.webfinger"></div>
|
||||
</div>
|
||||
|
||||
<?php echo $content; // phpcs:ignore WordPress.Security.EscapeOutput ?>
|
||||
|
||||
<?php if ( $actor->get_summary() ) : ?>
|
||||
<div class="activitypub-profile__bio p-note">
|
||||
<?php echo wp_kses_post( $actor->get_summary() ); ?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
||||
<div class="activitypub-profile__stats">
|
||||
<?php if ( null !== $stats['posts'] ) : ?>
|
||||
<div>
|
||||
<?php
|
||||
printf(
|
||||
/* translators: %s: Number of posts */
|
||||
esc_html( _n( '%s post', '%s posts', (int) $stats['posts'], 'activitypub' ) ),
|
||||
'<strong>' . esc_html( number_format_i18n( $stats['posts'] ) ) . '</strong>'
|
||||
);
|
||||
?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
<?php if ( null !== $stats['followers'] ) : ?>
|
||||
<div>
|
||||
<?php
|
||||
printf(
|
||||
/* translators: %s: Number of followers */
|
||||
esc_html( _n( '%s follower', '%s followers', (int) $stats['followers'], 'activitypub' ) ),
|
||||
'<strong>' . esc_html( number_format_i18n( $stats['followers'] ) ) . '</strong>'
|
||||
);
|
||||
?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<?php
|
||||
// Render the modal using the Blocks class.
|
||||
Blocks::render_modal(
|
||||
array(
|
||||
'id' => $block_id . '-modal',
|
||||
'content' => $modal_content,
|
||||
/* translators: %s: Profile name. */
|
||||
'title' => sprintf( esc_html__( 'Follow %s', 'activitypub' ), esc_html( $actor->get_name() ) ),
|
||||
)
|
||||
);
|
||||
?>
|
||||
</div>
|
||||
@ -1 +0,0 @@
|
||||
.activitypub__modal.components-modal__frame{background-color:#f7f7f7;color:#333}.activitypub__modal.components-modal__frame .components-modal__header-heading,.activitypub__modal.components-modal__frame h4{color:#333;letter-spacing:inherit;word-spacing:inherit}.activitypub__modal.components-modal__frame .components-modal__header .components-button:hover{color:var(--color-white)}.activitypub__dialog{max-width:40em}.activitypub__dialog h4{line-height:1;margin:0}.activitypub__dialog .activitypub-dialog__section{margin-bottom:2em}.activitypub__dialog .activitypub-dialog__remember{margin-top:1em}.activitypub__dialog .activitypub-dialog__description{font-size:var(--wp--preset--font-size--normal,.75rem);margin:.33em 0 1em}.activitypub__dialog .activitypub-dialog__button-group{align-items:flex-end;display:flex;justify-content:flex-end}.activitypub__dialog .activitypub-dialog__button-group svg{height:21px;margin-left:.5em;width:21px}.activitypub__dialog .activitypub-dialog__button-group input{background-color:var(--wp--preset--color--white);border-radius:0 50px 50px 0;border-width:1px;border:1px solid var(--wp--preset--color--black);color:var(--wp--preset--color--black);flex:1;font-size:16px;height:inherit;line-height:1;margin-left:0;padding:15px 23px}.activitypub__dialog .activitypub-dialog__button-group button{align-self:center;background-color:var(--wp--preset--color--black);border-radius:50px 0 0 50px;border-width:1px;color:var(--wp--preset--color--white);font-size:16px;height:inherit;line-height:1;margin-right:0;padding:15px 23px;text-decoration:none}.activitypub__dialog .activitypub-dialog__button-group button:hover{border:inherit}.activitypub-follow-me-block-wrapper{width:100%}.activitypub-follow-me-block-wrapper.has-background .activitypub-profile,.activitypub-follow-me-block-wrapper.has-border-color .activitypub-profile{padding-right:1rem;padding-left:1rem}.activitypub-follow-me-block-wrapper .activitypub-profile{align-items:center;display:flex;padding:1rem 0}.activitypub-follow-me-block-wrapper .activitypub-profile .activitypub-profile__avatar{border-radius:50%;height:75px;margin-left:1rem;width:75px}.activitypub-follow-me-block-wrapper .activitypub-profile .activitypub-profile__content{flex:1;min-width:0}.activitypub-follow-me-block-wrapper .activitypub-profile .activitypub-profile__handle,.activitypub-follow-me-block-wrapper .activitypub-profile .activitypub-profile__name{line-height:1.2;margin:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.activitypub-follow-me-block-wrapper .activitypub-profile .activitypub-profile__name{font-size:1.25em}.activitypub-follow-me-block-wrapper .activitypub-profile .activitypub-profile__follow{align-self:center;background-color:var(--wp--preset--color--black);color:var(--wp--preset--color--white)}.activitypub-follow-me-block-wrapper .activitypub-profile .activitypub-profile__follow:not(:only-child){margin-right:1rem}
|
||||
@ -1 +0,0 @@
|
||||
.activitypub__modal.components-modal__frame{background-color:#f7f7f7;color:#333}.activitypub__modal.components-modal__frame .components-modal__header-heading,.activitypub__modal.components-modal__frame h4{color:#333;letter-spacing:inherit;word-spacing:inherit}.activitypub__modal.components-modal__frame .components-modal__header .components-button:hover{color:var(--color-white)}.activitypub__dialog{max-width:40em}.activitypub__dialog h4{line-height:1;margin:0}.activitypub__dialog .activitypub-dialog__section{margin-bottom:2em}.activitypub__dialog .activitypub-dialog__remember{margin-top:1em}.activitypub__dialog .activitypub-dialog__description{font-size:var(--wp--preset--font-size--normal,.75rem);margin:.33em 0 1em}.activitypub__dialog .activitypub-dialog__button-group{align-items:flex-end;display:flex;justify-content:flex-end}.activitypub__dialog .activitypub-dialog__button-group svg{height:21px;margin-right:.5em;width:21px}.activitypub__dialog .activitypub-dialog__button-group input{background-color:var(--wp--preset--color--white);border-radius:50px 0 0 50px;border-width:1px;border:1px solid var(--wp--preset--color--black);color:var(--wp--preset--color--black);flex:1;font-size:16px;height:inherit;line-height:1;margin-right:0;padding:15px 23px}.activitypub__dialog .activitypub-dialog__button-group button{align-self:center;background-color:var(--wp--preset--color--black);border-radius:0 50px 50px 0;border-width:1px;color:var(--wp--preset--color--white);font-size:16px;height:inherit;line-height:1;margin-left:0;padding:15px 23px;text-decoration:none}.activitypub__dialog .activitypub-dialog__button-group button:hover{border:inherit}.activitypub-follow-me-block-wrapper{width:100%}.activitypub-follow-me-block-wrapper.has-background .activitypub-profile,.activitypub-follow-me-block-wrapper.has-border-color .activitypub-profile{padding-left:1rem;padding-right:1rem}.activitypub-follow-me-block-wrapper .activitypub-profile{align-items:center;display:flex;padding:1rem 0}.activitypub-follow-me-block-wrapper .activitypub-profile .activitypub-profile__avatar{border-radius:50%;height:75px;margin-right:1rem;width:75px}.activitypub-follow-me-block-wrapper .activitypub-profile .activitypub-profile__content{flex:1;min-width:0}.activitypub-follow-me-block-wrapper .activitypub-profile .activitypub-profile__handle,.activitypub-follow-me-block-wrapper .activitypub-profile .activitypub-profile__name{line-height:1.2;margin:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.activitypub-follow-me-block-wrapper .activitypub-profile .activitypub-profile__name{font-size:1.25em}.activitypub-follow-me-block-wrapper .activitypub-profile .activitypub-profile__follow{align-self:center;background-color:var(--wp--preset--color--black);color:var(--wp--preset--color--white)}.activitypub-follow-me-block-wrapper .activitypub-profile .activitypub-profile__follow:not(:only-child){margin-left:1rem}
|
||||
@ -1 +1 @@
|
||||
<?php return array('dependencies' => array('react', 'wp-api-fetch', 'wp-components', 'wp-compose', 'wp-dom-ready', 'wp-element', 'wp-i18n', 'wp-primitives'), 'version' => '635ed3e6db3230ae865f');
|
||||
<?php return array('dependencies' => array('@wordpress/interactivity'), 'version' => '5b88efee3f3b7a1605df', 'type' => 'module');
|
||||
|
||||
@ -2,23 +2,26 @@
|
||||
"$schema": "https://schemas.wp.org/trunk/block.json",
|
||||
"name": "activitypub/followers",
|
||||
"apiVersion": 3,
|
||||
"version": "1.0.0",
|
||||
"version": "8.3.0",
|
||||
"title": "Fediverse Followers",
|
||||
"category": "widgets",
|
||||
"description": "Display your followers from the Fediverse on your website.",
|
||||
"textdomain": "activitypub",
|
||||
"icon": "groups",
|
||||
"keywords": [
|
||||
"fediverse",
|
||||
"activitypub",
|
||||
"followers",
|
||||
"mastodon"
|
||||
],
|
||||
"supports": {
|
||||
"html": false
|
||||
"html": false,
|
||||
"interactivity": true
|
||||
},
|
||||
"attributes": {
|
||||
"title": {
|
||||
"type": "string",
|
||||
"default": "Fediverse Followers"
|
||||
},
|
||||
"selectedUser": {
|
||||
"type": "string",
|
||||
"default": "site"
|
||||
"default": "blog"
|
||||
},
|
||||
"per_page": {
|
||||
"type": "number",
|
||||
@ -40,12 +43,12 @@
|
||||
"styles": [
|
||||
{
|
||||
"name": "default",
|
||||
"label": "No Lines",
|
||||
"label": "Default",
|
||||
"isDefault": true
|
||||
},
|
||||
{
|
||||
"name": "with-lines",
|
||||
"label": "Lines"
|
||||
"name": "card",
|
||||
"label": "Card"
|
||||
},
|
||||
{
|
||||
"name": "compact",
|
||||
@ -53,9 +56,11 @@
|
||||
}
|
||||
],
|
||||
"editorScript": "file:./index.js",
|
||||
"viewScript": "file:./view.js",
|
||||
"editorStyle": "file:./index.css",
|
||||
"viewScriptModule": "file:./view.js",
|
||||
"viewScript": "wp-api-fetch",
|
||||
"style": [
|
||||
"file:./style-view.css",
|
||||
"wp-block-query-pagination"
|
||||
]
|
||||
"file:./style-index.css"
|
||||
],
|
||||
"render": "file:./render.php"
|
||||
}
|
||||
@ -1 +1 @@
|
||||
<?php return array('dependencies' => array('react', 'wp-api-fetch', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-core-data', 'wp-data', 'wp-element', 'wp-i18n', 'wp-primitives', 'wp-url'), 'version' => 'e98a40c18060cbb88187');
|
||||
<?php return array('dependencies' => array('react-jsx-runtime', 'wp-api-fetch', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-core-data', 'wp-data', 'wp-element', 'wp-i18n', 'wp-primitives', 'wp-url'), 'version' => 'da88cfc334f994481a92');
|
||||
|
||||
20
wp-content/plugins/activitypub/build/followers/render.php
Normal file
@ -0,0 +1,20 @@
|
||||
<?php
|
||||
/**
|
||||
* Server-side rendering of the followers block.
|
||||
*
|
||||
* @package Activitypub
|
||||
*/
|
||||
|
||||
use Activitypub\Blocks;
|
||||
|
||||
/* @var array $attributes Block attributes. */
|
||||
$attributes = $attributes ?? array();
|
||||
|
||||
/* @var WP_Block $block Current block. */
|
||||
$block = $block ?? null;
|
||||
|
||||
/* @var string $content Block content. */
|
||||
$content = $content ?? '';
|
||||
|
||||
// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Output is escaped in render method.
|
||||
echo Blocks::render_actor_list_block( 'followers', $attributes, $block, $content );
|
||||
@ -1 +0,0 @@
|
||||
.activitypub-follower-block.is-style-compact .activitypub-handle,.activitypub-follower-block.is-style-compact .sep{display:none}.activitypub-follower-block.is-style-with-lines ul li{border-bottom:.5px solid;margin-bottom:.5rem;padding-bottom:.5rem}.activitypub-follower-block.is-style-with-lines ul li:last-child{border-bottom:none}.activitypub-follower-block.is-style-with-lines .activitypub-handle,.activitypub-follower-block.is-style-with-lines .activitypub-name{text-decoration:none}.activitypub-follower-block.is-style-with-lines .activitypub-handle:hover,.activitypub-follower-block.is-style-with-lines .activitypub-name:hover{text-decoration:underline}.activitypub-follower-block ul{margin:0!important;padding:0!important}.activitypub-follower-block li{display:flex;margin-bottom:1rem}.activitypub-follower-block img{border-radius:50%;height:40px;margin-left:var(--wp--preset--spacing--20,.5rem);width:40px}.activitypub-follower-block .activitypub-link{align-items:center;color:inherit!important;display:flex;flex-flow:row nowrap;max-width:100%;text-decoration:none!important}.activitypub-follower-block .activitypub-handle,.activitypub-follower-block .activitypub-name{text-decoration:underline;text-decoration-thickness:.8px;text-underline-position:under}.activitypub-follower-block .activitypub-handle:hover,.activitypub-follower-block .activitypub-name:hover{text-decoration:none}.activitypub-follower-block .activitypub-name{font-size:var(--wp--preset--font-size--normal,16px)}.activitypub-follower-block .activitypub-actor{font-size:var(--wp--preset--font-size--small,13px);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.activitypub-follower-block .sep{padding:0 .2rem}.activitypub-follower-block .wp-block-query-pagination{margin-top:1.5rem}.activitypub-follower-block .activitypub-pager{cursor:default}.activitypub-follower-block .activitypub-pager.current{opacity:.33}.activitypub-follower-block .page-numbers{padding:0 .2rem}.activitypub-follower-block .page-numbers.current{font-weight:700;opacity:1}
|
||||
@ -1 +0,0 @@
|
||||
.activitypub-follower-block.is-style-compact .activitypub-handle,.activitypub-follower-block.is-style-compact .sep{display:none}.activitypub-follower-block.is-style-with-lines ul li{border-bottom:.5px solid;margin-bottom:.5rem;padding-bottom:.5rem}.activitypub-follower-block.is-style-with-lines ul li:last-child{border-bottom:none}.activitypub-follower-block.is-style-with-lines .activitypub-handle,.activitypub-follower-block.is-style-with-lines .activitypub-name{text-decoration:none}.activitypub-follower-block.is-style-with-lines .activitypub-handle:hover,.activitypub-follower-block.is-style-with-lines .activitypub-name:hover{text-decoration:underline}.activitypub-follower-block ul{margin:0!important;padding:0!important}.activitypub-follower-block li{display:flex;margin-bottom:1rem}.activitypub-follower-block img{border-radius:50%;height:40px;margin-right:var(--wp--preset--spacing--20,.5rem);width:40px}.activitypub-follower-block .activitypub-link{align-items:center;color:inherit!important;display:flex;flex-flow:row nowrap;max-width:100%;text-decoration:none!important}.activitypub-follower-block .activitypub-handle,.activitypub-follower-block .activitypub-name{text-decoration:underline;text-decoration-thickness:.8px;text-underline-position:under}.activitypub-follower-block .activitypub-handle:hover,.activitypub-follower-block .activitypub-name:hover{text-decoration:none}.activitypub-follower-block .activitypub-name{font-size:var(--wp--preset--font-size--normal,16px)}.activitypub-follower-block .activitypub-actor{font-size:var(--wp--preset--font-size--small,13px);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.activitypub-follower-block .sep{padding:0 .2rem}.activitypub-follower-block .wp-block-query-pagination{margin-top:1.5rem}.activitypub-follower-block .activitypub-pager{cursor:default}.activitypub-follower-block .activitypub-pager.current{opacity:.33}.activitypub-follower-block .page-numbers{padding:0 .2rem}.activitypub-follower-block .page-numbers.current{font-weight:700;opacity:1}
|
||||
@ -1 +1 @@
|
||||
<?php return array('dependencies' => array('react', 'wp-api-fetch', 'wp-components', 'wp-dom-ready', 'wp-element', 'wp-i18n', 'wp-url'), 'version' => '34299fc181d49292ada0');
|
||||
<?php return array('dependencies' => array('@wordpress/interactivity'), 'version' => '2f63eedc944f22daa7c0', 'type' => 'module');
|
||||
|
||||
@ -1,3 +1 @@
|
||||
(()=>{var e,t={73:(e,t,a)=>{"use strict";const r=window.React,n=window.wp.apiFetch;var l=a.n(n);const o=window.wp.url,c=window.wp.element,i=window.wp.i18n;var s=a(942),p=a.n(s);function u({active:e,children:t,page:a,pageClick:n,className:l}){const o=p()("wp-block activitypub-pager",l,{current:e});return(0,r.createElement)("a",{className:o,onClick:t=>{t.preventDefault(),!e&&n(a)}},t)}function m({compact:e,nextLabel:t,page:a,pageClick:n,perPage:l,prevLabel:o,total:c,variant:i="outlined"}){const s=((e,t)=>{let a=[1,e-2,e-1,e,e+1,e+2,t];a.sort(((e,t)=>e-t)),a=a.filter(((e,a,r)=>e>=1&&e<=t&&r.lastIndexOf(e)===a));for(let e=a.length-2;e>=0;e--)a[e]===a[e+1]&&a.splice(e+1,1);return a})(a,Math.ceil(c/l)),m=p()("alignwide wp-block-query-pagination is-content-justification-space-between is-layout-flex wp-block-query-pagination-is-layout-flex",`is-${i}`,{"is-compact":e});return(0,r.createElement)("nav",{className:m},o&&(0,r.createElement)(u,{key:"prev",page:a-1,pageClick:n,active:1===a,"aria-label":o,className:"wp-block-query-pagination-previous block-editor-block-list__block"},o),!e&&(0,r.createElement)("div",{className:"block-editor-block-list__block wp-block wp-block-query-pagination-numbers"},s.map((e=>(0,r.createElement)(u,{key:e,page:e,pageClick:n,active:e===a,className:"page-numbers"},e)))),t&&(0,r.createElement)(u,{key:"next",page:a+1,pageClick:n,active:a===Math.ceil(c/l),"aria-label":t,className:"wp-block-query-pagination-next block-editor-block-list__block"},t))}const f=window.wp.components;function v({selectedUser:e,per_page:t,order:a,title:n,page:s,setPage:p,className:u="",followLinks:f=!0,followerData:v=!1}){const w="site"===e?0:e,[d,g]=(0,r.useState)([]),[y,k]=(0,r.useState)(0),[h,E]=(0,r.useState)(0),[N,x]=function(){const[e,t]=(0,r.useState)(1);return[e,t]}(),_=s||N,O=p||x,S=(0,c.createInterpolateElement)(/* translators: arrow for previous followers link */ /* translators: arrow for previous followers link */
|
||||
(0,i.__)("<span>←</span> Less","activitypub"),{span:(0,r.createElement)("span",{className:"wp-block-query-pagination-previous-arrow is-arrow-arrow","aria-hidden":"true"})}),C=(0,c.createInterpolateElement)(/* translators: arrow for next followers link */ /* translators: arrow for next followers link */
|
||||
(0,i.__)("More <span>→</span>","activitypub"),{span:(0,r.createElement)("span",{className:"wp-block-query-pagination-next-arrow is-arrow-arrow","aria-hidden":"true"})}),L=(e,a)=>{g(e),E(a),k(Math.ceil(a/t))};return(0,r.useEffect)((()=>{if(v&&1===_)return L(v.followers,v.total);const e=function(e,t,a,r){const{namespace:n}=window._activityPubOptions||{},l=`/${n}/actors/${e}/followers`,c={per_page:t,order:a,page:r,context:"full"};return(0,o.addQueryArgs)(l,c)}(w,t,a,_);l()({path:e}).then((e=>L(e.orderedItems,e.totalItems))).catch((()=>{}))}),[w,t,a,_,v]),(0,r.createElement)("div",{className:"activitypub-follower-block "+u},(0,r.createElement)("h3",null,n),(0,r.createElement)("ul",null,d&&d.map((e=>(0,r.createElement)("li",{key:e.url},(0,r.createElement)(b,{...e,followLinks:f}))))),y>1&&(0,r.createElement)(m,{page:_,perPage:t,total:h,pageClick:O,nextLabel:C,prevLabel:S,compact:"is-style-compact"===u}))}function b({name:e,icon:t,url:a,preferredUsername:n,followLinks:l=!0}){const o=`@${n}`,c={};return l||(c.onClick=e=>e.preventDefault()),(0,r.createElement)(f.ExternalLink,{className:"activitypub-link",href:a,title:o,...c},(0,r.createElement)("img",{width:"40",height:"40",src:t.url,className:"avatar activitypub-avatar",alt:e}),(0,r.createElement)("span",{className:"activitypub-actor"},(0,r.createElement)("strong",{className:"activitypub-name"},e),(0,r.createElement)("span",{className:"sep"},"/"),(0,r.createElement)("span",{className:"activitypub-handle"},o)))}const w=window.wp.domReady;a.n(w)()((()=>{[].forEach.call(document.querySelectorAll(".activitypub-follower-block"),(e=>{const t=JSON.parse(e.dataset.attrs);(0,c.createRoot)(e).render((0,r.createElement)(v,{...t}))}))}))},942:(e,t)=>{var a;!function(){"use strict";var r={}.hasOwnProperty;function n(){for(var e="",t=0;t<arguments.length;t++){var a=arguments[t];a&&(e=o(e,l(a)))}return e}function l(e){if("string"==typeof e||"number"==typeof e)return e;if("object"!=typeof e)return"";if(Array.isArray(e))return n.apply(null,e);if(e.toString!==Object.prototype.toString&&!e.toString.toString().includes("[native code]"))return e.toString();var t="";for(var a in e)r.call(e,a)&&e[a]&&(t=o(t,a));return t}function o(e,t){return t?e?e+" "+t:e+t:e}e.exports?(n.default=n,e.exports=n):void 0===(a=function(){return n}.apply(t,[]))||(e.exports=a)}()}},a={};function r(e){var n=a[e];if(void 0!==n)return n.exports;var l=a[e]={exports:{}};return t[e](l,l.exports,r),l.exports}r.m=t,e=[],r.O=(t,a,n,l)=>{if(!a){var o=1/0;for(p=0;p<e.length;p++){a=e[p][0],n=e[p][1],l=e[p][2];for(var c=!0,i=0;i<a.length;i++)(!1&l||o>=l)&&Object.keys(r.O).every((e=>r.O[e](a[i])))?a.splice(i--,1):(c=!1,l<o&&(o=l));if(c){e.splice(p--,1);var s=n();void 0!==s&&(t=s)}}return t}l=l||0;for(var p=e.length;p>0&&e[p-1][2]>l;p--)e[p]=e[p-1];e[p]=[a,n,l]},r.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return r.d(t,{a:t}),t},r.d=(e,t)=>{for(var a in t)r.o(t,a)&&!r.o(e,a)&&Object.defineProperty(e,a,{enumerable:!0,get:t[a]})},r.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),(()=>{var e={996:0,528:0};r.O.j=t=>0===e[t];var t=(t,a)=>{var n,l,o=a[0],c=a[1],i=a[2],s=0;if(o.some((t=>0!==e[t]))){for(n in c)r.o(c,n)&&(r.m[n]=c[n]);if(i)var p=i(r)}for(t&&t(a);s<o.length;s++)l=o[s],r.o(e,l)&&e[l]&&e[l][0](),e[l]=0;return r.O(p)},a=self.webpackChunkwordpress_activitypub=self.webpackChunkwordpress_activitypub||[];a.forEach(t.bind(null,0)),a.push=t.bind(null,a.push.bind(a))})();var n=r.O(void 0,[528],(()=>r(73)));n=r.O(n)})();
|
||||
import*as e from"@wordpress/interactivity";const t=e,a=t.withSyncEvent??(e=>e);!function(){const{actions:e}=(0,t.store)("activitypub/followers",{state:{get paginationText(){const{page:e,pages:a}=(0,t.getContext)();return`${e} / ${a}`},get disablePreviousLink(){const{page:e}=(0,t.getContext)();return e<=1},get disableNextLink(){const{page:e,pages:a}=(0,t.getContext)();return e>=a}},actions:{async fetchItems(){const e=(0,t.getContext)(),{userId:a,page:n,perPage:r,order:o,endpoint:s}=e,{apiFetch:g,url:i}=window.wp;e.isLoading=!0;try{const{namespace:c}=(0,t.getConfig)(),p=i.addQueryArgs(`/${c}/actors/${a}/${s}`,{context:"full",per_page:r,order:o,page:n}),{orderedItems:l,totalItems:d}=await g({path:p});e.items=l.map(e=>({handle:"@"+e.webfinger,icon:e.icon,name:e.name||e.preferredUsername,url:e.url||e.id})),e.total=d,e.pages=Math.ceil(d/r)}catch(e){console.error(`Error fetching ${s}:`,e)}finally{e.isLoading=!1}},previousPage:a(a=>{a.preventDefault();const n=(0,t.getContext)();n.page>1&&(n.page--,e.fetchItems())}),nextPage:a(a=>{a.preventDefault();const n=(0,t.getContext)();n.page<n.pages&&(n.page++,e.fetchItems())})},callbacks:{setDefaultAvatar(e){e.target.src=(0,t.getConfig)().defaultAvatarUrl}}})}();
|
||||
66
wp-content/plugins/activitypub/build/following/block.json
Normal file
@ -0,0 +1,66 @@
|
||||
{
|
||||
"$schema": "https://schemas.wp.org/trunk/block.json",
|
||||
"name": "activitypub/following",
|
||||
"apiVersion": 3,
|
||||
"version": "8.3.0",
|
||||
"title": "Fediverse Following",
|
||||
"category": "widgets",
|
||||
"description": "Display the accounts you follow in the Fediverse on your website.",
|
||||
"textdomain": "activitypub",
|
||||
"icon": "groups",
|
||||
"keywords": [
|
||||
"fediverse",
|
||||
"activitypub",
|
||||
"following",
|
||||
"mastodon"
|
||||
],
|
||||
"supports": {
|
||||
"html": false,
|
||||
"interactivity": true
|
||||
},
|
||||
"attributes": {
|
||||
"selectedUser": {
|
||||
"type": "string",
|
||||
"default": "blog"
|
||||
},
|
||||
"per_page": {
|
||||
"type": "number",
|
||||
"default": 10
|
||||
},
|
||||
"order": {
|
||||
"type": "string",
|
||||
"default": "desc",
|
||||
"enum": [
|
||||
"asc",
|
||||
"desc"
|
||||
]
|
||||
}
|
||||
},
|
||||
"usesContext": [
|
||||
"postType",
|
||||
"postId"
|
||||
],
|
||||
"styles": [
|
||||
{
|
||||
"name": "default",
|
||||
"label": "Default",
|
||||
"isDefault": true
|
||||
},
|
||||
{
|
||||
"name": "card",
|
||||
"label": "Card"
|
||||
},
|
||||
{
|
||||
"name": "compact",
|
||||
"label": "Compact"
|
||||
}
|
||||
],
|
||||
"editorScript": "file:./index.js",
|
||||
"editorStyle": "file:./index.css",
|
||||
"viewScriptModule": "file:./view.js",
|
||||
"viewScript": "wp-api-fetch",
|
||||
"style": [
|
||||
"file:./style-index.css"
|
||||
],
|
||||
"render": "file:./render.php"
|
||||
}
|
||||
@ -0,0 +1 @@
|
||||
<?php return array('dependencies' => array('react-jsx-runtime', 'wp-api-fetch', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-core-data', 'wp-data', 'wp-element', 'wp-i18n', 'wp-primitives', 'wp-url'), 'version' => '579447d958b5f1081d10');
|
||||
3
wp-content/plugins/activitypub/build/following/index.js
Normal file
20
wp-content/plugins/activitypub/build/following/render.php
Normal file
@ -0,0 +1,20 @@
|
||||
<?php
|
||||
/**
|
||||
* Server-side rendering of the following block.
|
||||
*
|
||||
* @package Activitypub
|
||||
*/
|
||||
|
||||
use Activitypub\Blocks;
|
||||
|
||||
/* @var array $attributes Block attributes. */
|
||||
$attributes = $attributes ?? array();
|
||||
|
||||
/* @var WP_Block $block Current block. */
|
||||
$block = $block ?? null;
|
||||
|
||||
/* @var string $content Block content. */
|
||||
$content = $content ?? '';
|
||||
|
||||
// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Output is escaped in render method.
|
||||
echo Blocks::render_actor_list_block( 'following', $attributes, $block, $content );
|
||||
@ -0,0 +1 @@
|
||||
<?php return array('dependencies' => array('@wordpress/interactivity'), 'version' => '94e5efb023ccc7caf799', 'type' => 'module');
|
||||
1
wp-content/plugins/activitypub/build/following/view.js
Normal file
@ -0,0 +1 @@
|
||||
import*as e from"@wordpress/interactivity";const t=e,a=t.withSyncEvent??(e=>e);!function(){const{actions:e}=(0,t.store)("activitypub/following",{state:{get paginationText(){const{page:e,pages:a}=(0,t.getContext)();return`${e} / ${a}`},get disablePreviousLink(){const{page:e}=(0,t.getContext)();return e<=1},get disableNextLink(){const{page:e,pages:a}=(0,t.getContext)();return e>=a}},actions:{async fetchItems(){const e=(0,t.getContext)(),{userId:a,page:n,perPage:r,order:o,endpoint:s}=e,{apiFetch:g,url:i}=window.wp;e.isLoading=!0;try{const{namespace:c}=(0,t.getConfig)(),p=i.addQueryArgs(`/${c}/actors/${a}/${s}`,{context:"full",per_page:r,order:o,page:n}),{orderedItems:l,totalItems:d}=await g({path:p});e.items=l.map(e=>({handle:"@"+e.webfinger,icon:e.icon,name:e.name||e.preferredUsername,url:e.url||e.id})),e.total=d,e.pages=Math.ceil(d/r)}catch(e){console.error(`Error fetching ${s}:`,e)}finally{e.isLoading=!1}},previousPage:a(a=>{a.preventDefault();const n=(0,t.getContext)();n.page>1&&(n.page--,e.fetchItems())}),nextPage:a(a=>{a.preventDefault();const n=(0,t.getContext)();n.page<n.pages&&(n.page++,e.fetchItems())})},callbacks:{setDefaultAvatar(e){e.target.src=(0,t.getConfig)().defaultAvatarUrl}}})}();
|
||||
@ -0,0 +1,26 @@
|
||||
{
|
||||
"$schema": "https://schemas.wp.org/trunk/block.json",
|
||||
"name": "activitypub/posts-and-replies",
|
||||
"apiVersion": 3,
|
||||
"version": "unreleased",
|
||||
"title": "Posts and Replies",
|
||||
"category": "widgets",
|
||||
"description": "Display a tab bar to filter between posts only and posts with replies on author archives.",
|
||||
"textdomain": "activitypub",
|
||||
"icon": "admin-post",
|
||||
"keywords": [
|
||||
"fediverse",
|
||||
"activitypub",
|
||||
"posts",
|
||||
"replies",
|
||||
"tabs"
|
||||
],
|
||||
"supports": {
|
||||
"html": false
|
||||
},
|
||||
"editorScript": "file:./index.js",
|
||||
"style": [
|
||||
"file:./style-index.css"
|
||||
],
|
||||
"render": "file:./render.php"
|
||||
}
|
||||
@ -0,0 +1 @@
|
||||
<?php return array('dependencies' => array('react-jsx-runtime', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-i18n'), 'version' => 'c8dfeeece9537c9d6183');
|
||||
@ -0,0 +1 @@
|
||||
(()=>{"use strict";var e,t={5879(){const e=window.wp.blocks,t=window.wp.blockEditor,i=window.wp.components,s=window.wp.i18n,r=window.ReactJSXRuntime,o=JSON.parse('{"$schema":"https://schemas.wp.org/trunk/block.json","name":"activitypub/posts-and-replies","apiVersion":3,"version":"unreleased","title":"Posts and Replies","category":"widgets","description":"Display a tab bar to filter between posts only and posts with replies on author archives.","textdomain":"activitypub","icon":"admin-post","keywords":["fediverse","activitypub","posts","replies","tabs"],"supports":{"html":false},"editorScript":"file:./index.js","style":["file:./style-index.css"],"render":"file:./render.php"}');(0,e.registerBlockType)(o,{edit:function(){const e=(0,t.useBlockProps)();return(0,r.jsx)("div",{...e,children:(0,r.jsx)(i.Placeholder,{icon:"admin-post",label:(0,s.__)("Posts and Replies","activitypub"),instructions:(0,s.__)('Displays a tab bar to filter between "Posts" (excluding replies) and "Posts & Replies" on author archives. Place above a Query Loop block with "Inherit query from template" enabled.',"activitypub")})})},save:()=>null})}},i={};function s(e){var r=i[e];if(void 0!==r)return r.exports;var o=i[e]={exports:{}};return t[e](o,o.exports,s),o.exports}s.m=t,e=[],s.O=(t,i,r,o)=>{if(!i){var n=1/0;for(c=0;c<e.length;c++){for(var[i,r,o]=e[c],a=!0,p=0;p<i.length;p++)(!1&o||n>=o)&&Object.keys(s.O).every(e=>s.O[e](i[p]))?i.splice(p--,1):(a=!1,o<n&&(n=o));if(a){e.splice(c--,1);var l=r();void 0!==l&&(t=l)}}return t}o=o||0;for(var c=e.length;c>0&&e[c-1][2]>o;c--)e[c]=e[c-1];e[c]=[i,r,o]},s.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),(()=>{var e={642:0,6:0};s.O.j=t=>0===e[t];var t=(t,i)=>{var r,o,[n,a,p]=i,l=0;if(n.some(t=>0!==e[t])){for(r in a)s.o(a,r)&&(s.m[r]=a[r]);if(p)var c=p(s)}for(t&&t(i);l<n.length;l++)o=n[l],s.o(e,o)&&e[o]&&e[o][0](),e[o]=0;return s.O(c)},i=globalThis.webpackChunkwordpress_activitypub=globalThis.webpackChunkwordpress_activitypub||[];i.forEach(t.bind(null,0)),i.push=t.bind(null,i.push.bind(i))})();var r=s.O(void 0,[6],()=>s(5879));r=s.O(r)})();
|
||||
@ -0,0 +1,54 @@
|
||||
<?php
|
||||
/**
|
||||
* Server-side rendering of the `activitypub/posts-and-replies` block.
|
||||
*
|
||||
* Renders a tab bar that controls query filtering via URL parameter.
|
||||
* Works with a sibling `core/query` block that inherits from the template.
|
||||
* The actual query filtering happens in {@see Blocks::filter_query_loop_vars()}.
|
||||
*
|
||||
* @since 8.1.0
|
||||
*
|
||||
* @package Activitypub
|
||||
*/
|
||||
|
||||
use function Activitypub\is_activitypub_request;
|
||||
|
||||
if ( is_activitypub_request() || \is_feed() ) {
|
||||
return;
|
||||
}
|
||||
|
||||
/*
|
||||
* Determine active tab from URL parameter. Default to "Posts & Replies" so
|
||||
* the reply-exclusion filter only attaches on an explicit opt-in via
|
||||
* ?filter=posts (clicked from the tab bar below).
|
||||
*/
|
||||
// phpcs:ignore WordPress.Security.NonceVerification.Recommended
|
||||
$active_tab = isset( $_GET['filter'] ) ? \sanitize_key( \wp_unslash( $_GET['filter'] ) ) : 'posts-and-replies';
|
||||
if ( ! \in_array( $active_tab, array( 'posts', 'posts-and-replies' ), true ) ) {
|
||||
$active_tab = 'posts-and-replies';
|
||||
}
|
||||
|
||||
$current_url = \remove_query_arg( array( 'filter', 'paged' ) );
|
||||
$posts_url = \add_query_arg( 'filter', 'posts', $current_url );
|
||||
$all_url = \add_query_arg( 'filter', 'posts-and-replies', $current_url );
|
||||
|
||||
$wrapper_attributes = \get_block_wrapper_attributes();
|
||||
?>
|
||||
<nav <?php echo $wrapper_attributes; // phpcs:ignore WordPress.Security.EscapeOutput ?> aria-label="<?php \esc_attr_e( 'Post filtering', 'activitypub' ); ?>">
|
||||
<div class="ap-tabs">
|
||||
<a
|
||||
class="ap-tabs__tab <?php echo 'posts-and-replies' === $active_tab ? 'is-active' : ''; ?>"
|
||||
href="<?php echo \esc_url( $all_url ); ?>"
|
||||
<?php echo 'posts-and-replies' === $active_tab ? 'aria-current="page"' : ''; ?>
|
||||
>
|
||||
<?php \esc_html_e( 'Posts & Replies', 'activitypub' ); ?>
|
||||
</a>
|
||||
<a
|
||||
class="ap-tabs__tab <?php echo 'posts' === $active_tab ? 'is-active' : ''; ?>"
|
||||
href="<?php echo \esc_url( $posts_url ); ?>"
|
||||
<?php echo 'posts' === $active_tab ? 'aria-current="page"' : ''; ?>
|
||||
>
|
||||
<?php \esc_html_e( 'Posts', 'activitypub' ); ?>
|
||||
</a>
|
||||
</div>
|
||||
</nav>
|
||||
@ -0,0 +1 @@
|
||||
.wp-block-activitypub-posts-and-replies .ap-tabs{border-bottom:1px solid;display:flex;gap:0;margin-bottom:1.5em}.wp-block-activitypub-posts-and-replies .ap-tabs__tab{background:none;border:none;border-bottom:2px solid transparent;color:inherit;cursor:pointer;font-family:inherit;font-size:inherit;margin-bottom:-1px;opacity:.6;padding:.5em 1em;text-decoration:none;transition:opacity .2s,border-color .2s}.wp-block-activitypub-posts-and-replies .ap-tabs__tab:focus-visible,.wp-block-activitypub-posts-and-replies .ap-tabs__tab:hover{opacity:1}.wp-block-activitypub-posts-and-replies .ap-tabs__tab.is-active{border-bottom-color:currentcolor;opacity:1}
|
||||
@ -0,0 +1 @@
|
||||
.wp-block-activitypub-posts-and-replies .ap-tabs{border-bottom:1px solid;display:flex;gap:0;margin-bottom:1.5em}.wp-block-activitypub-posts-and-replies .ap-tabs__tab{background:none;border:none;border-bottom:2px solid transparent;color:inherit;cursor:pointer;font-family:inherit;font-size:inherit;margin-bottom:-1px;opacity:.6;padding:.5em 1em;text-decoration:none;transition:opacity .2s,border-color .2s}.wp-block-activitypub-posts-and-replies .ap-tabs__tab:focus-visible,.wp-block-activitypub-posts-and-replies .ap-tabs__tab:hover{opacity:1}.wp-block-activitypub-posts-and-replies .ap-tabs__tab.is-active{border-bottom-color:currentcolor;opacity:1}
|
||||
@ -0,0 +1,11 @@
|
||||
{
|
||||
"$schema": "https://schemas.wp.org/trunk/block.json",
|
||||
"apiVersion": 3,
|
||||
"name": "activitypub/pre-publish-panel",
|
||||
"title": "ActivityPub Post Format Suggestions",
|
||||
"category": "widgets",
|
||||
"description": "Suggests optimal post formats for ActivityPub federation before publishing.",
|
||||
"icon": "layout",
|
||||
"textdomain": "activitypub",
|
||||
"editorScript": "file:./plugin.js"
|
||||
}
|
||||
@ -0,0 +1 @@
|
||||
<?php return array('dependencies' => array('react-jsx-runtime', 'wp-block-editor', 'wp-components', 'wp-data', 'wp-dom', 'wp-editor', 'wp-element', 'wp-i18n', 'wp-plugins'), 'version' => '8bf8219b700555911ae5');
|
||||
@ -0,0 +1,3 @@
|
||||
(()=>{"use strict";const t=window.wp.editor,e=window.wp.blockEditor,o=window.wp.plugins,i=window.wp.components,n=window.wp.data,a=window.wp.element,s=window.wp.i18n,r=window.wp.dom,u=window._activityPubOptions?.noteLength||500,l=["youtube","vimeo","dailymotion","tiktok","videopress"],d=["spotify","soundcloud","mixcloud"],c=["core/paragraph","core/heading","core/list-item","core/preformatted","core/verse","core/pullquote"],p=["core/gallery","jetpack/tiled-gallery","jetpack/slideshow"],g={gallery:(0,s.__)("Gallery","activitypub"),video:(0,s.__)("Video","activitypub"),audio:(0,s.__)("Audio","activitypub"),image:(0,s.__)("Image","activitypub"),status:(0,s.__)("Status","activitypub")},m=(t,e)=>"core/pullquote"===t?e?.value||"":e?.content||"",h=t=>{const e={imageCount:0,galleryCount:0,videoCount:0,audioCount:0,textLength:0,textBlockCount:0};if(!t||!t.length)return e;for(const o of t){const{name:t,attributes:i,innerBlocks:n}=o;if("core/image"===t)e.imageCount++;else if(p.includes(t))e.galleryCount++;else if("core/video"===t)e.videoCount++;else if("core/audio"===t)e.audioCount++;else if("core/embed"===t){const t=(i?.providerNameSlug||"").toLowerCase();l.includes(t)?e.videoCount++:d.includes(t)&&e.audioCount++}if(c.includes(t)){const o=(0,r.__unstableStripHTML)(m(t,i));e.textLength+=o.length,e.textBlockCount++}if(n&&n.length){const t=h(n);e.imageCount+=t.imageCount,e.galleryCount+=t.galleryCount,e.videoCount+=t.videoCount,e.audioCount+=t.audioCount,e.textLength+=t.textLength,e.textBlockCount+=t.textBlockCount}}return e},v=window.ReactJSXRuntime;(0,o.registerPlugin)("activitypub-pre-publish",{render:()=>{const{blocks:o,postFormat:r}=(0,n.useSelect)(o=>({blocks:o(e.store).getBlocks(),postFormat:o(t.store).getEditedPostAttribute("format")}),[]),{editPost:l}=(0,n.useDispatch)(t.store),d=(0,a.useMemo)(()=>((t,e)=>{if(e&&"standard"!==e)return null;const o=h(t),i=o.imageCount>0||o.galleryCount>0||o.videoCount>0||o.audioCount>0;return(o.galleryCount>0||o.imageCount>1)&&o.textLength<u?{format:"gallery",message:(0,s.__)("This post contains multiple images. Changing the format to Gallery won't change your post content, but will share it as a media post on the Fediverse, making it visible on platforms like Pixelfed.","activitypub")}:o.videoCount>0&&o.textLength<u?{format:"video",message:(0,s.__)("This post contains a video. Changing the format to Video won't change your post content, but will share it as a media post on the Fediverse, improving compatibility with video-focused platforms.","activitypub")}:o.audioCount>0&&o.textLength<u?{format:"audio",message:(0,s.__)("This post contains audio content. Changing the format to Audio won't change your post content, but will share it as a media post on the Fediverse, improving compatibility with audio-focused platforms.","activitypub")}:1===o.imageCount&&0===o.videoCount&&0===o.audioCount&&o.textLength<u?{format:"image",message:(0,s.__)("This post contains an image. Changing the format to Image won't change your post content, but will share it as a media post on the Fediverse, making it visible on platforms like Pixelfed.","activitypub")}:!i&&o.textLength>0&&o.textLength<280&&o.textBlockCount<=3?{format:"status",message:(0,s.__)("This is a short post with no media. Changing the format to Status won't change your post content, but will share it as a Note on the Fediverse, which is the standard format on platforms like Mastodon.","activitypub")}:null})(o,r),[o,r]);if("wordpress-post-format"!==window._activityPubOptions?.objectType)return null;if(!d){if(r&&"standard"!==r&&g[r]){const e=g[r]||r;return(0,v.jsx)(t.PluginPrePublishPanel,{title:(0,s.__)("Fediverse ⁂","activitypub"),initialOpen:!0,children:(0,v.jsx)("p",{children:(0,s.sprintf)(/* translators: %s: The current post format name (e.g., "Image", "Gallery", "Video"). */ /* translators: %s: The current post format name (e.g., "Image", "Gallery", "Video"). */
|
||||
(0,s.__)("This post will be shared in %s format on the Fediverse.","activitypub"),e)})})}return null}return(0,v.jsxs)(t.PluginPrePublishPanel,{title:(0,s.__)("Fediverse ⁂","activitypub"),initialOpen:!0,children:[(0,v.jsx)("p",{children:d.message}),(0,v.jsx)(i.Button,{variant:"secondary",onClick:()=>l({format:d.format}),children:(0,s.sprintf)(/* translators: %s: The suggested post format name (e.g., "Image", "Gallery", "Video"). */ /* translators: %s: The suggested post format name (e.g., "Image", "Gallery", "Video"). */
|
||||
(0,s.__)("Set format to %s","activitypub"),g[d.format]||d.format)})]})}})})();
|
||||
@ -1,27 +1,66 @@
|
||||
{
|
||||
"$schema": "https://schemas.wp.org/trunk/block.json",
|
||||
"name": "activitypub/reactions",
|
||||
"apiVersion": 2,
|
||||
"version": "1.0.0",
|
||||
"apiVersion": 3,
|
||||
"version": "8.3.0",
|
||||
"title": "Fediverse Reactions",
|
||||
"category": "widgets",
|
||||
"icon": "heart",
|
||||
"description": "Display Fediverse likes and reposts",
|
||||
"supports": {
|
||||
"html": false,
|
||||
"align": true,
|
||||
"layout": {
|
||||
"default": {
|
||||
"type": "constrained",
|
||||
"orientation": "vertical",
|
||||
"justifyContent": "center"
|
||||
}
|
||||
"keywords": [
|
||||
"fediverse",
|
||||
"activitypub",
|
||||
"likes",
|
||||
"reposts"
|
||||
],
|
||||
"description": "Display Fediverse likes and reposts for your posts.",
|
||||
"example": {
|
||||
"attributes": {
|
||||
"className": "is-style-facepile"
|
||||
}
|
||||
},
|
||||
"styles": [
|
||||
{
|
||||
"name": "facepile",
|
||||
"label": "Facepile",
|
||||
"isDefault": true
|
||||
},
|
||||
{
|
||||
"name": "compact",
|
||||
"label": "Compact"
|
||||
}
|
||||
],
|
||||
"attributes": {
|
||||
"title": {
|
||||
"displayStyle": {
|
||||
"type": "string",
|
||||
"default": "Fediverse reactions"
|
||||
"default": "facepile"
|
||||
},
|
||||
"showActions": {
|
||||
"type": "boolean",
|
||||
"default": false
|
||||
}
|
||||
},
|
||||
"supports": {
|
||||
"align": [
|
||||
"wide",
|
||||
"full"
|
||||
],
|
||||
"color": {
|
||||
"gradients": true
|
||||
},
|
||||
"__experimentalBorder": {
|
||||
"radius": true,
|
||||
"width": true,
|
||||
"color": true,
|
||||
"style": true
|
||||
},
|
||||
"html": false,
|
||||
"interactivity": true,
|
||||
"shadow": true,
|
||||
"typography": {
|
||||
"fontSize": true,
|
||||
"__experimentalDefaultControls": {
|
||||
"fontSize": true
|
||||
}
|
||||
}
|
||||
},
|
||||
"blockHooks": {
|
||||
@ -29,9 +68,9 @@
|
||||
},
|
||||
"textdomain": "activitypub",
|
||||
"editorScript": "file:./index.js",
|
||||
"style": [
|
||||
"file:./style-index.css",
|
||||
"wp-components"
|
||||
],
|
||||
"viewScript": "file:./view.js"
|
||||
"style": "file:./style-index.css",
|
||||
"viewStyle": "file:./view.css",
|
||||
"viewScriptModule": "file:./view.js",
|
||||
"viewScript": "wp-api-fetch",
|
||||
"render": "file:./render.php"
|
||||
}
|
||||
@ -1 +1 @@
|
||||
<?php return array('dependencies' => array('react', 'wp-api-fetch', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-element', 'wp-i18n'), 'version' => '32631215c76c36b38e5e');
|
||||
<?php return array('dependencies' => array('react-jsx-runtime', 'wp-api-fetch', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-data', 'wp-element', 'wp-i18n'), 'version' => '1e13568c338d5be171c1');
|
||||
|
||||
@ -1,3 +1,4 @@
|
||||
(()=>{"use strict";var e,t={373:(e,t,a)=>{const n=window.wp.blocks,r=window.React,l=window.wp.blockEditor,o=window.wp.element,s=window.wp.i18n,i=window.wp.components,c=window.wp.apiFetch;var u=a.n(c);function m(){return window._activityPubOptions||{}}const p=({reactions:e})=>{const{defaultAvatarUrl:t}=m(),[a,n]=(0,o.useState)(new Set),[l,s]=(0,o.useState)(new Map),i=(0,o.useRef)([]),c=()=>{i.current.forEach((e=>clearTimeout(e))),i.current=[]},u=(t,a)=>{c();const r=100,l=e.length;a&&s((e=>{const a=new Map(e);return a.set(t,"clockwise"),a}));const o=e=>{const o="right"===e,c=o?l-1:0,u=o?1:-1;for(let e=o?t:t-1;o?e<=c:e>=c;e+=u){const l=Math.abs(e-t),o=setTimeout((()=>{n((t=>{const n=new Set(t);return a?n.add(e):n.delete(e),n})),a&&e!==t&&s((t=>{const a=new Map(t),n=e-u,r=a.get(n);return a.set(e,"clockwise"===r?"counter":"clockwise"),a}))}),l*r);i.current.push(o)}};if(o("right"),o("left"),!a){const e=Math.max((l-t)*r,t*r),a=setTimeout((()=>{s(new Map)}),e+r);i.current.push(a)}};return(0,o.useEffect)((()=>()=>c()),[]),(0,r.createElement)("ul",{className:"reaction-avatars"},e.map(((e,n)=>{const o=l.get(n),s=["reaction-avatar",a.has(n)?"wave-active":"",o?`rotate-${o}`:""].filter(Boolean).join(" "),i=e.avatar||t;return(0,r.createElement)("li",{key:n},(0,r.createElement)("a",{href:e.url,target:"_blank",rel:"noopener noreferrer",onMouseEnter:()=>u(n,!0),onMouseLeave:()=>u(n,!1)},(0,r.createElement)("img",{src:i,alt:e.name,className:s,width:"32",height:"32"})))})))},f=({reactions:e,type:t})=>(0,r.createElement)("ul",{className:"activitypub-reaction-list"},e.map(((e,t)=>(0,r.createElement)("li",{key:t},(0,r.createElement)("a",{href:e.url,className:"reaction-item",target:"_blank",rel:"noopener noreferrer"},(0,r.createElement)("img",{src:e.avatar,alt:e.name,width:"32",height:"32"}),(0,r.createElement)("span",null,e.name)))))),h=({items:e,label:t})=>{const[a,n]=(0,o.useState)(!1),[l,s]=(0,o.useState)(null),[c,u]=(0,o.useState)(e.length),m=(0,o.useRef)(null);(0,o.useEffect)((()=>{if(!m.current)return;const t=()=>{const t=m.current;if(!t)return;const a=t.offsetWidth-(l?.offsetWidth||0)-12,n=Math.max(1,Math.floor((a-32)/22));u(Math.min(n,e.length))};t();const a=new ResizeObserver(t);return a.observe(m.current),()=>{a.disconnect()}}),[l,e.length]);const h=e.slice(0,c);return(0,r.createElement)("div",{className:"reaction-group",ref:m},(0,r.createElement)(p,{reactions:h}),(0,r.createElement)(i.Button,{ref:s,className:"reaction-label is-link",onClick:()=>n(!a),"aria-expanded":a},t),a&&l&&(0,r.createElement)(i.Popover,{anchor:l,onClose:()=>n(!1)},(0,r.createElement)(f,{reactions:e})))};function d({title:e="",postId:t=null,reactions:a=null,titleComponent:n=null}){const{namespace:l}=m(),[s,i]=(0,o.useState)(a),[c,p]=(0,o.useState)(!a);return(0,o.useEffect)((()=>{if(a)return i(a),void p(!1);t?(p(!0),u()({path:`/${l}/posts/${t}/reactions`}).then((e=>{i(e),p(!1)})).catch((()=>p(!1)))):p(!1)}),[t,a]),c?null:s&&Object.values(s).some((e=>e.items?.length>0))?(0,r.createElement)("div",{className:"activitypub-reactions"},n||e&&(0,r.createElement)("h6",null,e),Object.entries(s).map((([e,t])=>t.items?.length?(0,r.createElement)(h,{key:e,items:t.items,label:t.label}):null))):null}const v=e=>{const t=["#FF6B6B","#4ECDC4","#45B7D1","#96CEB4","#FFEEAD","#D4A5A5","#9B59B6","#3498DB","#E67E22"],a=(()=>{const e=["Bouncy","Cosmic","Dancing","Fluffy","Giggly","Hoppy","Jazzy","Magical","Nifty","Perky","Quirky","Sparkly","Twirly","Wiggly","Zippy"],t=["Badger","Capybara","Dolphin","Echidna","Flamingo","Giraffe","Hedgehog","Iguana","Jellyfish","Koala","Lemur","Manatee","Narwhal","Octopus","Penguin"];return`${e[Math.floor(Math.random()*e.length)]} ${t[Math.floor(Math.random()*t.length)]}`})(),n=t[Math.floor(Math.random()*t.length)],r=a.charAt(0),l=document.createElement("canvas");l.width=64,l.height=64;const o=l.getContext("2d");return o.fillStyle=n,o.beginPath(),o.arc(32,32,32,0,2*Math.PI),o.fill(),o.fillStyle="#FFFFFF",o.font="32px sans-serif",o.textAlign="center",o.textBaseline="middle",o.fillText(r,32,32),{name:a,url:"#",avatar:l.toDataURL()}},g=JSON.parse('{"UU":"activitypub/reactions"}');(0,n.registerBlockType)(g.UU,{edit:function({attributes:e,setAttributes:t,__unstableLayoutClassNames:a}){const n=(0,l.useBlockProps)({className:a}),[i]=(0,o.useState)({likes:{label:(0,s.sprintf)(/* translators: %d: Number of likes */ /* translators: %d: Number of likes */
|
||||
(0,s._x)("%d likes","number of likes","activitypub"),9),items:Array.from({length:9},((e,t)=>v()))},reposts:{label:(0,s.sprintf)(/* translators: %d: Number of reposts */ /* translators: %d: Number of reposts */
|
||||
(0,s._x)("%d reposts","number of reposts","activitypub"),6),items:Array.from({length:6},((e,t)=>v()))}}),c=(0,r.createElement)(l.RichText,{tagName:"h6",value:e.title,onChange:e=>t({title:e}),placeholder:(0,s.__)("Fediverse Reactions","activitypub"),disableLineBreaks:!0,allowedFormats:[]});return(0,r.createElement)("div",{...n},(0,r.createElement)(d,{titleComponent:c,reactions:i}))}})}},a={};function n(e){var r=a[e];if(void 0!==r)return r.exports;var l=a[e]={exports:{}};return t[e](l,l.exports,n),l.exports}n.m=t,e=[],n.O=(t,a,r,l)=>{if(!a){var o=1/0;for(u=0;u<e.length;u++){a=e[u][0],r=e[u][1],l=e[u][2];for(var s=!0,i=0;i<a.length;i++)(!1&l||o>=l)&&Object.keys(n.O).every((e=>n.O[e](a[i])))?a.splice(i--,1):(s=!1,l<o&&(o=l));if(s){e.splice(u--,1);var c=r();void 0!==c&&(t=c)}}return t}l=l||0;for(var u=e.length;u>0&&e[u-1][2]>l;u--)e[u]=e[u-1];e[u]=[a,r,l]},n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var a in t)n.o(t,a)&&!n.o(e,a)&&Object.defineProperty(e,a,{enumerable:!0,get:t[a]})},n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),(()=>{var e={608:0,104:0};n.O.j=t=>0===e[t];var t=(t,a)=>{var r,l,o=a[0],s=a[1],i=a[2],c=0;if(o.some((t=>0!==e[t]))){for(r in s)n.o(s,r)&&(n.m[r]=s[r]);if(i)var u=i(n)}for(t&&t(a);c<o.length;c++)l=o[c],n.o(e,l)&&e[l]&&e[l][0](),e[l]=0;return n.O(u)},a=self.webpackChunkwordpress_activitypub=self.webpackChunkwordpress_activitypub||[];a.forEach(t.bind(null,0)),a.push=t.bind(null,a.push.bind(a))})();var r=n.O(void 0,[104],(()=>n(373)));r=n.O(r)})();
|
||||
(()=>{"use strict";var e,t={2091(e,t,s){const i=window.wp.blocks,r=window.wp.blockEditor,a=window.ReactJSXRuntime,n=[{attributes:{},supports:{html:!1,align:!0,layout:{default:{type:"constrained",orientation:"vertical",justifyContent:"center"}}},save:()=>(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(r.InnerBlocks.Content,{}),(0,a.jsx)("div",{className:"activitypub-reactions-block"})]})},{attributes:{title:{type:"string",default:"Fediverse reactions"}},supports:{html:!1,align:!0,layout:{default:{type:"constrained",orientation:"vertical",justifyContent:"center"}}},save:()=>null,isEligible:({title:e})=>!!e,migrate:({title:e,...t})=>[t,[(0,i.createBlock)("core/heading",{content:e,level:6})]]}];function o(e){var t,s,i="";if("string"==typeof e||"number"==typeof e)i+=e;else if("object"==typeof e)if(Array.isArray(e)){var r=e.length;for(t=0;t<r;t++)e[t]&&(s=o(e[t]))&&(i&&(i+=" "),i+=s)}else for(s in e)e[s]&&(i&&(i+=" "),i+=s);return i}const l=function(){for(var e,t,s=0,i="",r=arguments.length;s<r;s++)(e=arguments[s])&&(t=o(e))&&(i&&(i+=" "),i+=t);return i},c=window.wp.components,p=window.wp.i18n,u=window.wp.data,d=window.wp.element,f=window.wp.apiFetch;var v=s.n(f);function y(){return window._activityPubOptions||{}}const m={like:(0,p.__)("Like","activitypub"),likes:(0,p.__)("Like","activitypub"),repost:(0,p.__)("Repost","activitypub"),reposts:(0,p.__)("Repost","activitypub"),quote:(0,p.__)("Quote","activitypub"),quotes:(0,p.__)("Quote","activitypub")},h=({reactions:e,displayStyle:t})=>{const{defaultAvatarUrl:s}=y();return"compact"===t?null:(0,a.jsx)("ul",{className:"reaction-avatars",children:e.map((e,t)=>{const i=["reaction-avatar"].filter(Boolean).join(" "),r=e.avatar||s;return(0,a.jsx)("li",{children:(0,a.jsx)("a",{href:e.url,target:"_blank",rel:"noopener noreferrer",children:(0,a.jsx)("img",{src:r,alt:e.name,className:i,width:"32",height:"32",onError:e=>{e.target.src=s}})})},t)})})},b=({reactions:e,displayStyle:t})=>{const{defaultAvatarUrl:s}=y();return(0,a.jsx)("ul",{className:"reactions-list",children:e.map((e,i)=>{const r=e.avatar||s;return(0,a.jsx)("li",{className:"reaction-item",children:(0,a.jsxs)("a",{href:e.url,className:"reaction-item",target:"_blank",rel:"noopener noreferrer",children:["facepile"===t&&(0,a.jsx)("img",{src:r,alt:e.name,width:"32",height:"32",onError:e=>{e.target.src=s}}),(0,a.jsx)("span",{className:"reaction-name",children:e.name})]})},i)})})},w=({items:e,label:t,displayStyle:s,showActions:i,actionLabel:r})=>{const[n,o]=(0,d.useState)(!1),[l,p]=(0,d.useState)(null),u=(0,d.useRef)(null),f=e.slice(0,20);return(0,a.jsxs)("div",{className:"reaction-group",ref:u,children:[i&&r&&(0,a.jsx)("button",{className:"reaction-action-button wp-element-button",type:"button",disabled:!0,children:r}),(0,a.jsx)(h,{reactions:f,displayStyle:s}),(0,a.jsx)(c.Button,{ref:p,className:"reaction-label is-link",onClick:()=>o(!n),"aria-expanded":n,children:t}),n&&l&&(0,a.jsx)(c.Popover,{anchor:l,onClose:()=>o(!1),className:"activitypub-popover",children:(0,a.jsx)(b,{reactions:e,displayStyle:s})})]})};function g({postId:e=null,reactions:t=null,fallbackReactions:s=null,displayStyle:i="facepile",showActions:r=!1}){const{namespace:n}=y(),[o,l]=(0,d.useState)(t),[c,p]=(0,d.useState)(!t),u=(0,d.useCallback)(()=>{s&&l(s),p(!1)},[s]);return(0,d.useEffect)(()=>{if(t)return l(t),void p(!1);e&&"number"==typeof e?(p(!0),v()({path:`/${n}/posts/${e}/reactions`}).then(e=>{const t=Object.values(e).some(e=>e.items?.length>0);l(!t&&s?s:e),p(!1)}).catch(u)):u()},[e,t,s,n,u]),c?null:o&&Object.values(o).some(e=>e.items?.length>0)?(0,a.jsx)("div",{className:"activitypub-reactions",children:Object.entries(o).map(([e,t])=>t.items?.length?(0,a.jsx)(w,{items:t.items,label:t.label,displayStyle:i,showActions:r,actionLabel:m[e]},e):null)}):null}const x=(e,t,s,i)=>Array.from({length:e},(e,r)=>({name:`${t} ${r+1}`,url:"#",avatar:`data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 64 64'%3E%3Ccircle cx='32' cy='32' r='32' fill='%23${i[r%i.length]}'/%3E%3Ctext x='32' y='38' font-family='sans-serif' font-size='24' fill='white' text-anchor='middle'%3E${String.fromCharCode(s+r)}%3C/text%3E%3C/svg%3E`})),j=["FF6B6B","4ECDC4","45B7D1","96CEB4","D4A5A5","9B59B6","3498DB","E67E22"],k={likes:{label:(0,p.sprintf)(/* translators: %d: Number of likes */ /* translators: %d: Number of likes */
|
||||
(0,p._x)("%d likes","number of likes","activitypub"),9),items:x(9,"User",65,j)},reposts:{label:(0,p.sprintf)(/* translators: %d: Number of reposts */ /* translators: %d: Number of reposts */
|
||||
(0,p._x)("%d reposts","number of reposts","activitypub"),6),items:x(6,"Reposter",82,j)},quotes:{label:(0,p.sprintf)(/* translators: %d: Number of quotes */ /* translators: %d: Number of quotes */
|
||||
(0,p._x)("%d quotes","number of quotes","activitypub"),7),items:x(7,"Quoter",81,j)}},_=JSON.parse('{"$schema":"https://schemas.wp.org/trunk/block.json","name":"activitypub/reactions","apiVersion":3,"version":"8.2.1","title":"Fediverse Reactions","category":"widgets","icon":"heart","keywords":["fediverse","activitypub","likes","reposts"],"description":"Display Fediverse likes and reposts for your posts.","example":{"attributes":{"className":"is-style-facepile"}},"styles":[{"name":"facepile","label":"Facepile","isDefault":true},{"name":"compact","label":"Compact"}],"attributes":{"displayStyle":{"type":"string","default":"facepile"},"showActions":{"type":"boolean","default":false}},"supports":{"align":["wide","full"],"color":{"gradients":true},"__experimentalBorder":{"radius":true,"width":true,"color":true,"style":true},"html":false,"interactivity":true,"shadow":true,"typography":{"fontSize":true,"__experimentalDefaultControls":{"fontSize":true}}},"blockHooks":{"core/post-content":"after"},"textdomain":"activitypub","editorScript":"file:./index.js","style":"file:./style-index.css","viewStyle":"file:./view.css","viewScriptModule":"file:./view.js","viewScript":"wp-api-fetch","render":"file:./render.php"}');(0,i.registerBlockType)(_,{deprecated:n,edit:function({attributes:e,setAttributes:t}){const{className:s="",displayStyle:i="facepile",showActions:n=!1}=e,o=(0,r.useBlockProps)(),{getCurrentPostId:f}=(0,u.select)("core/editor"),{showAvatars:v=!0}=y(),m=(0,d.useRef)(!1);(0,d.useEffect)(()=>{if(m.current)return;m.current=!0;const e=s?.includes("is-style-");if(!e){const e=v?"facepile":"compact";t({className:l(s,`is-style-${e}`),displayStyle:e})}},[s,v,t]);const h=s?.includes("is-style-compact")?"compact":"facepile";(0,d.useEffect)(()=>{h!==i&&t({displayStyle:h})},[h,i,t]);const b=[["core/heading",{level:6,placeholder:(0,p.__)("Fediverse Reactions","activitypub"),content:(0,p.__)("Fediverse Reactions","activitypub")}]];return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(r.InspectorControls,{children:(0,a.jsx)(c.PanelBody,{title:(0,p.__)("Action Buttons","activitypub"),children:(0,a.jsx)(c.ToggleControl,{__nextHasNoMarginBottom:!0,label:(0,p.__)("Show action buttons","activitypub"),help:(0,p.__)("Display Like and Boost buttons so visitors can interact from their Fediverse server.","activitypub"),checked:n,onChange:e=>t({showActions:e})})})}),(0,a.jsxs)("div",{...o,children:[(0,a.jsx)(r.InnerBlocks,{template:b,allowedBlocks:["core/heading"],templateLock:"all",renderAppender:!1}),(0,a.jsx)(g,{postId:f(),fallbackReactions:k,displayStyle:i,showActions:n})]})]})},save:function(){return(0,a.jsx)("div",{...r.useBlockProps.save(),children:(0,a.jsx)(r.InnerBlocks.Content,{})})}})}},s={};function i(e){var r=s[e];if(void 0!==r)return r.exports;var a=s[e]={exports:{}};return t[e](a,a.exports,i),a.exports}i.m=t,e=[],i.O=(t,s,r,a)=>{if(!s){var n=1/0;for(p=0;p<e.length;p++){for(var[s,r,a]=e[p],o=!0,l=0;l<s.length;l++)(!1&a||n>=a)&&Object.keys(i.O).every(e=>i.O[e](s[l]))?s.splice(l--,1):(o=!1,a<n&&(n=a));if(o){e.splice(p--,1);var c=r();void 0!==c&&(t=c)}}return t}a=a||0;for(var p=e.length;p>0&&e[p-1][2]>a;p--)e[p]=e[p-1];e[p]=[s,r,a]},i.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return i.d(t,{a:t}),t},i.d=(e,t)=>{for(var s in t)i.o(t,s)&&!i.o(e,s)&&Object.defineProperty(e,s,{enumerable:!0,get:t[s]})},i.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),(()=>{var e={608:0,104:0};i.O.j=t=>0===e[t];var t=(t,s)=>{var r,a,[n,o,l]=s,c=0;if(n.some(t=>0!==e[t])){for(r in o)i.o(o,r)&&(i.m[r]=o[r]);if(l)var p=l(i)}for(t&&t(s);c<n.length;c++)a=n[c],i.o(e,a)&&e[a]&&e[a][0](),e[a]=0;return i.O(p)},s=globalThis.webpackChunkwordpress_activitypub=globalThis.webpackChunkwordpress_activitypub||[];s.forEach(t.bind(null,0)),s.push=t.bind(null,s.push.bind(s))})();var r=i.O(void 0,[104],()=>i(2091));r=i.O(r)})();
|
||||
418
wp-content/plugins/activitypub/build/reactions/render.php
Normal file
@ -0,0 +1,418 @@
|
||||
<?php
|
||||
/**
|
||||
* Server-side rendering of the `activitypub/reactions` block.
|
||||
*
|
||||
* @package ActivityPub
|
||||
*/
|
||||
|
||||
use Activitypub\Blocks;
|
||||
use Activitypub\Comment;
|
||||
|
||||
use function Activitypub\get_post_id;
|
||||
use function Activitypub\is_activitypub_request;
|
||||
use function Activitypub\is_post_publicly_queryable;
|
||||
|
||||
if ( is_activitypub_request() || is_feed() ) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Get the default display style based on WordPress avatar settings.
|
||||
$default_display_style = get_option( 'show_avatars', true ) ? 'facepile' : 'compact';
|
||||
|
||||
/* @var array $attributes Block attributes. */
|
||||
$attributes = wp_parse_args(
|
||||
$attributes,
|
||||
array(
|
||||
'align' => null,
|
||||
'displayStyle' => $default_display_style,
|
||||
'showActions' => false,
|
||||
)
|
||||
);
|
||||
|
||||
/* @var \WP_Block $block Current block. */
|
||||
$block = $block ?? '';
|
||||
|
||||
/* @var string $content Block content. */
|
||||
$content = $content ?? '';
|
||||
|
||||
if ( empty( $content ) ) {
|
||||
// Fallback for v1.0.0 blocks.
|
||||
$_title = $attributes['title'] ?? __( 'Fediverse Reactions', 'activitypub' );
|
||||
$content = '<h6 class="wp-block-heading">' . esc_html( $_title ) . '</h6>';
|
||||
unset( $attributes['title'] );
|
||||
} else {
|
||||
$content = implode( PHP_EOL, wp_list_pluck( $block->parsed_block['innerBlocks'], 'innerHTML' ) );
|
||||
// Hide empty headings.
|
||||
if ( empty( wp_strip_all_tags( $content ) ) ) {
|
||||
$content = '';
|
||||
}
|
||||
}
|
||||
|
||||
// Get the Post ID from attributes or use the current post.
|
||||
$_post_id = $attributes['postId'] ?? get_the_ID();
|
||||
|
||||
// Don't leak reaction metadata for posts that are not currently publicly queryable.
|
||||
if ( ! is_post_publicly_queryable( $_post_id ) ) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Generate a unique ID for the block.
|
||||
$block_id = 'activitypub-reactions-block-' . wp_unique_id();
|
||||
|
||||
/*
|
||||
* Determine display style - compact style hides avatars.
|
||||
* For auto-hooked blocks without explicit style, use avatar setting to determine style.
|
||||
*/
|
||||
$has_style_class = isset( $attributes['className'] ) && strpos( $attributes['className'], 'is-style-' ) !== false;
|
||||
if ( ! $has_style_class ) {
|
||||
$attributes['className'] = trim( ( $attributes['className'] ?? '' ) . ' is-style-' . $default_display_style );
|
||||
$attributes['displayStyle'] = $default_display_style;
|
||||
}
|
||||
|
||||
$show_avatars = 'facepile' === $attributes['displayStyle'];
|
||||
|
||||
// Fetch reactions.
|
||||
$reactions = array();
|
||||
|
||||
foreach ( Comment::get_comment_types() as $_type => $type_object ) {
|
||||
$_comments = get_comments(
|
||||
array(
|
||||
'post_id' => $_post_id,
|
||||
'type' => $_type,
|
||||
'status' => 'approve',
|
||||
'parent' => 0,
|
||||
)
|
||||
);
|
||||
|
||||
if ( empty( $_comments ) ) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$count = count( $_comments );
|
||||
// phpcs:disable WordPress.WP.I18n
|
||||
$label = sprintf(
|
||||
_n(
|
||||
$type_object['count_single'],
|
||||
$type_object['count_plural'],
|
||||
$count,
|
||||
'activitypub'
|
||||
),
|
||||
number_format_i18n( $count )
|
||||
);
|
||||
// phpcs:enable WordPress.WP.I18n
|
||||
|
||||
$reactions[ $_type ] = array(
|
||||
'label' => $label,
|
||||
'count' => $count,
|
||||
'items' => array_map(
|
||||
static function ( $comment ) {
|
||||
return array(
|
||||
'name' => html_entity_decode( $comment->comment_author ),
|
||||
'url' => $comment->comment_author_url,
|
||||
'avatar' => get_avatar_url( $comment ),
|
||||
);
|
||||
},
|
||||
$_comments
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
if ( empty( $reactions ) && ! $attributes['showActions'] ) {
|
||||
echo '<!-- Reactions block: No reactions found. -->';
|
||||
return;
|
||||
}
|
||||
|
||||
// Set up the Interactivity API config.
|
||||
$config = array(
|
||||
'defaultAvatarUrl' => ACTIVITYPUB_PLUGIN_URL . 'assets/img/mp.jpg',
|
||||
'namespace' => ACTIVITYPUB_REST_NAMESPACE,
|
||||
);
|
||||
|
||||
if ( $attributes['showActions'] ) {
|
||||
$config['i18n'] = array(
|
||||
'copied' => __( 'Copied!', 'activitypub' ),
|
||||
'copy' => __( 'Copy', 'activitypub' ),
|
||||
'emptyProfileError' => __( 'Please enter a profile URL or handle.', 'activitypub' ),
|
||||
'genericError' => __( 'An error occurred. Please try again.', 'activitypub' ),
|
||||
'intentLabelLike' => __( 'Like this post', 'activitypub' ),
|
||||
'intentLabelAnnounce' => __( 'Boost this post', 'activitypub' ),
|
||||
'invalidProfileError' => __( 'Please enter a valid profile URL or handle.', 'activitypub' ),
|
||||
);
|
||||
}
|
||||
|
||||
wp_interactivity_config( 'activitypub/reactions', $config );
|
||||
|
||||
// Set up the Interactivity API state.
|
||||
wp_interactivity_state( 'activitypub/reactions', array( 'reactions' => array( $_post_id => $reactions ) ) );
|
||||
|
||||
// Render a subset of the most recent reactions for facepile.
|
||||
$reactions = array_map(
|
||||
static function ( $reaction ) use ( $attributes ) {
|
||||
$count = 20;
|
||||
if ( 'wide' === $attributes['align'] ) {
|
||||
$count = 40;
|
||||
} elseif ( 'full' === $attributes['align'] ) {
|
||||
$count = 60;
|
||||
}
|
||||
|
||||
$reaction['items'] = array_slice( array_reverse( $reaction['items'] ), 0, $count );
|
||||
|
||||
return $reaction;
|
||||
},
|
||||
$reactions
|
||||
);
|
||||
|
||||
// Initialize the context for the block.
|
||||
$context = array(
|
||||
'blockId' => $block_id,
|
||||
'modal' => array(
|
||||
'isCompact' => true,
|
||||
'isOpen' => false,
|
||||
'items' => array(),
|
||||
'title' => '',
|
||||
),
|
||||
'postId' => $_post_id,
|
||||
'reactions' => $reactions,
|
||||
);
|
||||
|
||||
if ( $attributes['showActions'] ) {
|
||||
$context['modal']['intent'] = '';
|
||||
$context['copyButtonText'] = __( 'Copy', 'activitypub' );
|
||||
$context['errorMessage'] = '';
|
||||
$context['isError'] = false;
|
||||
$context['isLoading'] = false;
|
||||
$context['postUrl'] = get_post_id( $_post_id );
|
||||
$context['remoteProfile'] = '';
|
||||
$context['shouldSaveProfile'] = true;
|
||||
}
|
||||
|
||||
// Map comment types to remote intent types.
|
||||
$intent_map = array(
|
||||
'like' => 'like',
|
||||
'repost' => 'announce',
|
||||
'quote' => 'announce',
|
||||
);
|
||||
|
||||
// Build reactions content.
|
||||
ob_start();
|
||||
?>
|
||||
<div class="activitypub-reactions">
|
||||
<?php
|
||||
// First pass: render reaction types that have items (full treatment).
|
||||
foreach ( $reactions as $_type => $reaction ) :
|
||||
/* translators: %s: reaction type. */
|
||||
$aria_label = sprintf( __( 'View all %s', 'activitypub' ), Comment::get_comment_type_attr( $_type, 'label' ) );
|
||||
$intent = isset( $intent_map[ $_type ] ) ? $intent_map[ $_type ] : '';
|
||||
?>
|
||||
<div class="reaction-group" data-reaction-type="<?php echo esc_attr( $_type ); ?>">
|
||||
<?php if ( $attributes['showActions'] && $intent ) : ?>
|
||||
<button
|
||||
class="reaction-action-button has-text-color has-background"
|
||||
data-intent="<?php echo esc_attr( $intent ); ?>"
|
||||
data-wp-on--click="actions.openIntentModal"
|
||||
type="button"
|
||||
aria-label="<?php echo esc_attr( Comment::get_comment_type_attr( $_type, 'singular' ) ); ?>"
|
||||
>
|
||||
<?php echo esc_html( Comment::get_comment_type_attr( $_type, 'singular' ) ); ?>
|
||||
</button>
|
||||
<?php endif; ?>
|
||||
<?php if ( $show_avatars ) : ?>
|
||||
<ul class="reaction-avatars">
|
||||
<template data-wp-each="context.reactions.<?php echo esc_attr( $_type ); ?>.items">
|
||||
<li>
|
||||
<a
|
||||
data-wp-bind--href="context.item.url"
|
||||
data-wp-bind--title="context.item.name"
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
>
|
||||
<img
|
||||
data-wp-bind--src="context.item.avatar"
|
||||
data-wp-bind--alt="context.item.name"
|
||||
data-wp-on--error="callbacks.setDefaultAvatar"
|
||||
class="reaction-avatar"
|
||||
height="32"
|
||||
width="32"
|
||||
src=""
|
||||
alt=""
|
||||
/>
|
||||
</a>
|
||||
</li>
|
||||
</template>
|
||||
</ul>
|
||||
<?php endif; ?>
|
||||
<button
|
||||
class="reaction-label has-text-color has-background"
|
||||
data-reaction-type="<?php echo esc_attr( $_type ); ?>"
|
||||
data-wp-on--click="actions.toggleModal"
|
||||
type="button"
|
||||
aria-label="<?php echo esc_attr( $aria_label ); ?>"
|
||||
>
|
||||
<?php echo esc_html( $reaction['label'] ); ?>
|
||||
</button>
|
||||
</div>
|
||||
<?php endforeach; ?>
|
||||
<?php
|
||||
// Second pass: render action buttons for reaction types without items.
|
||||
if ( $attributes['showActions'] ) :
|
||||
$empty_types = array_diff_key( $intent_map, $reactions );
|
||||
|
||||
if ( ! empty( $empty_types ) ) :
|
||||
?>
|
||||
<div class="reaction-actions-only" role="group" aria-label="<?php esc_attr_e( 'Reaction actions', 'activitypub' ); ?>">
|
||||
<?php foreach ( $empty_types as $_type => $intent ) : ?>
|
||||
<button
|
||||
class="reaction-action-button has-text-color has-background"
|
||||
data-intent="<?php echo esc_attr( $intent ); ?>"
|
||||
data-wp-on--click="actions.openIntentModal"
|
||||
type="button"
|
||||
aria-label="<?php echo esc_attr( Comment::get_comment_type_attr( $_type, 'singular' ) ); ?>"
|
||||
>
|
||||
<?php echo esc_html( Comment::get_comment_type_attr( $_type, 'singular' ) ); ?>
|
||||
</button>
|
||||
<?php endforeach; ?>
|
||||
</div>
|
||||
<?php
|
||||
endif;
|
||||
endif;
|
||||
?>
|
||||
</div>
|
||||
<?php
|
||||
$reactions_content = ob_get_clean();
|
||||
|
||||
// Build modal content: reactors list (compact) + intent dialog (full-size).
|
||||
ob_start();
|
||||
?>
|
||||
<div data-wp-bind--hidden="!context.modal.isCompact">
|
||||
<ul class="reactions-list">
|
||||
<template data-wp-each="context.modal.items">
|
||||
<li class="reaction-item">
|
||||
<a data-wp-bind--href="context.item.url" target="_blank" rel="noopener noreferrer">
|
||||
<?php if ( $show_avatars ) : ?>
|
||||
<img
|
||||
alt=""
|
||||
data-wp-bind--alt="context.item.name"
|
||||
data-wp-bind--src="context.item.avatar"
|
||||
data-wp-on--error="callbacks.setDefaultAvatar"
|
||||
src=""
|
||||
/>
|
||||
<?php endif; ?>
|
||||
<span class="reaction-name" data-wp-text="context.item.name"></span>
|
||||
</a>
|
||||
</li>
|
||||
</template>
|
||||
</ul>
|
||||
</div>
|
||||
<?php if ( $attributes['showActions'] ) : ?>
|
||||
<div class="activitypub-intent-dialog" data-wp-bind--hidden="context.modal.isCompact">
|
||||
<div class="activitypub-dialog__section">
|
||||
<h4><?php esc_html_e( 'Post URL', 'activitypub' ); ?></h4>
|
||||
<div class="activitypub-dialog__description">
|
||||
<?php esc_html_e( 'Paste the post URL into the search field of your favorite open social app or platform.', 'activitypub' ); ?>
|
||||
</div>
|
||||
<div class="activitypub-dialog__button-group">
|
||||
<label for="<?php echo esc_attr( $block_id . '-post-url' ); ?>" class="screen-reader-text">
|
||||
<?php esc_html_e( 'Post URL', 'activitypub' ); ?>
|
||||
</label>
|
||||
<input
|
||||
aria-readonly="true"
|
||||
class="wp-block-search__input"
|
||||
id="<?php echo esc_attr( $block_id . '-post-url' ); ?>"
|
||||
readonly
|
||||
tabindex="-1"
|
||||
type="text"
|
||||
data-wp-bind--value="context.postUrl"
|
||||
/>
|
||||
<button
|
||||
aria-label="<?php esc_attr_e( 'Copy URL to clipboard', 'activitypub' ); ?>"
|
||||
class="wp-element-button"
|
||||
data-wp-on--click="actions.copyPostUrl"
|
||||
type="button"
|
||||
>
|
||||
<span data-wp-text="context.copyButtonText"></span>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="activitypub-dialog__section">
|
||||
<h4><?php esc_html_e( 'Your Profile', 'activitypub' ); ?></h4>
|
||||
<div class="activitypub-dialog__description">
|
||||
<?php esc_html_e( 'Or, if you know your own profile, we can start things that way!', 'activitypub' ); ?>
|
||||
<?php Blocks::render_modal_help(); ?>
|
||||
</div>
|
||||
<div class="activitypub-dialog__button-group">
|
||||
<label for="<?php echo esc_attr( $block_id . '-remote-profile' ); ?>" class="screen-reader-text">
|
||||
<?php esc_html_e( 'Your Fediverse profile', 'activitypub' ); ?>
|
||||
</label>
|
||||
<input
|
||||
class="wp-block-search__input"
|
||||
data-wp-bind--aria-invalid="context.isError"
|
||||
data-wp-bind--value="context.remoteProfile"
|
||||
data-wp-on--input="actions.updateIntentProfile"
|
||||
data-wp-on--keydown="actions.onIntentKeydown"
|
||||
id="<?php echo esc_attr( $block_id . '-remote-profile' ); ?>"
|
||||
placeholder="<?php esc_attr_e( '@username@example.com', 'activitypub' ); ?>"
|
||||
type="text"
|
||||
/>
|
||||
<button
|
||||
class="wp-element-button"
|
||||
data-wp-bind--disabled="context.isLoading"
|
||||
data-wp-on--click="actions.submitIntent"
|
||||
type="button"
|
||||
>
|
||||
<span data-wp-bind--hidden="context.isLoading"><?php esc_html_e( 'Go', 'activitypub' ); ?></span>
|
||||
<span data-wp-bind--hidden="!context.isLoading"><?php esc_html_e( 'Loading…', 'activitypub' ); ?></span>
|
||||
</button>
|
||||
</div>
|
||||
<div
|
||||
class="activitypub-dialog__error"
|
||||
data-wp-bind--hidden="!context.isError"
|
||||
data-wp-text="context.errorMessage"
|
||||
></div>
|
||||
<div class="activitypub-dialog__remember">
|
||||
<label>
|
||||
<input
|
||||
checked
|
||||
data-wp-bind--checked="context.shouldSaveProfile"
|
||||
data-wp-on--change="actions.toggleRememberProfile"
|
||||
type="checkbox"
|
||||
/>
|
||||
<?php esc_html_e( 'Remember my profile for future interactions.', 'activitypub' ); ?>
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
<?php
|
||||
$modal_content = ob_get_clean();
|
||||
|
||||
// Render the shared modal with both contents.
|
||||
$modal_args = array(
|
||||
'content' => $modal_content,
|
||||
);
|
||||
|
||||
if ( $attributes['showActions'] ) {
|
||||
$modal_args['title_binding'] = 'context.modal.title';
|
||||
} else {
|
||||
$modal_args['is_compact'] = true;
|
||||
}
|
||||
|
||||
ob_start();
|
||||
Blocks::render_modal( $modal_args );
|
||||
$inner_content = $reactions_content . ob_get_clean();
|
||||
|
||||
$wrapper_attrs = array(
|
||||
'id' => $block_id,
|
||||
'class' => $attributes['className'] ?? '',
|
||||
'data-wp-interactive' => 'activitypub/reactions',
|
||||
'data-wp-context' => wp_json_encode( $context, JSON_HEX_TAG | JSON_HEX_APOS | JSON_HEX_QUOT | JSON_HEX_AMP ),
|
||||
'data-wp-init' => 'callbacks.initReactions',
|
||||
);
|
||||
|
||||
$wrapper_attributes = get_block_wrapper_attributes( $wrapper_attrs );
|
||||
|
||||
// Render the block with common wrapper.
|
||||
?>
|
||||
<div <?php echo $wrapper_attributes; // phpcs:ignore WordPress.Security.EscapeOutput ?>>
|
||||
<?php echo $content; // phpcs:ignore WordPress.Security.EscapeOutput ?>
|
||||
<?php echo $inner_content; // phpcs:ignore WordPress.Security.EscapeOutput ?>
|
||||
</div>
|
||||
@ -1 +1 @@
|
||||
<?php return array('dependencies' => array('react', 'wp-api-fetch', 'wp-components', 'wp-dom-ready', 'wp-element', 'wp-i18n'), 'version' => 'd5cb95d9bd6062974b3c');
|
||||
<?php return array('dependencies' => array('@wordpress/interactivity'), 'version' => 'c92a83cbb3c92ac4f478', 'type' => 'module');
|
||||
|
||||
1
wp-content/plugins/activitypub/build/reactions/view.css
Normal file
@ -0,0 +1 @@
|
||||
.wp-block-activitypub-reactions .activitypub-modal__overlay.compact .activitypub-modal__frame{max-width:100%;min-width:250px}
|
||||
@ -2,10 +2,19 @@
|
||||
"$schema": "https://schemas.wp.org/trunk/block.json",
|
||||
"name": "activitypub/remote-reply",
|
||||
"apiVersion": 3,
|
||||
"version": "1.0.0",
|
||||
"version": "8.3.0",
|
||||
"title": "Reply on the Fediverse",
|
||||
"category": "widgets",
|
||||
"description": "",
|
||||
"description": "Allow visitors to reply to your posts from their Fediverse account.",
|
||||
"keywords": [
|
||||
"fediverse",
|
||||
"activitypub",
|
||||
"reply",
|
||||
"comments"
|
||||
],
|
||||
"textdomain": "activitypub",
|
||||
"viewScript": "file:./index.js"
|
||||
"style": "file:./style-view.css",
|
||||
"viewScriptModule": "file:./view.js",
|
||||
"viewScript": "wp-api-fetch",
|
||||
"render": "file:./render.php"
|
||||
}
|
||||
@ -1 +0,0 @@
|
||||
<?php return array('dependencies' => array('react', 'wp-api-fetch', 'wp-components', 'wp-compose', 'wp-dom-ready', 'wp-element', 'wp-i18n', 'wp-primitives'), 'version' => '7160b6399cd924e1c7be');
|
||||
215
wp-content/plugins/activitypub/build/remote-reply/render.php
Normal file
@ -0,0 +1,215 @@
|
||||
<?php
|
||||
/**
|
||||
* Server-side rendering of the `activitypub/remote-reply` block.
|
||||
*
|
||||
* @package ActivityPub
|
||||
*/
|
||||
|
||||
use Activitypub\Blocks;
|
||||
|
||||
use function Activitypub\is_activitypub_request;
|
||||
|
||||
if ( is_activitypub_request() || is_feed() ) {
|
||||
return;
|
||||
}
|
||||
|
||||
/* @var array $attributes Block attributes. */
|
||||
$attributes = wp_parse_args( $attributes );
|
||||
|
||||
// Get the comment ID and selected comment URL.
|
||||
$comment_id = $attributes['commentId'] ?? 0;
|
||||
$selected_comment = $attributes['selectedComment'] ?? '';
|
||||
|
||||
// Generate a unique ID for the block.
|
||||
$block_id = 'activitypub-remote-reply-block-' . wp_unique_id();
|
||||
|
||||
// Set up the Interactivity API config.
|
||||
wp_interactivity_config(
|
||||
'activitypub/remote-reply',
|
||||
array(
|
||||
'namespace' => ACTIVITYPUB_REST_NAMESPACE,
|
||||
'i18n' => array(
|
||||
'copied' => __( 'Copied!', 'activitypub' ),
|
||||
'copy' => __( 'Copy', 'activitypub' ),
|
||||
'emptyProfileError' => __( 'Please enter a profile URL or handle.', 'activitypub' ),
|
||||
'genericError' => __( 'An error occurred. Please try again.', 'activitypub' ),
|
||||
'invalidProfileError' => __( 'Please enter a valid profile URL or handle.', 'activitypub' ),
|
||||
),
|
||||
)
|
||||
);
|
||||
|
||||
// Add the block wrapper attributes.
|
||||
$wrapper_attributes = get_block_wrapper_attributes(
|
||||
array(
|
||||
'id' => $block_id,
|
||||
'class' => 'activitypub-remote-reply reply',
|
||||
'data-wp-interactive' => 'activitypub/remote-reply',
|
||||
'data-wp-init' => 'callbacks.init',
|
||||
)
|
||||
);
|
||||
|
||||
$wrapper_context = wp_interactivity_data_wp_context(
|
||||
array(
|
||||
'blockId' => $block_id,
|
||||
'commentId' => $comment_id,
|
||||
'commentURL' => $selected_comment,
|
||||
'copyButtonText' => __( 'Copy', 'activitypub' ),
|
||||
'errorMessage' => '',
|
||||
'isError' => false,
|
||||
'isLoading' => false,
|
||||
'modal' => array( 'isOpen' => false ),
|
||||
'remoteProfile' => '',
|
||||
'shouldSaveProfile' => true,
|
||||
)
|
||||
);
|
||||
|
||||
wp_interactivity_state(
|
||||
'activitypub/remote-reply',
|
||||
array(
|
||||
'hasRemoteUser' => false,
|
||||
'profileURL' => '',
|
||||
'template' => '',
|
||||
)
|
||||
);
|
||||
|
||||
ob_start();
|
||||
?>
|
||||
<div class="activitypub-dialog__section">
|
||||
<h4><?php esc_html_e( 'Original Comment URL', 'activitypub' ); ?></h4>
|
||||
<div class="activitypub-dialog__description">
|
||||
<?php esc_html_e( 'Paste the comment URL into the search field of your favorite open social app or platform.', 'activitypub' ); ?>
|
||||
</div>
|
||||
<div class="activitypub-dialog__button-group">
|
||||
<label for="<?php echo esc_attr( $block_id . '-profile-handle' ); ?>" class="screen-reader-text">
|
||||
<?php esc_html_e( 'Comment URL', 'activitypub' ); ?>
|
||||
</label>
|
||||
<input
|
||||
aria-readonly="true"
|
||||
class="wp-block-search__input"
|
||||
id="<?php echo esc_attr( $block_id . '-profile-handle' ); ?>"
|
||||
readonly
|
||||
tabindex="-1"
|
||||
type="text"
|
||||
value="<?php echo esc_attr( $selected_comment ); ?>"
|
||||
/>
|
||||
<button
|
||||
aria-label="<?php esc_attr_e( 'Copy URL to clipboard', 'activitypub' ); ?>"
|
||||
class="wp-element-button"
|
||||
data-wp-on--click="actions.copyToClipboard"
|
||||
type="button"
|
||||
>
|
||||
<span data-wp-text="context.copyButtonText"></span>
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="activitypub-dialog__section">
|
||||
<h4><?php esc_html_e( 'Your Profile', 'activitypub' ); ?></h4>
|
||||
<div class="activitypub-dialog__description">
|
||||
<?php esc_html_e( 'Or, if you know your own profile, we can start things that way!', 'activitypub' ); ?>
|
||||
<?php Blocks::render_modal_help(); ?>
|
||||
</div>
|
||||
<div class="activitypub-dialog__button-group">
|
||||
<label for="<?php echo esc_attr( $block_id . '-remote-profile' ); ?>" class="screen-reader-text">
|
||||
<?php esc_html_e( 'Your Fediverse profile', 'activitypub' ); ?>
|
||||
</label>
|
||||
<input
|
||||
class="wp-block-search__input"
|
||||
data-wp-bind--aria-invalid="context.isError"
|
||||
data-wp-bind--value="context.remoteProfile"
|
||||
data-wp-on--input="actions.updateRemoteProfile"
|
||||
data-wp-on--keydown="actions.onInputKeydown"
|
||||
id="<?php echo esc_attr( $block_id . '-remote-profile' ); ?>"
|
||||
placeholder="<?php esc_attr_e( '@username@example.com', 'activitypub' ); ?>"
|
||||
type="text"
|
||||
/>
|
||||
<button
|
||||
aria-label="<?php esc_attr_e( 'Reply', 'activitypub' ); ?>"
|
||||
class="wp-element-button"
|
||||
data-wp-bind--disabled="context.isLoading"
|
||||
data-wp-on--click="actions.submitRemoteProfile"
|
||||
type="button"
|
||||
>
|
||||
<span data-wp-bind--hidden="context.isLoading"><?php esc_html_e( 'Reply', 'activitypub' ); ?></span>
|
||||
<span data-wp-bind--hidden="!context.isLoading"><?php esc_html_e( 'Loading…', 'activitypub' ); ?></span>
|
||||
</button>
|
||||
</div>
|
||||
<div
|
||||
class="activitypub-dialog__error"
|
||||
data-wp-bind--hidden="!context.isError"
|
||||
data-wp-text="context.errorMessage"
|
||||
></div>
|
||||
<div class="activitypub-dialog__remember">
|
||||
<label>
|
||||
<input
|
||||
checked
|
||||
data-wp-bind--checked="context.shouldSaveProfile"
|
||||
data-wp-on--change="actions.toggleRememberProfile"
|
||||
type="checkbox"
|
||||
/>
|
||||
<?php esc_html_e( 'Save my profile for future comments.', 'activitypub' ); ?>
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
<?php
|
||||
$modal_content = ob_get_clean();
|
||||
|
||||
?>
|
||||
<div
|
||||
<?php echo $wrapper_attributes; // phpcs:ignore WordPress.Security.EscapeOutput ?>
|
||||
<?php echo $wrapper_context; // phpcs:ignore WordPress.Security.EscapeOutput ?>
|
||||
>
|
||||
<div class="activitypub-remote-profile" hidden data-wp-bind--hidden="!state.hasRemoteUser">
|
||||
<a
|
||||
href=""
|
||||
class="comment-reply-link activitypub-remote-profile__link"
|
||||
data-wp-bind--href="state.remoteProfileUrl"
|
||||
target="_blank"
|
||||
>
|
||||
<?php
|
||||
printf(
|
||||
/* translators: %s: profile name */
|
||||
esc_html__( 'Reply as %s', 'activitypub' ),
|
||||
'<span data-wp-text="state.profileURL"></span>'
|
||||
);
|
||||
?>
|
||||
</a>
|
||||
|
||||
<button
|
||||
type="button"
|
||||
class="activitypub-remote-profile__close wp-element-button"
|
||||
data-wp-on--click="actions.deleteRemoteUser"
|
||||
title="<?php esc_attr_e( 'Delete Remote Profile', 'activitypub' ); ?>"
|
||||
>
|
||||
<svg fill="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg" width="18" height="18" role="img" aria-hidden="true" focusable="false">
|
||||
<path d="M12 13.06l3.712 3.713 1.061-1.06L13.061 12l3.712-3.712-1.06-1.06L12 10.938 8.288 7.227l-1.061 1.06L10.939 12l-3.712 3.712 1.06 1.061L12 13.061z"></path>
|
||||
</svg>
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<a
|
||||
class="comment-reply-link activitypub-remote-reply__link"
|
||||
data-wp-on--click="actions.toggleModal"
|
||||
data-wp-on--keydown="actions.onReplyLinkKeydown"
|
||||
data-wp-bind--hidden="state.hasRemoteUser"
|
||||
data-wp-bind--aria-expanded="context.modal.isOpen"
|
||||
aria-label="<?php esc_attr_e( 'Reply on the Fediverse', 'activitypub' ); ?>"
|
||||
aria-haspopup="dialog"
|
||||
aria-controls="<?php echo esc_attr( $block_id . '-modal-title' ); ?>"
|
||||
role="button"
|
||||
tabindex="0"
|
||||
hidden
|
||||
>
|
||||
<?php esc_html_e( 'Reply on the Fediverse', 'activitypub' ); ?>
|
||||
</a>
|
||||
|
||||
<?php
|
||||
Blocks::render_modal(
|
||||
array(
|
||||
'id' => $block_id . '-modal',
|
||||
'title' => __( 'Remote Reply', 'activitypub' ),
|
||||
'content' => $modal_content,
|
||||
)
|
||||
);
|
||||
?>
|
||||
</div>
|
||||
<?php
|
||||
@ -1 +0,0 @@
|
||||
.activitypub__modal.components-modal__frame{background-color:#f7f7f7;color:#333}.activitypub__modal.components-modal__frame .components-modal__header-heading,.activitypub__modal.components-modal__frame h4{color:#333;letter-spacing:inherit;word-spacing:inherit}.activitypub__modal.components-modal__frame .components-modal__header .components-button:hover{color:var(--color-white)}.activitypub__dialog{max-width:40em}.activitypub__dialog h4{line-height:1;margin:0}.activitypub__dialog .activitypub-dialog__section{margin-bottom:2em}.activitypub__dialog .activitypub-dialog__remember{margin-top:1em}.activitypub__dialog .activitypub-dialog__description{font-size:var(--wp--preset--font-size--normal,.75rem);margin:.33em 0 1em}.activitypub__dialog .activitypub-dialog__button-group{align-items:flex-end;display:flex;justify-content:flex-end}.activitypub__dialog .activitypub-dialog__button-group svg{height:21px;margin-left:.5em;width:21px}.activitypub__dialog .activitypub-dialog__button-group input{background-color:var(--wp--preset--color--white);border-radius:0 50px 50px 0;border-width:1px;border:1px solid var(--wp--preset--color--black);color:var(--wp--preset--color--black);flex:1;font-size:16px;height:inherit;line-height:1;margin-left:0;padding:15px 23px}.activitypub__dialog .activitypub-dialog__button-group button{align-self:center;background-color:var(--wp--preset--color--black);border-radius:50px 0 0 50px;border-width:1px;color:var(--wp--preset--color--white);font-size:16px;height:inherit;line-height:1;margin-right:0;padding:15px 23px;text-decoration:none}.activitypub__dialog .activitypub-dialog__button-group button:hover{border:inherit}.activitypub-remote-profile-delete{align-self:center;color:inherit;font-size:inherit;height:inherit;padding:0 5px}.activitypub-remote-profile-delete:hover{background:inherit;border:inherit}.activitypub-remote-reply{display:flex}
|
||||
@ -1 +0,0 @@
|
||||
.activitypub__modal.components-modal__frame{background-color:#f7f7f7;color:#333}.activitypub__modal.components-modal__frame .components-modal__header-heading,.activitypub__modal.components-modal__frame h4{color:#333;letter-spacing:inherit;word-spacing:inherit}.activitypub__modal.components-modal__frame .components-modal__header .components-button:hover{color:var(--color-white)}.activitypub__dialog{max-width:40em}.activitypub__dialog h4{line-height:1;margin:0}.activitypub__dialog .activitypub-dialog__section{margin-bottom:2em}.activitypub__dialog .activitypub-dialog__remember{margin-top:1em}.activitypub__dialog .activitypub-dialog__description{font-size:var(--wp--preset--font-size--normal,.75rem);margin:.33em 0 1em}.activitypub__dialog .activitypub-dialog__button-group{align-items:flex-end;display:flex;justify-content:flex-end}.activitypub__dialog .activitypub-dialog__button-group svg{height:21px;margin-right:.5em;width:21px}.activitypub__dialog .activitypub-dialog__button-group input{background-color:var(--wp--preset--color--white);border-radius:50px 0 0 50px;border-width:1px;border:1px solid var(--wp--preset--color--black);color:var(--wp--preset--color--black);flex:1;font-size:16px;height:inherit;line-height:1;margin-right:0;padding:15px 23px}.activitypub__dialog .activitypub-dialog__button-group button{align-self:center;background-color:var(--wp--preset--color--black);border-radius:0 50px 50px 0;border-width:1px;color:var(--wp--preset--color--white);font-size:16px;height:inherit;line-height:1;margin-left:0;padding:15px 23px;text-decoration:none}.activitypub__dialog .activitypub-dialog__button-group button:hover{border:inherit}.activitypub-remote-profile-delete{align-self:center;color:inherit;font-size:inherit;height:inherit;padding:0 5px}.activitypub-remote-profile-delete:hover{background:inherit;border:inherit}.activitypub-remote-reply{display:flex}
|
||||
@ -0,0 +1 @@
|
||||
body.modal-open{overflow:hidden}.activitypub-modal__overlay{--activitypub-modal-background-color:var(--wp--preset--color--base,var(--wp--preset--color--background,#fff));--activitypub-modal-border-color:var(--wp--preset--color--contrast-3,var(--wp--preset--color--light-gray,#e2e4e7));--activitypub-modal-radius:var(--wp--custom--border--radius--medium,8px);--activitypub-modal-shadow:var(--wp--preset--shadow--natural,0 5px 15px rgba(0,0,0,.3));--activitypub-modal-compact-shadow:var(--wp--preset--shadow--natural,0 2px 8px rgba(0,0,0,.1));--activitypub-modal-text-color:var(--wp--preset--color--contrast,var(--wp--preset--color--foreground,inherit));align-items:center;background-color:rgba(0,0,0,.5);bottom:0;color:var(--activitypub-modal-text-color);display:flex;justify-content:center;left:0;margin:0!important;max-width:none!important;padding:1rem;position:fixed;right:0;top:0;z-index:100000}.activitypub-modal__overlay.compact{align-items:flex-start;background-color:transparent;bottom:auto;justify-content:flex-start;left:auto;padding:0;position:absolute;right:auto;top:auto;z-index:100}.activitypub-modal__overlay[hidden]{display:none}.activitypub-modal__frame{animation:activitypub-modal-appear .2s ease-out;background-color:var(--activitypub-modal-background-color);border:1px solid var(--activitypub-modal-border-color);border-radius:var(--activitypub-modal-radius);box-shadow:var(--activitypub-modal-shadow);box-sizing:border-box;color:var(--wp--preset--color--contrast,#1e1e1e);display:flex;flex-direction:column;font-size:inherit;max-height:calc(100vh - 2rem);max-width:660px;overflow:hidden;width:100%}.compact .activitypub-modal__frame{box-shadow:var(--activitypub-modal-compact-shadow);max-height:300px;max-width:-moz-min-content;max-width:min-content;min-width:250px;width:auto}.activitypub-modal__header{align-items:center;border-bottom:1px solid var(--activitypub-modal-border-color);display:flex;flex-shrink:0;justify-content:space-between;padding:2rem 2rem 1.5rem}.compact .activitypub-modal__header{display:none}.activitypub-modal__header .activitypub-modal__close{align-items:center;background:transparent;border:none;border-radius:var(--activitypub-modal-radius);color:inherit;cursor:pointer;display:flex;justify-content:center;padding:.5rem;width:auto}.activitypub-modal__header .activitypub-modal__close:active{border:none;padding:.5rem}.activitypub-modal__title{font-size:130%;font-weight:600;line-height:1.4;margin:0!important}.activitypub-modal__content{overflow-y:auto}.activitypub-dialog__section{border-bottom:1px solid var(--activitypub-modal-border-color,var(--wp--preset--color--light-gray,#f0f0f0));padding:1.5rem 2rem}.activitypub-dialog__section:last-child{border-bottom:none;padding-bottom:2rem}.activitypub-dialog__section h4{font-size:110%;margin-bottom:.5rem;margin-top:0}.activitypub-dialog__description{color:inherit;margin-bottom:1rem}.activitypub-dialog__button-group{align-items:center;display:flex;gap:.5rem;margin-bottom:.5rem;width:100%}.activitypub-dialog__button-group input[type]{background-color:var(--activitypub-modal-background-color,#fff)!important;border:1px solid var(--activitypub-modal-border-color,#949494)!important;border-radius:0;box-sizing:border-box;color:inherit!important;flex:1;font-family:inherit;font-size:1em;line-height:1;margin:0;min-width:0;padding:calc(.667em + 2px)!important}.activitypub-dialog__button-group input[type]::-moz-placeholder{opacity:.5}.activitypub-dialog__button-group input[type]::placeholder{opacity:.5}.activitypub-dialog__button-group input[type][aria-invalid=true]{border-color:var(--wp--preset--color--vivid-red,#b32d2e)!important}.activitypub-dialog__button-group button{background-color:var(--wp--preset--color--contrast,#1e1e1e);border:none;box-sizing:border-box;color:var(--wp--preset--color--base,#fff);cursor:pointer;font-family:inherit;font-size:1em;line-height:1;min-width:22.5%;padding:calc(.667em + 2px) 1.5em;width:auto}.activitypub-dialog__error{color:var(--wp--preset--color--vivid-red,#b32d2e);font-size:90%;margin-top:.5rem}.activitypub-dialog__remember{font-size:90%;margin-top:1rem}.activitypub-dialog__remember label{align-items:center;display:flex;gap:.5rem}.activitypub-dialog__remember input[type=checkbox]{margin:0;position:relative;top:0}@keyframes activitypub-modal-appear{0%{opacity:0;transform:translateY(20px)}to{opacity:1;transform:translateY(0)}}.activitypub-remote-reply{margin-top:24px}.activitypub-remote-reply .activitypub-remote-profile{align-items:center;display:flex;gap:1rem}.activitypub-remote-reply .activitypub-remote-profile__close{align-items:center;border-radius:50%;display:inline-flex;height:24px;justify-content:center;line-height:1;padding:0;width:24px}.activitypub-remote-reply .activitypub-remote-profile__link,.activitypub-remote-reply__link{cursor:pointer;display:inline-block;margin:0!important}.activitypub-remote-profile[hidden],.activitypub-remote-reply__link[hidden]{display:none!important}
|
||||
@ -0,0 +1 @@
|
||||
<?php return array('dependencies' => array('@wordpress/interactivity'), 'version' => '283e9946a5209ff839e1', 'type' => 'module');
|
||||