updated plugin ActivityPub version 8.3.0
This commit is contained in:
11
wp-content/plugins/activitypub/build/app/block.json
Normal file
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"
|
||||
}
|
||||
File diff suppressed because one or more lines are too long
@ -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
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
4
wp-content/plugins/activitypub/build/app/index.js
Normal file
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
10
wp-content/plugins/activitypub/build/app/style-index-rtl.css
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
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');
|
||||
File diff suppressed because one or more lines are too long
@ -0,0 +1 @@
|
||||
<?php return array('dependencies' => array(), 'version' => '753d276871f3f5b80028');
|
||||
176
wp-content/plugins/activitypub/build/app/vendors.js
Normal file
176
wp-content/plugins/activitypub/build/app/vendors.js
Normal file
File diff suppressed because one or more lines are too long
@ -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');
|
||||
File diff suppressed because one or more lines are too long
@ -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');
|
||||
|
||||
File diff suppressed because one or more lines are too long
78
wp-content/plugins/activitypub/build/extra-fields/block.json
Normal file
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
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');
|
||||
|
||||
File diff suppressed because one or more lines are too long
255
wp-content/plugins/activitypub/build/follow-me/render.php
Normal file
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>
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -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');
|
||||
|
||||
File diff suppressed because one or more lines are too long
@ -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');
|
||||
|
||||
File diff suppressed because one or more lines are too long
20
wp-content/plugins/activitypub/build/followers/render.php
Normal file
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 );
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -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
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
3
wp-content/plugins/activitypub/build/following/index.js
Normal file
File diff suppressed because one or more lines are too long
20
wp-content/plugins/activitypub/build/following/render.php
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 );
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -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
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
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>
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -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
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}
|
||||
File diff suppressed because one or more lines are too long
@ -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');
|
||||
File diff suppressed because one or more lines are too long
215
wp-content/plugins/activitypub/build/remote-reply/render.php
Normal file
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');
|
||||
File diff suppressed because one or more lines are too long
@ -1,12 +1,11 @@
|
||||
{
|
||||
"name": "reply-handler",
|
||||
"title": "Reply Handler: not a block, but block.json is very useful.",
|
||||
"$schema": "https://schemas.wp.org/trunk/block.json",
|
||||
"apiVersion": 3,
|
||||
"name": "activitypub/reply-intent",
|
||||
"title": "ActivityPub Reply Intent Handler",
|
||||
"category": "widgets",
|
||||
"icon": "admin-comments",
|
||||
"keywords": [
|
||||
"reply",
|
||||
"handler",
|
||||
"comments"
|
||||
],
|
||||
"description": "Handles reply intents for federated conversations in the block editor.",
|
||||
"icon": "comments",
|
||||
"textdomain": "activitypub",
|
||||
"editorScript": "file:./plugin.js"
|
||||
}
|
||||
@ -1 +1 @@
|
||||
<?php return array('dependencies' => array('wp-block-editor', 'wp-blocks', 'wp-data', 'wp-element', 'wp-plugins'), 'version' => 'f65a7269b5abb57d3e73');
|
||||
<?php return array('dependencies' => array('wp-block-editor', 'wp-blocks', 'wp-data', 'wp-element', 'wp-plugins'), 'version' => 'ee563d746b20aabb037a');
|
||||
|
||||
@ -1 +1 @@
|
||||
(()=>{"use strict";const e=window.wp.plugins,t=window.wp.blocks,i=window.wp.data,n=window.wp.blockEditor,o=window.wp.element;let r=!1;(0,e.registerPlugin)("activitypub-reply-intent",{render:()=>((0,o.useEffect)((()=>{if(r)return;const e=new URLSearchParams(window.location.search).get("in_reply_to");e&&!r&&setTimeout((()=>{const o=(0,t.createBlock)("activitypub/reply",{url:e,embedPost:!0}),r=(0,i.dispatch)(n.store);r.insertBlock(o),r.insertAfterBlock(o.clientId)}),200),r=!0})),null)})})();
|
||||
(()=>{"use strict";const e=window.wp.plugins,t=window.wp.blocks,i=window.wp.data,n=window.wp.blockEditor,o=window.wp.element;let r=!1;(0,e.registerPlugin)("activitypub-reply-intent",{render:()=>((0,o.useEffect)(()=>{if(r)return;const e=new URLSearchParams(window.location.search).get("in_reply_to");e&&!r&&setTimeout(()=>{const o=(0,t.createBlock)("activitypub/reply",{url:e,embedPost:!0}),r=(0,i.dispatch)(n.store);r.insertBlock(o),r.insertAfterBlock(o.clientId)},200),r=!0}),null)})})();
|
||||
@ -2,16 +2,27 @@
|
||||
"$schema": "https://schemas.wp.org/trunk/block.json",
|
||||
"apiVersion": 3,
|
||||
"name": "activitypub/reply",
|
||||
"version": "0.1.0",
|
||||
"version": "8.3.0",
|
||||
"title": "Federated Reply",
|
||||
"category": "widgets",
|
||||
"icon": "commentReplyLink",
|
||||
"description": "Respond to posts, notes, videos, and other content on the fediverse. Ensure the URL originates from a federated social network like Mastodon, as other URLs might not function as expected.",
|
||||
"icon": "admin-comments",
|
||||
"description": "Reply to posts, notes, and other content on the Fediverse directly from the block editor.",
|
||||
"keywords": [
|
||||
"fediverse",
|
||||
"activitypub",
|
||||
"reply",
|
||||
"federation"
|
||||
],
|
||||
"supports": {
|
||||
"html": false,
|
||||
"inserter": true,
|
||||
"reusable": false,
|
||||
"lock": false
|
||||
"lock": false,
|
||||
"innerBlocks": {
|
||||
"allowedBlocks": [
|
||||
"core/embed"
|
||||
]
|
||||
}
|
||||
},
|
||||
"textdomain": "activitypub",
|
||||
"editorScript": "file:./index.js",
|
||||
@ -24,6 +35,10 @@
|
||||
"embedPost": {
|
||||
"type": "boolean",
|
||||
"default": null
|
||||
},
|
||||
"isValidActivityPub": {
|
||||
"type": "boolean",
|
||||
"default": true
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1 +1 @@
|
||||
.activitypub-embed{background:#fff;border:1px solid #e6e6e6;border-radius:12px;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica,Arial,sans-serif;max-width:100%;padding:0}.activitypub-reply-block .activitypub-embed{margin:1em 0}.activitypub-embed-header{align-items:center;display:flex;gap:10px;padding:15px}.activitypub-embed-header img{border-radius:50%;height:48px;width:48px}.activitypub-embed-header-text{flex-grow:1}.activitypub-embed-header-text h2{color:#000;font-size:15px;font-weight:600;margin:0;padding:0}.activitypub-embed-header-text .ap-account{color:#687684;font-size:14px;text-decoration:none}.activitypub-embed-content{padding:0 15px 15px}.activitypub-embed-content .ap-title{color:#000;font-size:23px;font-weight:600;margin:0 0 10px;padding:0}.activitypub-embed-content .ap-subtitle{color:#000;font-size:15px;margin:0 0 15px}.activitypub-embed-content .ap-preview{border:1px solid #e6e6e6;border-radius:8px;overflow:hidden}.activitypub-embed-content .ap-preview img{display:block;height:auto;width:100%}.activitypub-embed-content .ap-preview-text{padding:15px}.activitypub-embed-meta{border-top:1px solid #e6e6e6;color:#687684;display:flex;font-size:13px;gap:15px;padding:15px}.activitypub-embed-meta .ap-stat{align-items:center;display:flex;gap:5px}@media only screen and (max-width:399px){.activitypub-embed-meta .ap-stat{display:none!important}}.activitypub-embed-meta a.ap-stat{color:inherit;text-decoration:none}.activitypub-embed-meta strong{color:#000;font-weight:600}.activitypub-embed-meta .ap-stat-label{color:#687684}.wp-block-activitypub-reply .components-spinner{height:12px;margin-bottom:0;margin-top:0;width:12px}
|
||||
.activitypub-embed-container{min-height:100px;pointer-events:none;position:relative;-webkit-user-select:none;-moz-user-select:none;user-select:none}.activitypub-embed-loading{align-items:center;display:flex;justify-content:center}.activitypub-embed-container .wp-block-embed{pointer-events:none!important}.activitypub-embed-preview,.activitypub-embed-preview iframe{pointer-events:none}.activitypub-reply-display{margin:1em 0}.activitypub-reply-display p{margin:0}.activitypub-reply-display a{color:#2271b1;text-decoration:none}.activitypub-reply-display a:hover{color:#135e96;text-decoration:underline}.activitypub-embed{background:#fff;border:1px solid #e6e6e6;border-radius:12px;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica,Arial,sans-serif;max-width:100%;padding:0}.activitypub-reply-block .activitypub-embed{margin:1em 0}.activitypub-embed-header{align-items:center;display:flex;gap:10px;padding:15px}.activitypub-embed-header img{border-radius:50%;height:48px;width:48px}.activitypub-embed-header-text{flex-grow:1}.activitypub-embed-header-text h2{color:#000;font-size:15px;font-weight:600;margin:0;padding:0}.activitypub-embed-header-text .ap-account{color:#687684;font-size:14px;text-decoration:none}.activitypub-embed-content{padding:0 15px 15px}.activitypub-embed-content .ap-title{color:#000;font-size:23px;font-weight:600;margin:0 0 10px;padding:0}.activitypub-embed-content .ap-subtitle{color:#000;font-size:15px;margin:0 0 15px}.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{border:0;box-sizing:border-box;display:block;height:100%;-o-object-fit:cover;object-fit:cover;overflow:hidden;position:relative;width:100%}.activitypub-embed-content .ap-preview audio,.activitypub-embed-content .ap-preview video{display:block;grid-column:1/span 2;max-width:100%}.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{padding:15px}.activitypub-embed-meta{border-top:1px solid #e6e6e6;color:#687684;display:flex;font-size:13px;gap:15px;padding:15px}.activitypub-embed-meta .ap-stat{align-items:center;display:flex;gap:5px}@media only screen and (max-width:399px){.activitypub-embed-meta span.ap-stat{display:none!important}}.activitypub-embed-meta a.ap-stat{color:inherit;text-decoration:none}.activitypub-embed-meta strong{color:#000;font-weight:600}.activitypub-embed-meta .ap-stat-label{color:#687684}.wp-block-activitypub-reply .components-spinner{height:12px;margin-bottom:0;margin-top:0;width:12px}
|
||||
|
||||
@ -1 +1 @@
|
||||
<?php return array('dependencies' => array('react', 'wp-api-fetch', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-compose', 'wp-data', 'wp-element', 'wp-i18n', 'wp-primitives', 'wp-url'), 'version' => 'fcd855ff6f64b21029be');
|
||||
<?php return array('dependencies' => array('react-jsx-runtime', 'wp-api-fetch', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-compose', 'wp-data', 'wp-element', 'wp-i18n', 'wp-primitives', 'wp-url'), 'version' => '9528bc906518de9ee951');
|
||||
|
||||
@ -1 +1 @@
|
||||
.activitypub-embed{background:#fff;border:1px solid #e6e6e6;border-radius:12px;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica,Arial,sans-serif;max-width:100%;padding:0}.activitypub-reply-block .activitypub-embed{margin:1em 0}.activitypub-embed-header{align-items:center;display:flex;gap:10px;padding:15px}.activitypub-embed-header img{border-radius:50%;height:48px;width:48px}.activitypub-embed-header-text{flex-grow:1}.activitypub-embed-header-text h2{color:#000;font-size:15px;font-weight:600;margin:0;padding:0}.activitypub-embed-header-text .ap-account{color:#687684;font-size:14px;text-decoration:none}.activitypub-embed-content{padding:0 15px 15px}.activitypub-embed-content .ap-title{color:#000;font-size:23px;font-weight:600;margin:0 0 10px;padding:0}.activitypub-embed-content .ap-subtitle{color:#000;font-size:15px;margin:0 0 15px}.activitypub-embed-content .ap-preview{border:1px solid #e6e6e6;border-radius:8px;overflow:hidden}.activitypub-embed-content .ap-preview img{display:block;height:auto;width:100%}.activitypub-embed-content .ap-preview-text{padding:15px}.activitypub-embed-meta{border-top:1px solid #e6e6e6;color:#687684;display:flex;font-size:13px;gap:15px;padding:15px}.activitypub-embed-meta .ap-stat{align-items:center;display:flex;gap:5px}@media only screen and (max-width:399px){.activitypub-embed-meta .ap-stat{display:none!important}}.activitypub-embed-meta a.ap-stat{color:inherit;text-decoration:none}.activitypub-embed-meta strong{color:#000;font-weight:600}.activitypub-embed-meta .ap-stat-label{color:#687684}.wp-block-activitypub-reply .components-spinner{height:12px;margin-bottom:0;margin-top:0;width:12px}
|
||||
.activitypub-embed-container{min-height:100px;pointer-events:none;position:relative;-webkit-user-select:none;-moz-user-select:none;user-select:none}.activitypub-embed-loading{align-items:center;display:flex;justify-content:center}.activitypub-embed-container .wp-block-embed{pointer-events:none!important}.activitypub-embed-preview,.activitypub-embed-preview iframe{pointer-events:none}.activitypub-reply-display{margin:1em 0}.activitypub-reply-display p{margin:0}.activitypub-reply-display a{color:#2271b1;text-decoration:none}.activitypub-reply-display a:hover{color:#135e96;text-decoration:underline}.activitypub-embed{background:#fff;border:1px solid #e6e6e6;border-radius:12px;font-family:-apple-system,BlinkMacSystemFont,Segoe UI,Roboto,Helvetica,Arial,sans-serif;max-width:100%;padding:0}.activitypub-reply-block .activitypub-embed{margin:1em 0}.activitypub-embed-header{align-items:center;display:flex;gap:10px;padding:15px}.activitypub-embed-header img{border-radius:50%;height:48px;width:48px}.activitypub-embed-header-text{flex-grow:1}.activitypub-embed-header-text h2{color:#000;font-size:15px;font-weight:600;margin:0;padding:0}.activitypub-embed-header-text .ap-account{color:#687684;font-size:14px;text-decoration:none}.activitypub-embed-content{padding:0 15px 15px}.activitypub-embed-content .ap-title{color:#000;font-size:23px;font-weight:600;margin:0 0 10px;padding:0}.activitypub-embed-content .ap-subtitle{color:#000;font-size:15px;margin:0 0 15px}.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{border:0;box-sizing:border-box;display:block;height:100%;-o-object-fit:cover;object-fit:cover;overflow:hidden;position:relative;width:100%}.activitypub-embed-content .ap-preview audio,.activitypub-embed-content .ap-preview video{display:block;grid-column:1/span 2;max-width:100%}.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{padding:15px}.activitypub-embed-meta{border-top:1px solid #e6e6e6;color:#687684;display:flex;font-size:13px;gap:15px;padding:15px}.activitypub-embed-meta .ap-stat{align-items:center;display:flex;gap:5px}@media only screen and (max-width:399px){.activitypub-embed-meta span.ap-stat{display:none!important}}.activitypub-embed-meta a.ap-stat{color:inherit;text-decoration:none}.activitypub-embed-meta strong{color:#000;font-weight:600}.activitypub-embed-meta .ap-stat-label{color:#687684}.wp-block-activitypub-reply .components-spinner{height:12px;margin-bottom:0;margin-top:0;width:12px}
|
||||
|
||||
File diff suppressed because one or more lines are too long
@ -1 +0,0 @@
|
||||
.activitypub-embed-container{margin-top:1em;min-height:100px;pointer-events:none;position:relative;-webkit-user-select:none;-moz-user-select:none;user-select:none}.activitypub-embed-loading{align-items:center;display:flex;justify-content:center}.activitypub-embed-container .wp-block-embed{pointer-events:none!important}.activitypub-embed-preview,.activitypub-embed-preview iframe{pointer-events:none}.activitypub-reply-display{margin:1em 0}.activitypub-reply-display p{margin:0}.activitypub-reply-display a{color:#2271b1;text-decoration:none}.activitypub-reply-display a:hover{color:#135e96;text-decoration:underline}
|
||||
@ -1 +0,0 @@
|
||||
.activitypub-embed-container{margin-top:1em;min-height:100px;pointer-events:none;position:relative;-webkit-user-select:none;-moz-user-select:none;user-select:none}.activitypub-embed-loading{align-items:center;display:flex;justify-content:center}.activitypub-embed-container .wp-block-embed{pointer-events:none!important}.activitypub-embed-preview,.activitypub-embed-preview iframe{pointer-events:none}.activitypub-reply-display{margin:1em 0}.activitypub-reply-display p{margin:0}.activitypub-reply-display a{color:#2271b1;text-decoration:none}.activitypub-reply-display a:hover{color:#135e96;text-decoration:underline}
|
||||
54
wp-content/plugins/activitypub/build/stats/block.json
Normal file
54
wp-content/plugins/activitypub/build/stats/block.json
Normal file
@ -0,0 +1,54 @@
|
||||
{
|
||||
"$schema": "https://schemas.wp.org/trunk/block.json",
|
||||
"name": "activitypub/stats",
|
||||
"apiVersion": 3,
|
||||
"version": "unreleased",
|
||||
"title": "ActivityPub Stats",
|
||||
"category": "widgets",
|
||||
"description": "Display your annual Fediverse stats as a shareable card.",
|
||||
"textdomain": "activitypub",
|
||||
"icon": "chart-bar",
|
||||
"keywords": [
|
||||
"fediverse",
|
||||
"activitypub",
|
||||
"stats",
|
||||
"statistics",
|
||||
"annual",
|
||||
"year"
|
||||
],
|
||||
"supports": {
|
||||
"html": false,
|
||||
"align": [
|
||||
"wide",
|
||||
"full"
|
||||
],
|
||||
"color": false,
|
||||
"typography": false,
|
||||
"spacing": {
|
||||
"margin": true,
|
||||
"padding": true,
|
||||
"__experimentalDefaultControls": {
|
||||
"padding": true
|
||||
}
|
||||
},
|
||||
"__experimentalBorder": {
|
||||
"color": true,
|
||||
"radius": true,
|
||||
"style": true,
|
||||
"width": true,
|
||||
"__experimentalSkipSerialization": true
|
||||
},
|
||||
"shadow": true
|
||||
},
|
||||
"attributes": {
|
||||
"selectedUser": {
|
||||
"type": "string"
|
||||
},
|
||||
"year": {
|
||||
"type": "number"
|
||||
}
|
||||
},
|
||||
"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-element', 'wp-i18n', 'wp-server-side-render'), 'version' => '7042ce0f90bb9fbbfc2a');
|
||||
1
wp-content/plugins/activitypub/build/stats/index.js
Normal file
1
wp-content/plugins/activitypub/build/stats/index.js
Normal file
@ -0,0 +1 @@
|
||||
(()=>{"use strict";var e,t={1868(e,t,i){const s=window.wp.blocks,r=window.wp.serverSideRender;var n=i.n(r);const a=window.wp.components,o=window.wp.blockEditor,l=window.wp.i18n,c=window.wp.element,u=window.wp.apiFetch;var p=i.n(u);const d=window.wp.data;const v=window.ReactJSXRuntime,b=(new Date).getFullYear();function h(){const e=[];for(let t=b;t>=b-5;t--)e.push({label:String(t),value:String(t)});return e}const g=JSON.parse('{"UU":"activitypub/stats"}');(0,s.registerBlockType)(g.UU,{edit:function({attributes:e,setAttributes:t}){const{selectedUser:i,year:s}=e,r=(0,o.useBlockProps)(),u=function({withInherit:e=!1}){const{enabled:t,namespace:i}=window._activityPubOptions||{},[s,r]=(0,c.useState)(!1),{fetchedUsers:n,isLoadingUsers:a}=(0,d.useSelect)(e=>{const{getUsers:i,getIsResolving:s}=e("core");return{fetchedUsers:t?.users?i({capabilities:"activitypub"}):null,isLoadingUsers:!!t?.users&&s("getUsers",[{capabilities:"activitypub"}])}},[t?.users]),o=(0,d.useSelect)(e=>n||a?null:e("core").getCurrentUser(),[n,a]);(0,c.useEffect)(()=>{!n&&!a&&o&&i&&p()({path:`/${i}/actors/${o.id}`,method:"HEAD",headers:{Accept:"application/activity+json"},parse:!1}).then(()=>r(!0)).catch(()=>r(!1))},[n,a,o,i]);const u=(0,c.useMemo)(()=>n||(o&&s?[{id:o.id,name:o.name}]:[]),[n,o,s]);return(0,c.useMemo)(()=>{if(!u.length)return[];const i=[];return t?.blog&&n&&i.push({label:(0,l.__)("Blog","activitypub"),value:"blog"}),e&&t?.users&&n&&i.push({label:(0,l.__)("Dynamic User","activitypub"),value:"inherit"}),u.reduce((e,t)=>(e.push({label:t.name,value:`${t.id}`}),e),i)},[u,t?.blog,t?.users,n,e])}({}),[g,w]=(0,c.useState)(!1);(0,c.useEffect)(()=>{!i&&u.length&&t({selectedUser:u[0].value})},[u]);const y=s||b-1,[f,_]=(0,c.useState)(""),m=(0,c.useCallback)(()=>{if(!i)return;const e=function(e,t){const i=window._activityPubOptions?.statsImageUrlEndpoint||"";if(!i)return"";const s=e&&"blog"!==e?e:0;return i.replace("{user_id}",s).replace("{year}",t)}(i,y);e&&p()({url:e}).then(e=>_(e.url||"")).catch(()=>_(""))},[i,y]);return(0,c.useEffect)(()=>{m()},[m]),(0,v.jsxs)("div",{...r,children:[(0,v.jsxs)(o.InspectorControls,{children:[(0,v.jsxs)(a.PanelBody,{title:(0,l.__)("Settings","activitypub"),children:[u.length>1&&(0,v.jsx)(a.SelectControl,{label:(0,l.__)("Select User","activitypub"),value:i,options:u,onChange:e=>t({selectedUser:e})}),(0,v.jsx)(a.SelectControl,{label:(0,l.__)("Year","activitypub"),value:String(y),options:h(),onChange:e=>t({year:parseInt(e,10)})})]}),f&&(0,v.jsxs)(a.PanelBody,{title:(0,l.__)("Share Image","activitypub"),initialOpen:!1,children:[(0,v.jsx)("p",{className:"description",children:(0,l.__)("Use this URL to share your stats as an image on social media.","activitypub")}),(0,v.jsx)(a.TextControl,{label:(0,l.__)("Share image URL","activitypub"),hideLabelFromVision:!0,__nextHasNoMarginBottom:!0,value:f,readOnly:!0,onClick:e=>e.target.select()}),(0,v.jsxs)("div",{style:{display:"flex",gap:"8px",alignItems:"center"},children:[(0,v.jsx)(a.Button,{variant:"secondary",onClick:()=>{navigator.clipboard.writeText(f).then(()=>{w(!0),setTimeout(()=>w(!1),2e3)})},children:g?(0,l.__)("Copied!","activitypub"):(0,l.__)("Copy URL","activitypub")}),(0,v.jsx)(a.ExternalLink,{href:f,children:(0,l.__)("Preview","activitypub")})]})]})]}),(0,v.jsx)(a.Disabled,{children:(0,v.jsx)(n(),{block:"activitypub/stats",attributes:{...e,year:y}})})]})}})}},i={};function s(e){var r=i[e];if(void 0!==r)return r.exports;var n=i[e]={exports:{}};return t[e](n,n.exports,s),n.exports}s.m=t,e=[],s.O=(t,i,r,n)=>{if(!i){var a=1/0;for(u=0;u<e.length;u++){for(var[i,r,n]=e[u],o=!0,l=0;l<i.length;l++)(!1&n||a>=n)&&Object.keys(s.O).every(e=>s.O[e](i[l]))?i.splice(l--,1):(o=!1,n<a&&(a=n));if(o){e.splice(u--,1);var c=r();void 0!==c&&(t=c)}}return t}n=n||0;for(var u=e.length;u>0&&e[u-1][2]>n;u--)e[u]=e[u-1];e[u]=[i,r,n]},s.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return s.d(t,{a:t}),t},s.d=(e,t)=>{for(var i in t)s.o(t,i)&&!s.o(e,i)&&Object.defineProperty(e,i,{enumerable:!0,get:t[i]})},s.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),(()=>{var e={85:0,721:0};s.O.j=t=>0===e[t];var t=(t,i)=>{var r,n,[a,o,l]=i,c=0;if(a.some(t=>0!==e[t])){for(r in o)s.o(o,r)&&(s.m[r]=o[r]);if(l)var u=l(s)}for(t&&t(i);c<a.length;c++)n=a[c],s.o(e,n)&&e[n]&&e[n][0](),e[n]=0;return s.O(u)},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,[721],()=>s(1868));r=s.O(r)})();
|
||||
239
wp-content/plugins/activitypub/build/stats/render.php
Normal file
239
wp-content/plugins/activitypub/build/stats/render.php
Normal file
@ -0,0 +1,239 @@
|
||||
<?php
|
||||
/**
|
||||
* Server-side rendering of the `activitypub/stats` block.
|
||||
*
|
||||
* @package Activitypub
|
||||
*/
|
||||
|
||||
use Activitypub\Blocks;
|
||||
use Activitypub\Collection\Actors;
|
||||
use Activitypub\Statistics;
|
||||
|
||||
if ( is_feed() ) {
|
||||
return;
|
||||
}
|
||||
|
||||
/* @var array $attributes Block attributes. */
|
||||
$attributes = wp_parse_args( $attributes );
|
||||
|
||||
$user_id = Blocks::get_user_id( $attributes['selectedUser'] ?? 'blog' );
|
||||
$stats_year = (int) ( $attributes['year'] ?? ( (int) \gmdate( 'Y' ) - 1 ) );
|
||||
|
||||
// Try stored annual summary first, fall back to live computation.
|
||||
$summary = Statistics::get_annual_summary( $user_id, $stats_year );
|
||||
|
||||
if ( ! $summary ) {
|
||||
$summary = Statistics::compile_annual_summary( $user_id, $stats_year );
|
||||
}
|
||||
|
||||
if ( ! $summary || empty( $summary['posts_count'] ) ) {
|
||||
if ( \defined( 'REST_REQUEST' ) && REST_REQUEST ) {
|
||||
printf(
|
||||
'<div class="components-placeholder"><div class="components-placeholder__label">%s</div><div class="components-placeholder__instructions">%s</div></div>',
|
||||
\esc_html__( 'Fediverse Stats', 'activitypub' ),
|
||||
\sprintf(
|
||||
/* translators: %d: The year */
|
||||
\esc_html__( 'No stats available for %d. Stats are collected monthly and compiled at the end of each year.', 'activitypub' ),
|
||||
(int) $stats_year
|
||||
)
|
||||
);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
// Get comment types for dynamic display.
|
||||
$comment_types = Statistics::get_comment_types_for_stats();
|
||||
|
||||
// Calculate total engagement.
|
||||
$total_engagement = 0;
|
||||
foreach ( array_keys( $comment_types ) as $ct_slug ) {
|
||||
$total_engagement += $summary[ $ct_slug . '_count' ] ?? 0;
|
||||
}
|
||||
|
||||
// Most active month name.
|
||||
$most_active_month_name = '';
|
||||
if ( ! empty( $summary['most_active_month'] ) ) {
|
||||
$most_active_month_name = gmdate( 'F', gmmktime( 0, 0, 0, $summary['most_active_month'], 1, $stats_year ) );
|
||||
}
|
||||
|
||||
// Follower growth.
|
||||
$followers_start = $summary['followers_start'] ?? 0;
|
||||
$followers_end = $summary['followers_end'] ?? 0;
|
||||
$followers_net_change = $summary['followers_net_change'] ?? ( $followers_end - $followers_start );
|
||||
$change_sign = $followers_net_change >= 0 ? '+' : '';
|
||||
|
||||
// Get actor webfinger for the card header.
|
||||
$actor = Actors::get_by_id( $user_id );
|
||||
|
||||
if ( \is_wp_error( $actor ) ) {
|
||||
// Fall back to direct model instantiation for blog/application actors.
|
||||
if ( Actors::BLOG_USER_ID === $user_id ) {
|
||||
$actor = new \Activitypub\Model\Blog();
|
||||
} elseif ( Actors::APPLICATION_USER_ID === $user_id ) {
|
||||
$actor = new \Activitypub\Model\Application();
|
||||
}
|
||||
}
|
||||
|
||||
$actor_webfinger = ! \is_wp_error( $actor ) ? $actor->get_webfinger() : '';
|
||||
|
||||
// Site name for branding.
|
||||
$site_name = \get_bloginfo( 'name' );
|
||||
|
||||
$block_id = 'activitypub-stats-' . \wp_unique_id();
|
||||
$title_text = \sprintf(
|
||||
/* translators: %d: The year */
|
||||
\__( 'Fediverse Stats %d', 'activitypub' ),
|
||||
(int) $stats_year
|
||||
);
|
||||
|
||||
/*
|
||||
* Build border styles using WP_Style_Engine for sanitization.
|
||||
* Border serialization is skipped in block.json to avoid double
|
||||
* rendering in the editor, so we apply it here manually.
|
||||
*/
|
||||
$border_result = \wp_style_engine_get_styles( array( 'border' => $attributes['style']['border'] ?? array() ) );
|
||||
$extra_styles = $border_result['css'] ?? '';
|
||||
|
||||
// Handle preset border color slug (not part of style.border).
|
||||
if ( ! empty( $attributes['borderColor'] ) ) {
|
||||
$preset_color = 'var(--wp--preset--color--' . \sanitize_key( $attributes['borderColor'] ) . ')';
|
||||
$extra_styles = 'border-color:' . $preset_color . ';' . $extra_styles;
|
||||
}
|
||||
|
||||
// Resolve the border color for inner elements via CSS variable.
|
||||
$border_color = '';
|
||||
if ( ! empty( $attributes['style']['border']['color'] ) ) {
|
||||
$border_color = $attributes['style']['border']['color'];
|
||||
} elseif ( ! empty( $attributes['borderColor'] ) ) {
|
||||
$border_color = 'var(--wp--preset--color--' . \sanitize_key( $attributes['borderColor'] ) . ')';
|
||||
}
|
||||
|
||||
if ( $border_color ) {
|
||||
$extra_styles .= '--activitypub-stats--border-color:' . \esc_attr( $border_color ) . ';';
|
||||
}
|
||||
|
||||
$wrapper_attrs = array(
|
||||
'id' => $block_id,
|
||||
'class' => 'activitypub-stats',
|
||||
);
|
||||
|
||||
$wrapper_html = \get_block_wrapper_attributes( $wrapper_attrs );
|
||||
|
||||
// Merge border styles into the existing style attribute.
|
||||
if ( $extra_styles ) {
|
||||
if ( \str_contains( $wrapper_html, 'style="' ) ) {
|
||||
$wrapper_html = \str_replace( 'style="', 'style="' . \esc_attr( $extra_styles ), $wrapper_html );
|
||||
} else {
|
||||
$wrapper_html .= ' style="' . \esc_attr( $extra_styles ) . '"';
|
||||
}
|
||||
}
|
||||
?>
|
||||
<div
|
||||
<?php
|
||||
// phpcs:ignore WordPress.Security.EscapeOutput
|
||||
echo $wrapper_html;
|
||||
?>
|
||||
data-year="<?php echo esc_attr( $stats_year ); ?>"
|
||||
>
|
||||
<div class="activitypub-stats__header">
|
||||
<h2 class="activitypub-stats__title"><?php echo \esc_html( $title_text ); ?></h2>
|
||||
<?php if ( $actor_webfinger ) : ?>
|
||||
<p class="activitypub-stats__subtitle"><?php echo \esc_html( '@' . $actor_webfinger ); ?></p>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
|
||||
<div class="activitypub-stats__stats">
|
||||
<div class="activitypub-stats__stat activitypub-stats__stat--highlight">
|
||||
<span class="activitypub-stats__stat-value"><?php echo esc_html( number_format_i18n( $summary['posts_count'] ) ); ?></span>
|
||||
<span class="activitypub-stats__stat-label"><?php esc_html_e( 'Posts Federated', 'activitypub' ); ?></span>
|
||||
</div>
|
||||
<div class="activitypub-stats__stat activitypub-stats__stat--highlight">
|
||||
<span class="activitypub-stats__stat-value"><?php echo esc_html( number_format_i18n( $total_engagement ) ); ?></span>
|
||||
<span class="activitypub-stats__stat-label"><?php esc_html_e( 'Total Engagements', 'activitypub' ); ?></span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="activitypub-stats__engagement">
|
||||
<?php foreach ( $comment_types as $slug => $type_info ) : ?>
|
||||
<?php $count = $summary[ $slug . '_count' ] ?? 0; ?>
|
||||
<?php if ( $count > 0 ) : ?>
|
||||
<div class="activitypub-stats__stat">
|
||||
<span class="activitypub-stats__stat-value"><?php echo esc_html( number_format_i18n( $count ) ); ?></span>
|
||||
<span class="activitypub-stats__stat-label"><?php echo esc_html( $type_info['label'] ); ?></span>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
<?php endforeach; ?>
|
||||
</div>
|
||||
|
||||
<div class="activitypub-stats__details">
|
||||
<div class="activitypub-stats__detail">
|
||||
<span class="activitypub-stats__detail-label"><?php esc_html_e( 'Follower Growth', 'activitypub' ); ?></span>
|
||||
<span class="activitypub-stats__detail-value">
|
||||
<?php echo esc_html( $change_sign . number_format_i18n( $followers_net_change ) ); ?>
|
||||
</span>
|
||||
<span class="activitypub-stats__detail-extra">
|
||||
<?php
|
||||
printf(
|
||||
/* translators: 1: follower count at start of year, 2: follower count at end of year */
|
||||
esc_html__( '%1$s → %2$s followers', 'activitypub' ),
|
||||
esc_html( number_format_i18n( $followers_start ) ),
|
||||
esc_html( number_format_i18n( $followers_end ) )
|
||||
);
|
||||
?>
|
||||
</span>
|
||||
</div>
|
||||
|
||||
<?php if ( $most_active_month_name ) : ?>
|
||||
<div class="activitypub-stats__detail">
|
||||
<span class="activitypub-stats__detail-label"><?php esc_html_e( 'Most Active Month', 'activitypub' ); ?></span>
|
||||
<span class="activitypub-stats__detail-value"><?php echo esc_html( $most_active_month_name ); ?></span>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
||||
<?php if ( ! empty( $summary['top_multiplicator'] ) ) : ?>
|
||||
<div class="activitypub-stats__detail">
|
||||
<span class="activitypub-stats__detail-label"><?php esc_html_e( 'Top Supporter', 'activitypub' ); ?></span>
|
||||
<span class="activitypub-stats__detail-value">
|
||||
<a href="<?php echo esc_url( $summary['top_multiplicator']['url'] ); ?>"><?php echo esc_html( $summary['top_multiplicator']['name'] ); ?></a>
|
||||
</span>
|
||||
<span class="activitypub-stats__detail-extra">
|
||||
<?php
|
||||
printf(
|
||||
/* translators: %s: Number of boosts */
|
||||
esc_html( _n( '%s boost', '%s boosts', (int) $summary['top_multiplicator']['count'], 'activitypub' ) ),
|
||||
esc_html( number_format_i18n( $summary['top_multiplicator']['count'] ) )
|
||||
);
|
||||
?>
|
||||
</span>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
|
||||
<?php if ( ! empty( $summary['top_posts'] ) ) : ?>
|
||||
<div class="activitypub-stats__top-posts">
|
||||
<h3 class="activitypub-stats__section-title"><?php esc_html_e( 'Top Posts', 'activitypub' ); ?></h3>
|
||||
<ol>
|
||||
<?php foreach ( array_slice( $summary['top_posts'], 0, 5 ) as $top_post ) : ?>
|
||||
<li>
|
||||
<a href="<?php echo esc_url( $top_post['url'] ); ?>">
|
||||
<?php echo esc_html( $top_post['title'] ? $top_post['title'] : __( '(no title)', 'activitypub' ) ); ?>
|
||||
</a>
|
||||
<span class="activitypub-stats__post-engagement">
|
||||
<?php
|
||||
printf(
|
||||
/* translators: %s: engagement count */
|
||||
esc_html__( '%s engagements', 'activitypub' ),
|
||||
esc_html( number_format_i18n( $top_post['engagement_count'] ?? 0 ) )
|
||||
);
|
||||
?>
|
||||
</span>
|
||||
</li>
|
||||
<?php endforeach; ?>
|
||||
</ol>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
||||
<div class="activitypub-stats__footer">
|
||||
<span class="activitypub-stats__branding"><?php echo \esc_html( $site_name ); ?> · <?php \esc_html_e( 'Powered by the ActivityPub plugin', 'activitypub' ); ?></span>
|
||||
</div>
|
||||
</div>
|
||||
@ -0,0 +1 @@
|
||||
.wp-block-activitypub-stats{background-color:var(--wp--preset--color--base,var(--wp--preset--color--white,#fff));color:var(--wp--preset--color--contrast,var(--wp--preset--color--black,inherit));max-width:var(--wp--style--global--content-size,600px);--activitypub-stats--border-color:color-mix(in srgb,currentcolor 20%,transparent)}.wp-block-activitypub-stats.alignwide{max-width:var(--wp--style--global--wide-size)}.wp-block-activitypub-stats.alignfull{max-width:none}.activitypub-stats__header{margin-bottom:1.5rem;text-align:center}.activitypub-stats__title{color:inherit;font-size:1.75em;font-weight:800;letter-spacing:-.02em;margin:0 0 .25rem}.activitypub-stats__subtitle{color:color-mix(in srgb,currentcolor 60%,transparent);font-size:1em;margin:0}.activitypub-stats__stats{display:flex;gap:1rem;margin-bottom:1.25rem}.activitypub-stats__stat{flex:1;padding:.75rem .5rem;text-align:center}.activitypub-stats__stat--highlight{border:1px solid var(--activitypub-stats--border-color);border-radius:8px}.activitypub-stats__stat-value{color:inherit;display:block;font-size:2em;font-weight:800;line-height:1.2}.activitypub-stats__stat--highlight .activitypub-stats__stat-value{font-size:2.5em}.activitypub-stats__stat-label{color:color-mix(in srgb,currentcolor 50%,transparent);display:block;font-size:.8em;letter-spacing:.05em;margin-top:.25rem;text-transform:uppercase}.activitypub-stats__engagement{display:flex;flex-wrap:wrap;gap:.5rem;margin-bottom:1.5rem}.activitypub-stats__engagement .activitypub-stats__stat{border:1px solid var(--activitypub-stats--border-color);border-radius:8px;flex:1 1 calc(33.333% - 0.5rem);min-width:5rem;padding:.625rem .5rem}.activitypub-stats__details{display:flex;flex-wrap:wrap;gap:1rem;margin-bottom:1.5rem}.activitypub-stats__detail{border:1px solid var(--activitypub-stats--border-color);border-radius:8px;flex:1 1 calc(50% - 0.5rem);min-width:7.5rem;padding:.875rem}.activitypub-stats__detail-label{color:color-mix(in srgb,currentcolor 50%,transparent);display:block;font-size:.75em;letter-spacing:.05em;margin-bottom:.25rem;text-transform:uppercase}.activitypub-stats__detail-value{color:inherit;display:block;font-size:1.25em;font-weight:700}.activitypub-stats__detail-value a{color:inherit;text-decoration:underline;text-underline-offset:.15em}.activitypub-stats__detail-value a:hover{color:color-mix(in srgb,currentcolor 70%,transparent)}.activitypub-stats__detail-value--negative,.activitypub-stats__detail-value--positive{color:inherit}.activitypub-stats__detail-extra{color:color-mix(in srgb,currentcolor 45%,transparent);display:block;font-size:.8em;margin-top:.125rem}.activitypub-stats__top-posts{margin-bottom:1.25rem}.activitypub-stats__section-title{color:color-mix(in srgb,currentcolor 50%,transparent);font-size:.85em;letter-spacing:.05em;margin:0 0 .75rem;text-transform:uppercase}.activitypub-stats__top-posts ol{list-style:decimal;margin:0;padding-right:1.5em}.activitypub-stats__top-posts li{padding:.5rem 0}.activitypub-stats__top-posts li:last-child{padding-bottom:0}.activitypub-stats__top-posts li a{color:inherit;text-decoration:none}.activitypub-stats__top-posts li a:hover{text-decoration:underline}.activitypub-stats__post-engagement{color:color-mix(in srgb,currentcolor 45%,transparent);font-size:.8em;margin-right:.25rem}.activitypub-stats__footer{margin-top:1.25rem;text-align:center}.activitypub-stats__branding{color:color-mix(in srgb,currentcolor 45%,transparent);font-size:.75em}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user