updated plugin ActivityPub
version 2.6.1
This commit is contained in:
parent
19e351ef3b
commit
3b4e169a1e
@ -3,12 +3,12 @@
|
|||||||
* Plugin Name: ActivityPub
|
* Plugin Name: ActivityPub
|
||||||
* Plugin URI: https://github.com/pfefferle/wordpress-activitypub/
|
* Plugin URI: https://github.com/pfefferle/wordpress-activitypub/
|
||||||
* Description: The ActivityPub protocol is a decentralized social networking protocol based upon the ActivityStreams 2.0 data format.
|
* Description: The ActivityPub protocol is a decentralized social networking protocol based upon the ActivityStreams 2.0 data format.
|
||||||
* Version: 2.4.0
|
* Version: 2.6.1
|
||||||
* Author: Matthias Pfefferle & Automattic
|
* Author: Matthias Pfefferle & Automattic
|
||||||
* Author URI: https://automattic.com/
|
* Author URI: https://automattic.com/
|
||||||
* License: MIT
|
* License: MIT
|
||||||
* License URI: http://opensource.org/licenses/MIT
|
* License URI: http://opensource.org/licenses/MIT
|
||||||
* Requires PHP: 5.6
|
* Requires PHP: 7.0
|
||||||
* Text Domain: activitypub
|
* Text Domain: activitypub
|
||||||
* Domain Path: /languages
|
* Domain Path: /languages
|
||||||
*/
|
*/
|
||||||
@ -21,7 +21,7 @@ use function Activitypub\site_supports_blocks;
|
|||||||
require_once __DIR__ . '/includes/compat.php';
|
require_once __DIR__ . '/includes/compat.php';
|
||||||
require_once __DIR__ . '/includes/functions.php';
|
require_once __DIR__ . '/includes/functions.php';
|
||||||
|
|
||||||
\define( 'ACTIVITYPUB_PLUGIN_VERSION', '2.4.0' );
|
\define( 'ACTIVITYPUB_PLUGIN_VERSION', '2.6.1' );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Initialize the plugin constants.
|
* Initialize the plugin constants.
|
||||||
@ -101,6 +101,9 @@ function plugin_init() {
|
|||||||
require_once __DIR__ . '/integration/class-enable-mastodon-apps.php';
|
require_once __DIR__ . '/integration/class-enable-mastodon-apps.php';
|
||||||
Integration\Enable_Mastodon_Apps::init();
|
Integration\Enable_Mastodon_Apps::init();
|
||||||
|
|
||||||
|
require_once __DIR__ . '/integration/class-opengraph.php';
|
||||||
|
Integration\Opengraph::init();
|
||||||
|
|
||||||
if ( \defined( 'JETPACK__VERSION' ) && ! \defined( 'IS_WPCOM' ) ) {
|
if ( \defined( 'JETPACK__VERSION' ) && ! \defined( 'IS_WPCOM' ) ) {
|
||||||
require_once __DIR__ . '/integration/class-jetpack.php';
|
require_once __DIR__ . '/integration/class-jetpack.php';
|
||||||
Integration\Jetpack::init();
|
Integration\Jetpack::init();
|
||||||
|
@ -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'), 'version' => '0708145714d72862bff0');
|
<?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'), 'version' => '7be9f9b97d08a20bde26');
|
||||||
|
File diff suppressed because one or more lines are too long
@ -0,0 +1 @@
|
|||||||
|
.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(--wp--preset--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);margin-right:1rem}
|
@ -1 +1 @@
|
|||||||
.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(--wp--preset--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__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:1px solid var(--wp--preset--color--black);border-radius:inherit 0;color:var(--wp--preset--color--black);flex:1;padding:6px 12px}.activitypub__dialog .activitypub-dialog__button-group button{align-self:center;background-color:var(--wp--preset--color--black);color:var(--wp--preset--color--white);margin-left:0;text-decoration:none}.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);margin-left:1rem}
|
.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(--wp--preset--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);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' => 'cbc379fca374f5f88e22');
|
<?php return array('dependencies' => array('react', 'wp-api-fetch', 'wp-components', 'wp-compose', 'wp-dom-ready', 'wp-element', 'wp-i18n', 'wp-primitives'), 'version' => 'ab8c0dad126bb0a61ed6');
|
||||||
|
File diff suppressed because one or more lines are too long
@ -1 +1 @@
|
|||||||
<?php return array('dependencies' => array('react', 'wp-api-fetch', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-data', 'wp-element', 'wp-i18n', 'wp-primitives', 'wp-url'), 'version' => 'a351235e5feab398a954');
|
<?php return array('dependencies' => array('react', 'wp-api-fetch', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-data', 'wp-element', 'wp-i18n', 'wp-primitives', 'wp-url'), 'version' => '3d39b46b3415c2d57654');
|
||||||
|
@ -1,3 +1,3 @@
|
|||||||
(()=>{var e={184:(e,t)=>{var a;!function(){"use strict";var l={}.hasOwnProperty;function n(){for(var e=[],t=0;t<arguments.length;t++){var a=arguments[t];if(a){var r=typeof a;if("string"===r||"number"===r)e.push(a);else if(Array.isArray(a)){if(a.length){var o=n.apply(null,a);o&&e.push(o)}}else if("object"===r){if(a.toString!==Object.prototype.toString&&!a.toString.toString().includes("[native code]")){e.push(a.toString());continue}for(var i in a)l.call(a,i)&&a[i]&&e.push(i)}}}return e.join(" ")}e.exports?(n.default=n,e.exports=n):void 0===(a=function(){return n}.apply(t,[]))||(e.exports=a)}()}},t={};function a(l){var n=t[l];if(void 0!==n)return n.exports;var r=t[l]={exports:{}};return e[l](r,r.exports,a),r.exports}a.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return a.d(t,{a:t}),t},a.d=(e,t)=>{for(var l in t)a.o(t,l)&&!a.o(e,l)&&Object.defineProperty(e,l,{enumerable:!0,get:t[l]})},a.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),(()=>{"use strict";const e=window.wp.blocks,t=window.wp.element,l=window.wp.primitives,n=(0,t.createElement)(l.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24"},(0,t.createElement)(l.Path,{d:"M15.5 9.5a1 1 0 100-2 1 1 0 000 2zm0 1.5a2.5 2.5 0 100-5 2.5 2.5 0 000 5zm-2.25 6v-2a2.75 2.75 0 00-2.75-2.75h-4A2.75 2.75 0 003.75 15v2h1.5v-2c0-.69.56-1.25 1.25-1.25h4c.69 0 1.25.56 1.25 1.25v2h1.5zm7-2v2h-1.5v-2c0-.69-.56-1.25-1.25-1.25H15v-1.5h2.5A2.75 2.75 0 0120.25 15zM9.5 8.5a1 1 0 11-2 0 1 1 0 012 0zm1.5 0a2.5 2.5 0 11-5 0 2.5 2.5 0 015 0z",fillRule:"evenodd"})),r=window.wp.components,o=window.wp.blockEditor,i=window.wp.i18n,c=window.React,s=window.wp.apiFetch;var p=a.n(s);const u=window.wp.url;var v=a(184),m=a.n(v);function w({active:e,children:a,page:l,pageClick:n,className:r}){const o=m()("wp-block activitypub-pager",r,{current:e});return(0,t.createElement)("a",{className:o,onClick:t=>{t.preventDefault(),!e&&n(l)}},a)}const b={outlined:"outlined",minimal:"minimal"};function d({compact:e,nextLabel:a,page:l,pageClick:n,perPage:r,prevLabel:o,total:i,variant:c=b.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,l)=>e>=1&&e<=t&&l.lastIndexOf(e)===a));for(let e=a.length-2;e>=0;e--)a[e]===a[e+1]&&a.splice(e+1,1);return a})(l,Math.ceil(i/r)),p=m()("alignwide wp-block-query-pagination is-content-justification-space-between is-layout-flex wp-block-query-pagination-is-layout-flex",`is-${c}`,{"is-compact":e});return(0,t.createElement)("nav",{className:p},o&&(0,t.createElement)(w,{key:"prev",page:l-1,pageClick:n,active:1===l,"aria-label":o,className:"wp-block-query-pagination-previous block-editor-block-list__block"},o),!e&&(0,t.createElement)("div",{className:"block-editor-block-list__block wp-block wp-block-query-pagination-numbers"},s.map((e=>(0,t.createElement)(w,{key:e,page:e,pageClick:n,active:e===l,className:"page-numbers"},e)))),a&&(0,t.createElement)(w,{key:"next",page:l+1,pageClick:n,active:l===Math.ceil(i/r),"aria-label":a,className:"wp-block-query-pagination-next block-editor-block-list__block"},a))}const{namespace:g}=window._activityPubOptions;function f({selectedUser:e,per_page:a,order:l,title:n,page:r,setPage:o,className:s="",followLinks:v=!0,followerData:m=!1}){const w="site"===e?0:e,[b,f]=(0,c.useState)([]),[h,k]=(0,c.useState)(0),[E,_]=(0,c.useState)(0),[x,C]=function(){const[e,t]=(0,c.useState)(1);return[e,t]}(),S=r||x,N=o||C,P=(0,t.createInterpolateElement)(/* translators: arrow for previous followers link */
|
(()=>{var e={20:(e,t,a)=>{"use strict";var r=a(609),n=Symbol.for("react.element"),l=(Symbol.for("react.fragment"),Object.prototype.hasOwnProperty),o=r.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner,i={key:!0,ref:!0,__self:!0,__source:!0};t.jsx=function(e,t,a){var r,c={},s=null,p=null;for(r in void 0!==a&&(s=""+a),void 0!==t.key&&(s=""+t.key),void 0!==t.ref&&(p=t.ref),t)l.call(t,r)&&!i.hasOwnProperty(r)&&(c[r]=t[r]);if(e&&e.defaultProps)for(r in t=e.defaultProps)void 0===c[r]&&(c[r]=t[r]);return{$$typeof:n,type:e,key:s,ref:p,props:c,_owner:o.current}}},848:(e,t,a)=>{"use strict";e.exports=a(20)},609:e=>{"use strict";e.exports=window.React},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)}()}},t={};function a(r){var n=t[r];if(void 0!==n)return n.exports;var l=t[r]={exports:{}};return e[r](l,l.exports,a),l.exports}a.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return a.d(t,{a:t}),t},a.d=(e,t)=>{for(var r in t)a.o(t,r)&&!a.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},a.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),(()=>{"use strict";const e=window.wp.blocks,t=window.wp.primitives;var r=a(848);const n=(0,r.jsx)(t.SVG,{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",children:(0,r.jsx)(t.Path,{d:"M15.5 9.5a1 1 0 100-2 1 1 0 000 2zm0 1.5a2.5 2.5 0 100-5 2.5 2.5 0 000 5zm-2.25 6v-2a2.75 2.75 0 00-2.75-2.75h-4A2.75 2.75 0 003.75 15v2h1.5v-2c0-.69.56-1.25 1.25-1.25h4c.69 0 1.25.56 1.25 1.25v2h1.5zm7-2v2h-1.5v-2c0-.69-.56-1.25-1.25-1.25H15v-1.5h2.5A2.75 2.75 0 0120.25 15zM9.5 8.5a1 1 0 11-2 0 1 1 0 012 0zm1.5 0a2.5 2.5 0 11-5 0 2.5 2.5 0 015 0z",fillRule:"evenodd"})});var l=a(609);const o=window.wp.components,i=window.wp.element,c=window.wp.blockEditor,s=window.wp.i18n,p=window.wp.apiFetch;var u=a.n(p);const v=window.wp.url;var m=a(942),w=a.n(m);function d({active:e,children:t,page:a,pageClick:r,className:n}){const o=w()("wp-block activitypub-pager",n,{current:e});return(0,l.createElement)("a",{className:o,onClick:t=>{t.preventDefault(),!e&&r(a)}},t)}const f={outlined:"outlined",minimal:"minimal"};function b({compact:e,nextLabel:t,page:a,pageClick:r,perPage:n,prevLabel:o,total:i,variant:c=f.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(i/n)),p=w()("alignwide wp-block-query-pagination is-content-justification-space-between is-layout-flex wp-block-query-pagination-is-layout-flex",`is-${c}`,{"is-compact":e});return(0,l.createElement)("nav",{className:p},o&&(0,l.createElement)(d,{key:"prev",page:a-1,pageClick:r,active:1===a,"aria-label":o,className:"wp-block-query-pagination-previous block-editor-block-list__block"},o),!e&&(0,l.createElement)("div",{className:"block-editor-block-list__block wp-block wp-block-query-pagination-numbers"},s.map((e=>(0,l.createElement)(d,{key:e,page:e,pageClick:r,active:e===a,className:"page-numbers"},e)))),t&&(0,l.createElement)(d,{key:"next",page:a+1,pageClick:r,active:a===Math.ceil(i/n),"aria-label":t,className:"wp-block-query-pagination-next block-editor-block-list__block"},t))}const{namespace:y}=window._activityPubOptions;function g({selectedUser:e,per_page:t,order:a,title:r,page:n,setPage:o,className:c="",followLinks:p=!0,followerData:m=!1}){const w="site"===e?0:e,[d,f]=(0,l.useState)([]),[g,k]=(0,l.useState)(0),[h,E]=(0,l.useState)(0),[x,N]=function(){const[e,t]=(0,l.useState)(1);return[e,t]}(),S=n||x,C=o||N,O=(0,i.createInterpolateElement)(/* translators: arrow for previous followers link */ /* translators: arrow for previous followers link */
|
||||||
(0,i.__)("<span>←</span> Less","activitypub"),{span:(0,t.createElement)("span",{class:"wp-block-query-pagination-previous-arrow is-arrow-arrow","aria-hidden":"true"})}),L=(0,t.createInterpolateElement)(/* translators: arrow for next followers link */
|
(0,s.__)("<span>←</span> Less","activitypub"),{span:(0,l.createElement)("span",{className:"wp-block-query-pagination-previous-arrow is-arrow-arrow","aria-hidden":"true"})}),P=(0,i.createInterpolateElement)(/* translators: arrow for next followers link */ /* translators: arrow for next followers link */
|
||||||
(0,i.__)("More <span>→</span>","activitypub"),{span:(0,t.createElement)("span",{class:"wp-block-query-pagination-next-arrow is-arrow-arrow","aria-hidden":"true"})}),O=(e,t)=>{f(e),_(t),k(Math.ceil(t/a))};return(0,c.useEffect)((()=>{if(m&&1===S)return O(m.followers,m.total);const e=function(e,t,a,l){const n=`/${g}/actors/${e}/followers`,r={per_page:t,order:a,page:l,context:"full"};return(0,u.addQueryArgs)(n,r)}(w,a,l,S);p()({path:e}).then((e=>O(e.orderedItems,e.totalItems))).catch((()=>{}))}),[w,a,l,S,m]),(0,t.createElement)("div",{className:"activitypub-follower-block "+s},(0,t.createElement)("h3",null,n),(0,t.createElement)("ul",null,b&&b.map((e=>(0,t.createElement)("li",{key:e.url},(0,t.createElement)(y,{...e,followLinks:v}))))),h>1&&(0,t.createElement)(d,{page:S,perPage:a,total:E,pageClick:N,nextLabel:L,prevLabel:P,compact:"is-style-compact"===s}))}function y({name:e,icon:a,url:l,preferredUsername:n,followLinks:o=!0}){const i=`@${n}`,c={};return o||(c.onClick=e=>e.preventDefault()),(0,t.createElement)(r.ExternalLink,{className:"activitypub-link",href:l,title:i,...c},(0,t.createElement)("img",{width:"40",height:"40",src:a.url,class:"avatar activitypub-avatar",alt:e}),(0,t.createElement)("span",{class:"activitypub-actor"},(0,t.createElement)("strong",{className:"activitypub-name"},e),(0,t.createElement)("span",{class:"sep"},"/"),(0,t.createElement)("span",{class:"activitypub-handle"},i)))}const h=window.wp.data,k=window._activityPubOptions?.enabled;(0,e.registerBlockType)("activitypub/followers",{edit:function({attributes:e,setAttributes:a}){const{order:l,per_page:n,selectedUser:c,title:s}=e,p=(0,o.useBlockProps)(),[u,v]=(0,t.useState)(1),m=[{label:(0,i.__)("New to old","activitypub"),value:"desc"},{label:(0,i.__)("Old to new","activitypub"),value:"asc"}],w=function(){const e=k?.users?(0,h.useSelect)((e=>e("core").getUsers({who:"authors"}))):[];return(0,t.useMemo)((()=>{if(!e)return[];const t=k?.site?[{label:(0,i.__)("Whole Site","activitypub"),value:"site"}]:[];return e.reduce(((e,t)=>(e.push({label:t.name,value:`${t.id}`}),e)),t)}),[e])}(),b=e=>t=>{v(1),a({[e]:t})};return(0,t.useEffect)((()=>{w.length&&(w.find((({value:e})=>e===c))||a({selectedUser:w[0].value}))}),[c,w]),(0,t.createElement)("div",{...p},(0,t.createElement)(o.InspectorControls,{key:"setting"},(0,t.createElement)(r.PanelBody,{title:(0,i.__)("Followers Options","activitypub")},(0,t.createElement)(r.TextControl,{label:(0,i.__)("Title","activitypub"),help:(0,i.__)("Title to display above the list of followers. Blank for none.","activitypub"),value:s,onChange:e=>a({title:e})}),w.length>1&&(0,t.createElement)(r.SelectControl,{label:(0,i.__)("Select User","activitypub"),value:c,options:w,onChange:b("selectedUser")}),(0,t.createElement)(r.SelectControl,{label:(0,i.__)("Sort","activitypub"),value:l,options:m,onChange:b("order")}),(0,t.createElement)(r.RangeControl,{label:(0,i.__)("Number of Followers","activitypub"),value:n,onChange:b("per_page"),min:1,max:10}))),(0,t.createElement)(f,{...e,page:u,setPage:v,followLinks:!1}))},save:()=>null,icon:n})})()})();
|
(0,s.__)("More <span>→</span>","activitypub"),{span:(0,l.createElement)("span",{className:"wp-block-query-pagination-next-arrow is-arrow-arrow","aria-hidden":"true"})}),L=(e,a)=>{f(e),E(a),k(Math.ceil(a/t))};return(0,l.useEffect)((()=>{if(m&&1===S)return L(m.followers,m.total);const e=function(e,t,a,r){const n=`/${y}/actors/${e}/followers`,l={per_page:t,order:a,page:r,context:"full"};return(0,v.addQueryArgs)(n,l)}(w,t,a,S);u()({path:e}).then((e=>L(e.orderedItems,e.totalItems))).catch((()=>{}))}),[w,t,a,S,m]),(0,l.createElement)("div",{className:"activitypub-follower-block "+c},(0,l.createElement)("h3",null,r),(0,l.createElement)("ul",null,d&&d.map((e=>(0,l.createElement)("li",{key:e.url},(0,l.createElement)(_,{...e,followLinks:p}))))),g>1&&(0,l.createElement)(b,{page:S,perPage:t,total:h,pageClick:C,nextLabel:P,prevLabel:O,compact:"is-style-compact"===c}))}function _({name:e,icon:t,url:a,preferredUsername:r,followLinks:n=!0}){const i=`@${r}`,c={};return n||(c.onClick=e=>e.preventDefault()),(0,l.createElement)(o.ExternalLink,{className:"activitypub-link",href:a,title:i,...c},(0,l.createElement)("img",{width:"40",height:"40",src:t.url,className:"avatar activitypub-avatar",alt:e}),(0,l.createElement)("span",{className:"activitypub-actor"},(0,l.createElement)("strong",{className:"activitypub-name"},e),(0,l.createElement)("span",{className:"sep"},"/"),(0,l.createElement)("span",{className:"activitypub-handle"},i)))}const k=window.wp.data,h=window._activityPubOptions?.enabled;(0,e.registerBlockType)("activitypub/followers",{edit:function({attributes:e,setAttributes:t}){const{order:a,per_page:r,selectedUser:n,title:p}=e,u=(0,c.useBlockProps)(),[v,m]=(0,i.useState)(1),w=[{label:(0,s.__)("New to old","activitypub"),value:"desc"},{label:(0,s.__)("Old to new","activitypub"),value:"asc"}],d=function(){const e=h?.users?(0,k.useSelect)((e=>e("core").getUsers({who:"authors"}))):[];return(0,i.useMemo)((()=>{if(!e)return[];const t=h?.site?[{label:(0,s.__)("Whole Site","activitypub"),value:"site"}]:[];return e.reduce(((e,t)=>(e.push({label:t.name,value:`${t.id}`}),e)),t)}),[e])}(),f=e=>a=>{m(1),t({[e]:a})};return(0,i.useEffect)((()=>{d.length&&(d.find((({value:e})=>e===n))||t({selectedUser:d[0].value}))}),[n,d]),(0,l.createElement)("div",{...u},(0,l.createElement)(c.InspectorControls,{key:"setting"},(0,l.createElement)(o.PanelBody,{title:(0,s.__)("Followers Options","activitypub")},(0,l.createElement)(o.TextControl,{label:(0,s.__)("Title","activitypub"),help:(0,s.__)("Title to display above the list of followers. Blank for none.","activitypub"),value:p,onChange:e=>t({title:e})}),d.length>1&&(0,l.createElement)(o.SelectControl,{label:(0,s.__)("Select User","activitypub"),value:n,options:d,onChange:f("selectedUser")}),(0,l.createElement)(o.SelectControl,{label:(0,s.__)("Sort","activitypub"),value:a,options:w,onChange:f("order")}),(0,l.createElement)(o.RangeControl,{label:(0,s.__)("Number of Followers","activitypub"),value:r,onChange:f("per_page"),min:1,max:10}))),(0,l.createElement)(g,{...e,page:v,setPage:m,followLinks:!1}))},save:()=>null,icon:n})})()})();
|
@ -0,0 +1 @@
|
|||||||
|
.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 +1 @@
|
|||||||
<?php return array('dependencies' => array('react', 'wp-api-fetch', 'wp-components', 'wp-dom-ready', 'wp-element', 'wp-i18n', 'wp-url'), 'version' => '8c01e26171636c3b698f');
|
<?php return array('dependencies' => array('react', 'wp-api-fetch', 'wp-components', 'wp-dom-ready', 'wp-element', 'wp-i18n', 'wp-url'), 'version' => '111b88843c05346aadbf');
|
||||||
|
@ -1,3 +1,3 @@
|
|||||||
(()=>{var e,t={142:(e,t,a)=>{"use strict";const r=window.wp.element,n=window.React,l=window.wp.apiFetch;var o=a.n(l);const i=window.wp.url,c=window.wp.i18n;var s=a(184),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)}const m={outlined:"outlined",minimal:"minimal"};function f({compact:e,nextLabel:t,page:a,pageClick:n,perPage:l,prevLabel:o,total:i,variant:c=m.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(i/l)),f=p()("alignwide wp-block-query-pagination is-content-justification-space-between is-layout-flex wp-block-query-pagination-is-layout-flex",`is-${c}`,{"is-compact":e});return(0,r.createElement)("nav",{className:f},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(i/l),"aria-label":t,className:"wp-block-query-pagination-next block-editor-block-list__block"},t))}const v=window.wp.components,{namespace:d}=window._activityPubOptions;function b({selectedUser:e,per_page:t,order:a,title:l,page:s,setPage:p,className:u="",followLinks:m=!0,followerData:v=!1}){const b="site"===e?0:e,[g,k]=(0,n.useState)([]),[y,h]=(0,n.useState)(0),[E,x]=(0,n.useState)(0),[_,O]=function(){const[e,t]=(0,n.useState)(1);return[e,t]}(),N=s||_,S=p||O,C=(0,r.createInterpolateElement)(/* translators: arrow for previous followers link */
|
(()=>{var e,t={250:(e,t,a)=>{"use strict";const r=window.React,n=window.wp.apiFetch;var l=a.n(n);const o=window.wp.url,i=window.wp.element,c=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)}const m={outlined:"outlined",minimal:"minimal"};function f({compact:e,nextLabel:t,page:a,pageClick:n,perPage:l,prevLabel:o,total:i,variant:c=m.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(i/l)),f=p()("alignwide wp-block-query-pagination is-content-justification-space-between is-layout-flex wp-block-query-pagination-is-layout-flex",`is-${c}`,{"is-compact":e});return(0,r.createElement)("nav",{className:f},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(i/l),"aria-label":t,className:"wp-block-query-pagination-next block-editor-block-list__block"},t))}const v=window.wp.components,{namespace:b}=window._activityPubOptions;function d({selectedUser:e,per_page:t,order:a,title:n,page:s,setPage:p,className:u="",followLinks:m=!0,followerData:v=!1}){const d="site"===e?0:e,[g,y]=(0,r.useState)([]),[k,h]=(0,r.useState)(0),[E,N]=(0,r.useState)(0),[x,_]=function(){const[e,t]=(0,r.useState)(1);return[e,t]}(),O=s||x,S=p||_,C=(0,i.createInterpolateElement)(/* translators: arrow for previous followers link */ /* translators: arrow for previous followers link */
|
||||||
(0,c.__)("<span>←</span> Less","activitypub"),{span:(0,r.createElement)("span",{class:"wp-block-query-pagination-previous-arrow is-arrow-arrow","aria-hidden":"true"})}),L=(0,r.createInterpolateElement)(/* translators: arrow for next followers link */
|
(0,c.__)("<span>←</span> Less","activitypub"),{span:(0,r.createElement)("span",{className:"wp-block-query-pagination-previous-arrow is-arrow-arrow","aria-hidden":"true"})}),L=(0,i.createInterpolateElement)(/* translators: arrow for next followers link */ /* translators: arrow for next followers link */
|
||||||
(0,c.__)("More <span>→</span>","activitypub"),{span:(0,r.createElement)("span",{class:"wp-block-query-pagination-next-arrow is-arrow-arrow","aria-hidden":"true"})}),j=(e,a)=>{k(e),x(a),h(Math.ceil(a/t))};return(0,n.useEffect)((()=>{if(v&&1===N)return j(v.followers,v.total);const e=function(e,t,a,r){const n=`/${d}/actors/${e}/followers`,l={per_page:t,order:a,page:r,context:"full"};return(0,i.addQueryArgs)(n,l)}(b,t,a,N);o()({path:e}).then((e=>j(e.orderedItems,e.totalItems))).catch((()=>{}))}),[b,t,a,N,v]),(0,r.createElement)("div",{className:"activitypub-follower-block "+u},(0,r.createElement)("h3",null,l),(0,r.createElement)("ul",null,g&&g.map((e=>(0,r.createElement)("li",{key:e.url},(0,r.createElement)(w,{...e,followLinks:m}))))),y>1&&(0,r.createElement)(f,{page:N,perPage:t,total:E,pageClick:S,nextLabel:L,prevLabel:C,compact:"is-style-compact"===u}))}function w({name:e,icon:t,url:a,preferredUsername:n,followLinks:l=!0}){const o=`@${n}`,i={};return l||(i.onClick=e=>e.preventDefault()),(0,r.createElement)(v.ExternalLink,{className:"activitypub-link",href:a,title:o,...i},(0,r.createElement)("img",{width:"40",height:"40",src:t.url,class:"avatar activitypub-avatar",alt:e}),(0,r.createElement)("span",{class:"activitypub-actor"},(0,r.createElement)("strong",{className:"activitypub-name"},e),(0,r.createElement)("span",{class:"sep"},"/"),(0,r.createElement)("span",{class:"activitypub-handle"},o)))}const g=window.wp.domReady;a.n(g)()((()=>{[].forEach.call(document.querySelectorAll(".activitypub-follower-block"),(e=>{const t=JSON.parse(e.dataset.attrs);(0,r.render)((0,r.createElement)(b,{...t}),e)}))}))},184:(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];if(a){var l=typeof a;if("string"===l||"number"===l)e.push(a);else if(Array.isArray(a)){if(a.length){var o=n.apply(null,a);o&&e.push(o)}}else if("object"===l){if(a.toString!==Object.prototype.toString&&!a.toString.toString().includes("[native code]")){e.push(a.toString());continue}for(var i in a)r.call(a,i)&&a[i]&&e.push(i)}}}return e.join(" ")}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 i=!0,c=0;c<a.length;c++)(!1&l||o>=l)&&Object.keys(r.O).every((e=>r.O[e](a[c])))?a.splice(c--,1):(i=!1,l<o&&(o=l));if(i){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={638:0,962:0};r.O.j=t=>0===e[t];var t=(t,a)=>{var n,l,o=a[0],i=a[1],c=a[2],s=0;if(o.some((t=>0!==e[t]))){for(n in i)r.o(i,n)&&(r.m[n]=i[n]);if(c)var p=c(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,[962],(()=>r(142)));n=r.O(n)})();
|
(0,c.__)("More <span>→</span>","activitypub"),{span:(0,r.createElement)("span",{className:"wp-block-query-pagination-next-arrow is-arrow-arrow","aria-hidden":"true"})}),q=(e,a)=>{y(e),N(a),h(Math.ceil(a/t))};return(0,r.useEffect)((()=>{if(v&&1===O)return q(v.followers,v.total);const e=function(e,t,a,r){const n=`/${b}/actors/${e}/followers`,l={per_page:t,order:a,page:r,context:"full"};return(0,o.addQueryArgs)(n,l)}(d,t,a,O);l()({path:e}).then((e=>q(e.orderedItems,e.totalItems))).catch((()=>{}))}),[d,t,a,O,v]),(0,r.createElement)("div",{className:"activitypub-follower-block "+u},(0,r.createElement)("h3",null,n),(0,r.createElement)("ul",null,g&&g.map((e=>(0,r.createElement)("li",{key:e.url},(0,r.createElement)(w,{...e,followLinks:m}))))),k>1&&(0,r.createElement)(f,{page:O,perPage:t,total:E,pageClick:S,nextLabel:L,prevLabel:C,compact:"is-style-compact"===u}))}function w({name:e,icon:t,url:a,preferredUsername:n,followLinks:l=!0}){const o=`@${n}`,i={};return l||(i.onClick=e=>e.preventDefault()),(0,r.createElement)(v.ExternalLink,{className:"activitypub-link",href:a,title:o,...i},(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 g=window.wp.domReady;a.n(g)()((()=>{[].forEach.call(document.querySelectorAll(".activitypub-follower-block"),(e=>{const t=JSON.parse(e.dataset.attrs);(0,i.createRoot)(e).render((0,r.createElement)(d,{...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++){for(var[a,n,l]=e[p],i=!0,c=0;c<a.length;c++)(!1&l||o>=l)&&Object.keys(r.O).every((e=>r.O[e](a[c])))?a.splice(c--,1):(i=!1,l<o&&(o=l));if(i){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,i,c]=a,s=0;if(o.some((t=>0!==e[t]))){for(n in i)r.o(i,n)&&(r.m[n]=i[n]);if(c)var p=c(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=globalThis.webpackChunkwordpress_activitypub=globalThis.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(250)));n=r.O(n)})();
|
@ -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' => '9aee45886ecf2680fbd4');
|
<?php return array('dependencies' => array('react', 'wp-api-fetch', 'wp-components', 'wp-compose', 'wp-dom-ready', 'wp-element', 'wp-i18n', 'wp-primitives'), 'version' => 'ab787305c7ed07812b96');
|
||||||
|
File diff suppressed because one or more lines are too long
@ -0,0 +1 @@
|
|||||||
|
.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(--wp--preset--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 +1 @@
|
|||||||
.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(--wp--preset--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__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:1px solid var(--wp--preset--color--black);border-radius:inherit 0;color:var(--wp--preset--color--black);flex:1;padding:6px 12px}.activitypub__dialog .activitypub-dialog__button-group button{align-self:center;background-color:var(--wp--preset--color--black);color:var(--wp--preset--color--white);margin-left:0;text-decoration:none}
|
.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(--wp--preset--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}
|
||||||
|
@ -94,7 +94,7 @@ class Activity_Dispatcher {
|
|||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
public static function send_announce( $wp_object, $type ) {
|
public static function send_announce( $wp_object, $type ) {
|
||||||
if ( ! in_array( $type, array( 'Create', 'Update' ), true ) ) {
|
if ( ! in_array( $type, array( 'Create', 'Update', 'Delete' ), true ) ) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -45,6 +45,8 @@ class Activitypub {
|
|||||||
|
|
||||||
\add_action( 'in_plugin_update_message-' . ACTIVITYPUB_PLUGIN_BASENAME, array( self::class, 'plugin_update_message' ) );
|
\add_action( 'in_plugin_update_message-' . ACTIVITYPUB_PLUGIN_BASENAME, array( self::class, 'plugin_update_message' ) );
|
||||||
|
|
||||||
|
\add_filter( 'activitypub_get_actor_extra_fields', array( self::class, 'default_actor_extra_fields' ), 10, 2 );
|
||||||
|
|
||||||
// register several post_types
|
// register several post_types
|
||||||
self::register_post_types();
|
self::register_post_types();
|
||||||
}
|
}
|
||||||
@ -458,13 +460,43 @@ class Activitypub {
|
|||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
\register_post_type(
|
||||||
|
'ap_extrafield',
|
||||||
|
array(
|
||||||
|
'labels' => array(
|
||||||
|
'name' => _x( 'Extra fields', 'post_type plural name', 'activitypub' ),
|
||||||
|
'singular_name' => _x( 'Extra field', 'post_type single name', 'activitypub' ),
|
||||||
|
'add_new' => __( 'Add new', 'activitypub' ),
|
||||||
|
'add_new_item' => __( 'Add new extra field', 'activitypub' ),
|
||||||
|
'new_item' => __( 'New extra field', 'activitypub' ),
|
||||||
|
'edit_item' => __( 'Edit extra field', 'activitypub' ),
|
||||||
|
'view_item' => __( 'View extra field', 'activitypub' ),
|
||||||
|
'all_items' => __( 'All extra fields', 'activitypub' ),
|
||||||
|
),
|
||||||
|
'public' => false,
|
||||||
|
'hierarchical' => false,
|
||||||
|
'query_var' => false,
|
||||||
|
'has_archive' => false,
|
||||||
|
'publicly_queryable' => false,
|
||||||
|
'show_in_menu' => false,
|
||||||
|
'delete_with_user' => true,
|
||||||
|
'can_export' => true,
|
||||||
|
'exclude_from_search' => true,
|
||||||
|
'show_in_rest' => true,
|
||||||
|
'map_meta_cap' => true,
|
||||||
|
'show_ui' => true,
|
||||||
|
'supports' => array( 'title', 'editor' ),
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
\do_action( 'activitypub_after_register_post_type' );
|
\do_action( 'activitypub_after_register_post_type' );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add the 'activitypub' query variable so WordPress won't mangle it.
|
* Add the 'activitypub' capability to users who can publish posts.
|
||||||
*
|
*
|
||||||
* @param int $user_id User ID.
|
* @param int $user_id User ID.
|
||||||
|
*
|
||||||
* @param array $userdata The raw array of data passed to wp_insert_user().
|
* @param array $userdata The raw array of data passed to wp_insert_user().
|
||||||
*/
|
*/
|
||||||
public static function user_register( $user_id ) {
|
public static function user_register( $user_id ) {
|
||||||
@ -473,4 +505,57 @@ class Activitypub {
|
|||||||
$user->add_cap( 'activitypub' );
|
$user->add_cap( 'activitypub' );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add default extra fields to an actor.
|
||||||
|
*
|
||||||
|
* @param array $extra_fields The extra fields.
|
||||||
|
* @param int $user_id The User-ID.
|
||||||
|
*
|
||||||
|
* @return array The extra fields.
|
||||||
|
*/
|
||||||
|
public static function default_actor_extra_fields( $extra_fields, $user_id ) {
|
||||||
|
if ( $extra_fields || ! $user_id ) {
|
||||||
|
return $extra_fields;
|
||||||
|
}
|
||||||
|
|
||||||
|
$already_migrated = \get_user_meta( $user_id, 'activitypub_default_extra_fields', true );
|
||||||
|
|
||||||
|
if ( $already_migrated ) {
|
||||||
|
return $extra_fields;
|
||||||
|
}
|
||||||
|
|
||||||
|
$defaults = array(
|
||||||
|
\__( 'Blog', 'activitypub' ) => \home_url( '/' ),
|
||||||
|
\__( 'Profile', 'activitypub' ) => \get_author_posts_url( $user_id ),
|
||||||
|
\__( 'Homepage', 'activitypub' ) => \get_the_author_meta( 'user_url', $user_id ),
|
||||||
|
);
|
||||||
|
|
||||||
|
foreach ( $defaults as $title => $url ) {
|
||||||
|
if ( ! $url ) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
$extra_field = array(
|
||||||
|
'post_type' => 'ap_extrafield',
|
||||||
|
'post_title' => $title,
|
||||||
|
'post_status' => 'publish',
|
||||||
|
'post_author' => $user_id,
|
||||||
|
'post_content' => sprintf(
|
||||||
|
'<!-- wp:paragraph --><p><a rel="me" title="%s" target="_blank" href="%s">%s</a></p><!-- /wp:paragraph -->',
|
||||||
|
\esc_attr( $url ),
|
||||||
|
$url,
|
||||||
|
\wp_parse_url( $url, \PHP_URL_HOST )
|
||||||
|
),
|
||||||
|
'comment_status' => 'closed',
|
||||||
|
);
|
||||||
|
|
||||||
|
$extra_field_id = wp_insert_post( $extra_field );
|
||||||
|
$extra_fields[] = get_post( $extra_field_id );
|
||||||
|
}
|
||||||
|
|
||||||
|
\update_user_meta( $user_id, 'activitypub_default_extra_fields', true );
|
||||||
|
|
||||||
|
return $extra_fields;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -3,12 +3,14 @@ namespace Activitypub;
|
|||||||
|
|
||||||
use WP_User_Query;
|
use WP_User_Query;
|
||||||
use Activitypub\Model\Blog;
|
use Activitypub\Model\Blog;
|
||||||
|
use Activitypub\Activitypub;
|
||||||
use Activitypub\Collection\Users;
|
use Activitypub\Collection\Users;
|
||||||
|
|
||||||
use function Activitypub\count_followers;
|
use function Activitypub\count_followers;
|
||||||
use function Activitypub\is_user_disabled;
|
use function Activitypub\is_user_disabled;
|
||||||
use function Activitypub\was_comment_received;
|
use function Activitypub\was_comment_received;
|
||||||
use function Activitypub\is_comment_federatable;
|
use function Activitypub\is_comment_federatable;
|
||||||
|
use function Activitypub\add_default_actor_extra_fields;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ActivityPub Admin Class
|
* ActivityPub Admin Class
|
||||||
@ -23,16 +25,21 @@ class Admin {
|
|||||||
\add_action( 'admin_menu', array( self::class, 'admin_menu' ) );
|
\add_action( 'admin_menu', array( self::class, 'admin_menu' ) );
|
||||||
\add_action( 'admin_init', array( self::class, 'register_settings' ) );
|
\add_action( 'admin_init', array( self::class, 'register_settings' ) );
|
||||||
\add_action( 'load-comment.php', array( self::class, 'edit_comment' ) );
|
\add_action( 'load-comment.php', array( self::class, 'edit_comment' ) );
|
||||||
|
\add_action( 'load-post.php', array( self::class, 'edit_post' ) );
|
||||||
|
\add_action( 'load-edit.php', array( self::class, 'list_posts' ) );
|
||||||
\add_action( 'personal_options_update', array( self::class, 'save_user_description' ) );
|
\add_action( 'personal_options_update', array( self::class, 'save_user_description' ) );
|
||||||
\add_action( 'admin_enqueue_scripts', array( self::class, 'enqueue_scripts' ) );
|
\add_action( 'admin_enqueue_scripts', array( self::class, 'enqueue_scripts' ) );
|
||||||
\add_action( 'admin_notices', array( self::class, 'admin_notices' ) );
|
\add_action( 'admin_notices', array( self::class, 'admin_notices' ) );
|
||||||
|
|
||||||
\add_filter( 'comment_row_actions', array( self::class, 'comment_row_actions' ), 10, 2 );
|
\add_filter( 'comment_row_actions', array( self::class, 'comment_row_actions' ), 10, 2 );
|
||||||
\add_filter( 'manage_edit-comments_columns', array( static::class, 'manage_comment_columns' ) );
|
\add_filter( 'manage_edit-comments_columns', array( static::class, 'manage_comment_columns' ) );
|
||||||
\add_filter( 'manage_comments_custom_column', array( static::class, 'manage_comments_custom_column' ), 9, 2 );
|
\add_action( 'manage_comments_custom_column', array( static::class, 'manage_comments_custom_column' ), 9, 2 );
|
||||||
|
|
||||||
|
\add_filter( 'manage_posts_columns', array( static::class, 'manage_post_columns' ), 10, 2 );
|
||||||
|
\add_action( 'manage_posts_custom_column', array( self::class, 'manage_posts_custom_column' ), 10, 2 );
|
||||||
|
|
||||||
\add_filter( 'manage_users_columns', array( self::class, 'manage_users_columns' ), 10, 1 );
|
\add_filter( 'manage_users_columns', array( self::class, 'manage_users_columns' ), 10, 1 );
|
||||||
\add_filter( 'manage_users_custom_column', array( self::class, 'manage_users_custom_column' ), 10, 3 );
|
\add_action( 'manage_users_custom_column', array( self::class, 'manage_users_custom_column' ), 10, 3 );
|
||||||
\add_filter( 'bulk_actions-users', array( self::class, 'user_bulk_options' ) );
|
\add_filter( 'bulk_actions-users', array( self::class, 'user_bulk_options' ) );
|
||||||
\add_filter( 'handle_bulk_actions-users', array( self::class, 'handle_bulk_request' ), 10, 3 );
|
\add_filter( 'handle_bulk_actions-users', array( self::class, 'handle_bulk_request' ), 10, 3 );
|
||||||
|
|
||||||
@ -62,6 +69,8 @@ class Admin {
|
|||||||
$followers_list_page = \add_users_page( \__( 'Followers', 'activitypub' ), \__( 'Followers', 'activitypub' ), 'read', 'activitypub-followers-list', array( self::class, 'followers_list_page' ) );
|
$followers_list_page = \add_users_page( \__( 'Followers', 'activitypub' ), \__( 'Followers', 'activitypub' ), 'read', 'activitypub-followers-list', array( self::class, 'followers_list_page' ) );
|
||||||
|
|
||||||
\add_action( 'load-' . $followers_list_page, array( self::class, 'add_followers_list_help_tab' ) );
|
\add_action( 'load-' . $followers_list_page, array( self::class, 'add_followers_list_help_tab' ) );
|
||||||
|
|
||||||
|
\add_users_page( \__( 'Extra Fields', 'activitypub' ), \__( 'Extra Fields', 'activitypub' ), 'read', esc_url( admin_url( '/edit.php?post_type=ap_extrafield' ) ) );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -76,6 +85,16 @@ class Admin {
|
|||||||
$admin_notice = \__( 'You are using the ActivityPub plugin with a permalink structure of "plain". This will prevent ActivityPub from working. Please go to "Settings" / "Permalinks" and choose a permalink structure other than "plain".', 'activitypub' );
|
$admin_notice = \__( 'You are using the ActivityPub plugin with a permalink structure of "plain". This will prevent ActivityPub from working. Please go to "Settings" / "Permalinks" and choose a permalink structure other than "plain".', 'activitypub' );
|
||||||
self::show_admin_notice( $admin_notice, 'error' );
|
self::show_admin_notice( $admin_notice, 'error' );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$current_screen = get_current_screen();
|
||||||
|
|
||||||
|
if ( isset( $current_screen->id ) && 'edit-ap_extrafield' === $current_screen->id ) {
|
||||||
|
?>
|
||||||
|
<div class="notice" style="margin: 0; background: none; border: none; box-shadow: none; padding: 15px 0 0 0; font-size: 14px;">
|
||||||
|
<?php esc_html_e( 'These are extra fields that are used for your ActivityPub profile. You can use your homepage, social profiles, pronouns, age, anything you want.', 'activitypub' ); ?>
|
||||||
|
</div>
|
||||||
|
<?php
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -353,6 +372,68 @@ class Admin {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static function edit_post() {
|
||||||
|
// Disable the edit_post capability for federated posts.
|
||||||
|
\add_filter(
|
||||||
|
'user_has_cap',
|
||||||
|
function ( $allcaps, $caps, $arg ) {
|
||||||
|
if ( 'edit_post' !== $arg[0] ) {
|
||||||
|
return $allcaps;
|
||||||
|
}
|
||||||
|
|
||||||
|
$post = get_post( $arg[2] );
|
||||||
|
|
||||||
|
if ( 'ap_extrafield' !== $post->post_type ) {
|
||||||
|
return $allcaps;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( (int) get_current_user_id() !== (int) $post->post_author ) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $allcaps;
|
||||||
|
},
|
||||||
|
1,
|
||||||
|
3
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add ActivityPub specific actions/filters to the post list view
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public static function list_posts() {
|
||||||
|
// Show only the user's extra fields.
|
||||||
|
\add_action(
|
||||||
|
'pre_get_posts',
|
||||||
|
function ( $query ) {
|
||||||
|
if ( $query->get( 'post_type' ) === 'ap_extrafield' ) {
|
||||||
|
$query->set( 'author', get_current_user_id() );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
// Remove all views for the extra fields.
|
||||||
|
$screen_id = get_current_screen()->id;
|
||||||
|
|
||||||
|
add_filter(
|
||||||
|
"views_{$screen_id}",
|
||||||
|
function ( $views ) {
|
||||||
|
if ( 'ap_extrafield' === get_post_type() ) {
|
||||||
|
return array();
|
||||||
|
}
|
||||||
|
|
||||||
|
return $views;
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
// Set defaults for new extra fields.
|
||||||
|
if ( 'edit-ap_extrafield' === $screen_id ) {
|
||||||
|
Activitypub::default_actor_extra_fields( array(), get_current_user_id() );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public static function comment_row_actions( $actions, $comment ) {
|
public static function comment_row_actions( $actions, $comment ) {
|
||||||
if ( was_comment_received( $comment ) ) {
|
if ( was_comment_received( $comment ) ) {
|
||||||
unset( $actions['edit'] );
|
unset( $actions['edit'] );
|
||||||
@ -388,6 +469,22 @@ class Admin {
|
|||||||
return $columns;
|
return $columns;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add "post_content" as column for Extra-Fields in WP-Admin
|
||||||
|
*
|
||||||
|
* @param array $columns Tthe list of column names.
|
||||||
|
* @param string $post_type The post type.
|
||||||
|
*/
|
||||||
|
public static function manage_post_columns( $columns, $post_type ) {
|
||||||
|
if ( 'ap_extrafield' === $post_type ) {
|
||||||
|
$after_key = 'title';
|
||||||
|
$index = array_search( $after_key, array_keys( $columns ), true );
|
||||||
|
$columns = array_slice( $columns, 0, $index + 1 ) + array( 'extra_field_content' => esc_attr__( 'Content', 'activitypub' ) ) + $columns;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $columns;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Add "comment-type" and "protocol" as column in WP-Admin
|
* Add "comment-type" and "protocol" as column in WP-Admin
|
||||||
*
|
*
|
||||||
@ -423,9 +520,28 @@ class Admin {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ( \user_can( $user_id, 'activitypub' ) ) {
|
if ( \user_can( $user_id, 'activitypub' ) ) {
|
||||||
return '✓';
|
return '<span aria-hidden="true">✓</span><span class="screen-reader-text">' . esc_html__( 'ActivityPub enabled for this author', 'activitypub' ) . '</span>';
|
||||||
} else {
|
} else {
|
||||||
return '✗';
|
return '<span aria-hidden="true">✗</span><span class="screen-reader-text">' . esc_html__( 'ActivityPub disabled for this author', 'activitypub' ) . '</span>';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add a column "extra_field_content" to the post list view
|
||||||
|
*
|
||||||
|
* @param string $column_name The column name.
|
||||||
|
* @param int $post_id The post ID.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public static function manage_posts_custom_column( $column_name, $post_id ) {
|
||||||
|
$post = get_post( $post_id );
|
||||||
|
|
||||||
|
if ( 'extra_field_content' === $column_name ) {
|
||||||
|
$post = get_post( $post_id );
|
||||||
|
if ( 'ap_extrafield' === $post->post_type ) {
|
||||||
|
echo esc_attr( wp_strip_all_tags( $post->post_content ) );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -241,7 +241,7 @@ class Comment {
|
|||||||
*
|
*
|
||||||
* @param string $id ActivityPub object ID (usually a URL) to check.
|
* @param string $id ActivityPub object ID (usually a URL) to check.
|
||||||
*
|
*
|
||||||
* @return int|boolean Comment ID, or false on failure.
|
* @return \WP_Comment|false Comment object, or false on failure.
|
||||||
*/
|
*/
|
||||||
public static function object_id_to_comment( $id ) {
|
public static function object_id_to_comment( $id ) {
|
||||||
$comment_query = new WP_Comment_Query(
|
$comment_query = new WP_Comment_Query(
|
||||||
|
@ -118,7 +118,7 @@ class Migration {
|
|||||||
|
|
||||||
// schedule the async migration
|
// schedule the async migration
|
||||||
if ( ! \wp_next_scheduled( 'activitypub_migrate', $version_from_db ) ) {
|
if ( ! \wp_next_scheduled( 'activitypub_migrate', $version_from_db ) ) {
|
||||||
\wp_schedule_single_event( \time(), 'activitypub_migrate', $version_from_db );
|
\wp_schedule_single_event( \time(), 'activitypub_migrate', array( $version_from_db ) );
|
||||||
}
|
}
|
||||||
if ( version_compare( $version_from_db, '0.17.0', '<' ) ) {
|
if ( version_compare( $version_from_db, '0.17.0', '<' ) ) {
|
||||||
self::migrate_from_0_16();
|
self::migrate_from_0_16();
|
||||||
|
@ -117,6 +117,11 @@ class Scheduler {
|
|||||||
public static function schedule_post_activity( $new_status, $old_status, $post ) {
|
public static function schedule_post_activity( $new_status, $old_status, $post ) {
|
||||||
$post = get_post( $post );
|
$post = get_post( $post );
|
||||||
|
|
||||||
|
if ( 'ap_extrafield' === $post->post_type ) {
|
||||||
|
self::schedule_profile_update( $post->post_author );
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// Do not send activities if post is password protected.
|
// Do not send activities if post is password protected.
|
||||||
if ( \post_password_required( $post ) ) {
|
if ( \post_password_required( $post ) ) {
|
||||||
return;
|
return;
|
||||||
@ -130,9 +135,16 @@ class Scheduler {
|
|||||||
|
|
||||||
$type = false;
|
$type = false;
|
||||||
|
|
||||||
if ( 'publish' === $new_status && 'publish' !== $old_status ) {
|
if (
|
||||||
|
'publish' === $new_status &&
|
||||||
|
'publish' !== $old_status
|
||||||
|
) {
|
||||||
$type = 'Create';
|
$type = 'Create';
|
||||||
} elseif ( 'publish' === $new_status ) {
|
} elseif (
|
||||||
|
'publish' === $new_status ||
|
||||||
|
( 'draft' === $new_status &&
|
||||||
|
'draft' !== $old_status )
|
||||||
|
) {
|
||||||
$type = 'Update';
|
$type = 'Update';
|
||||||
} elseif ( 'trash' === $new_status ) {
|
} elseif ( 'trash' === $new_status ) {
|
||||||
$type = 'Delete';
|
$type = 'Delete';
|
||||||
@ -311,7 +323,9 @@ class Scheduler {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Theme mods only have a dynamic filter so we fudge it like this.
|
* Theme mods only have a dynamic filter so we fudge it like this.
|
||||||
|
*
|
||||||
* @param mixed $value
|
* @param mixed $value
|
||||||
|
*
|
||||||
* @return mixed
|
* @return mixed
|
||||||
*/
|
*/
|
||||||
public static function blog_user_update( $value = null ) {
|
public static function blog_user_update( $value = null ) {
|
||||||
@ -321,6 +335,7 @@ class Scheduler {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Send a profile update to all followers. Gets hooked into all relevant options/meta etc.
|
* Send a profile update to all followers. Gets hooked into all relevant options/meta etc.
|
||||||
|
*
|
||||||
* @param int $user_id The user ID to update (Could be 0 for Blog-User).
|
* @param int $user_id The user ID to update (Could be 0 for Blog-User).
|
||||||
*/
|
*/
|
||||||
public static function schedule_profile_update( $user_id ) {
|
public static function schedule_profile_update( $user_id ) {
|
||||||
|
@ -46,7 +46,10 @@ class Webfinger {
|
|||||||
return new WP_Error(
|
return new WP_Error(
|
||||||
'webfinger_missing_links',
|
'webfinger_missing_links',
|
||||||
__( 'No valid Link elements found.', 'activitypub' ),
|
__( 'No valid Link elements found.', 'activitypub' ),
|
||||||
$data
|
array(
|
||||||
|
'status' => 400,
|
||||||
|
'data' => $data,
|
||||||
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -65,7 +68,10 @@ class Webfinger {
|
|||||||
return new WP_Error(
|
return new WP_Error(
|
||||||
'webfinger_url_no_activitypub',
|
'webfinger_url_no_activitypub',
|
||||||
__( 'The Site supports WebFinger but not ActivityPub', 'activitypub' ),
|
__( 'The Site supports WebFinger but not ActivityPub', 'activitypub' ),
|
||||||
$data
|
array(
|
||||||
|
'status' => 400,
|
||||||
|
'data' => $data,
|
||||||
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -103,7 +109,10 @@ class Webfinger {
|
|||||||
return new WP_Error(
|
return new WP_Error(
|
||||||
'webfinger_url_no_acct',
|
'webfinger_url_no_acct',
|
||||||
__( 'No acct URI found.', 'activitypub' ),
|
__( 'No acct URI found.', 'activitypub' ),
|
||||||
$data
|
array(
|
||||||
|
'status' => 400,
|
||||||
|
'data' => $data,
|
||||||
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -117,6 +126,17 @@ class Webfinger {
|
|||||||
* identifier and host as values
|
* identifier and host as values
|
||||||
*/
|
*/
|
||||||
public static function get_identifier_and_host( $url ) {
|
public static function get_identifier_and_host( $url ) {
|
||||||
|
if ( ! $url ) {
|
||||||
|
return new WP_Error(
|
||||||
|
'webfinger_invalid_identifier',
|
||||||
|
__( 'Invalid Identifier', 'activitypub' ),
|
||||||
|
array(
|
||||||
|
'status' => 400,
|
||||||
|
'data' => $url,
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
// remove leading @
|
// remove leading @
|
||||||
$url = ltrim( $url, '@' );
|
$url = ltrim( $url, '@' );
|
||||||
|
|
||||||
@ -144,7 +164,14 @@ class Webfinger {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ( empty( $host ) ) {
|
if ( empty( $host ) ) {
|
||||||
return new WP_Error( 'webfinger_invalid_identifier', __( 'Invalid Identifier', 'activitypub' ) );
|
return new WP_Error(
|
||||||
|
'webfinger_invalid_identifier',
|
||||||
|
__( 'Invalid Identifier', 'activitypub' ),
|
||||||
|
array(
|
||||||
|
'status' => 400,
|
||||||
|
'data' => $url,
|
||||||
|
)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
return array( $identifier, $host );
|
return array( $identifier, $host );
|
||||||
@ -174,7 +201,7 @@ class Webfinger {
|
|||||||
return $data;
|
return $data;
|
||||||
}
|
}
|
||||||
|
|
||||||
$webfinger_url = 'https://' . $host . '/.well-known/webfinger?resource=' . rawurlencode( $identifier );
|
$webfinger_url = sprintf( 'https://%s/.well-known/webfinger?resource=%s', $host, rawurlencode( $identifier ) );
|
||||||
|
|
||||||
$response = wp_safe_remote_get(
|
$response = wp_safe_remote_get(
|
||||||
$webfinger_url,
|
$webfinger_url,
|
||||||
@ -187,7 +214,10 @@ class Webfinger {
|
|||||||
return new WP_Error(
|
return new WP_Error(
|
||||||
'webfinger_url_not_accessible',
|
'webfinger_url_not_accessible',
|
||||||
__( 'The WebFinger Resource is not accessible.', 'activitypub' ),
|
__( 'The WebFinger Resource is not accessible.', 'activitypub' ),
|
||||||
$webfinger_url
|
array(
|
||||||
|
'status' => 400,
|
||||||
|
'data' => $webfinger_url,
|
||||||
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -215,7 +245,10 @@ class Webfinger {
|
|||||||
return new WP_Error(
|
return new WP_Error(
|
||||||
'webfinger_missing_links',
|
'webfinger_missing_links',
|
||||||
__( 'No valid Link elements found.', 'activitypub' ),
|
__( 'No valid Link elements found.', 'activitypub' ),
|
||||||
$data
|
array(
|
||||||
|
'status' => 400,
|
||||||
|
'data' => $data,
|
||||||
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -228,7 +261,10 @@ class Webfinger {
|
|||||||
return new WP_Error(
|
return new WP_Error(
|
||||||
'webfinger_missing_remote_follow_endpoint',
|
'webfinger_missing_remote_follow_endpoint',
|
||||||
__( 'No valid Remote-Follow endpoint found.', 'activitypub' ),
|
__( 'No valid Remote-Follow endpoint found.', 'activitypub' ),
|
||||||
$data
|
array(
|
||||||
|
'status' => 400,
|
||||||
|
'data' => $data,
|
||||||
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -54,10 +54,12 @@ class Interactions {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$url = object_to_uri( $meta['url'] );
|
||||||
|
|
||||||
$commentdata = array(
|
$commentdata = array(
|
||||||
'comment_post_ID' => $comment_post_id,
|
'comment_post_ID' => $comment_post_id,
|
||||||
'comment_author' => isset( $meta['name'] ) ? \esc_attr( $meta['name'] ) : \esc_attr( $meta['preferredUsername'] ),
|
'comment_author' => isset( $meta['name'] ) ? \esc_attr( $meta['name'] ) : \esc_attr( $meta['preferredUsername'] ),
|
||||||
'comment_author_url' => \esc_url_raw( $meta['url'] ),
|
'comment_author_url' => \esc_url_raw( $url ),
|
||||||
'comment_content' => \addslashes( $activity['object']['content'] ),
|
'comment_content' => \addslashes( $activity['object']['content'] ),
|
||||||
'comment_type' => 'comment',
|
'comment_type' => 'comment',
|
||||||
'comment_author_email' => '',
|
'comment_author_email' => '',
|
||||||
@ -73,7 +75,7 @@ class Interactions {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ( isset( $activity['object']['url'] ) ) {
|
if ( isset( $activity['object']['url'] ) ) {
|
||||||
$commentdata['comment_meta']['source_url'] = \esc_url_raw( $activity['object']['url'] );
|
$commentdata['comment_meta']['source_url'] = \esc_url_raw( object_to_uri( $activity['object']['url'] ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
// disable flood control
|
// disable flood control
|
||||||
@ -198,7 +200,7 @@ class Interactions {
|
|||||||
|
|
||||||
// get URL, because $actor seems to be the ID
|
// get URL, because $actor seems to be the ID
|
||||||
if ( $meta && ! is_wp_error( $meta ) && isset( $meta['url'] ) ) {
|
if ( $meta && ! is_wp_error( $meta ) && isset( $meta['url'] ) ) {
|
||||||
$actor = $meta['url'];
|
$actor = object_to_uri( $meta['url'] );
|
||||||
}
|
}
|
||||||
|
|
||||||
$args = array(
|
$args = array(
|
||||||
|
@ -8,6 +8,8 @@ use Activitypub\Model\Blog;
|
|||||||
use Activitypub\Model\Application;
|
use Activitypub\Model\Application;
|
||||||
|
|
||||||
use function Activitypub\object_to_uri;
|
use function Activitypub\object_to_uri;
|
||||||
|
use function Activitypub\normalize_url;
|
||||||
|
use function Activitypub\normalize_host;
|
||||||
use function Activitypub\url_to_authorid;
|
use function Activitypub\url_to_authorid;
|
||||||
use function Activitypub\is_user_disabled;
|
use function Activitypub\is_user_disabled;
|
||||||
|
|
||||||
@ -80,12 +82,13 @@ class Users {
|
|||||||
|
|
||||||
// check for application user.
|
// check for application user.
|
||||||
if ( 'application' === $username ) {
|
if ( 'application' === $username ) {
|
||||||
return self::get_by_id( self::APPLICATION_USER_ID );
|
return new Application();
|
||||||
}
|
}
|
||||||
|
|
||||||
// check for 'activitypub_username' meta
|
// check for 'activitypub_username' meta
|
||||||
$user = new WP_User_Query(
|
$user = new WP_User_Query(
|
||||||
array(
|
array(
|
||||||
|
'count_total' => false,
|
||||||
'number' => 1,
|
'number' => 1,
|
||||||
'hide_empty' => true,
|
'hide_empty' => true,
|
||||||
'fields' => 'ID',
|
'fields' => 'ID',
|
||||||
@ -110,6 +113,7 @@ class Users {
|
|||||||
// check for login or nicename.
|
// check for login or nicename.
|
||||||
$user = new WP_User_Query(
|
$user = new WP_User_Query(
|
||||||
array(
|
array(
|
||||||
|
'count_total' => false,
|
||||||
'search' => $username,
|
'search' => $username,
|
||||||
'search_columns' => array( 'user_login', 'user_nicename' ),
|
'search_columns' => array( 'user_login', 'user_nicename' ),
|
||||||
'number' => 1,
|
'number' => 1,
|
||||||
@ -180,8 +184,8 @@ class Users {
|
|||||||
|
|
||||||
// check for http(s)://blog.example.com/
|
// check for http(s)://blog.example.com/
|
||||||
if (
|
if (
|
||||||
self::normalize_url( site_url() ) === self::normalize_url( $resource ) ||
|
normalize_url( site_url() ) === normalize_url( $resource ) ||
|
||||||
self::normalize_url( home_url() ) === self::normalize_url( $resource )
|
normalize_url( home_url() ) === normalize_url( $resource )
|
||||||
) {
|
) {
|
||||||
return self::get_by_id( self::BLOG_USER_ID );
|
return self::get_by_id( self::BLOG_USER_ID );
|
||||||
}
|
}
|
||||||
@ -195,8 +199,8 @@ class Users {
|
|||||||
case 'acct':
|
case 'acct':
|
||||||
$resource = \str_replace( 'acct:', '', $resource );
|
$resource = \str_replace( 'acct:', '', $resource );
|
||||||
$identifier = \substr( $resource, 0, \strrpos( $resource, '@' ) );
|
$identifier = \substr( $resource, 0, \strrpos( $resource, '@' ) );
|
||||||
$host = self::normalize_host( \substr( \strrchr( $resource, '@' ), 1 ) );
|
$host = normalize_host( \substr( \strrchr( $resource, '@' ), 1 ) );
|
||||||
$blog_host = self::normalize_host( \wp_parse_url( \home_url( '/' ), \PHP_URL_HOST ) );
|
$blog_host = normalize_host( \wp_parse_url( \home_url( '/' ), \PHP_URL_HOST ) );
|
||||||
|
|
||||||
if ( $blog_host !== $host ) {
|
if ( $blog_host !== $host ) {
|
||||||
return new WP_Error(
|
return new WP_Error(
|
||||||
@ -251,33 +255,6 @@ class Users {
|
|||||||
return self::get_by_username( $id );
|
return self::get_by_username( $id );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Normalize a host.
|
|
||||||
*
|
|
||||||
* @param string $host The host.
|
|
||||||
*
|
|
||||||
* @return string The normalized host.
|
|
||||||
*/
|
|
||||||
public static function normalize_host( $host ) {
|
|
||||||
return \str_replace( 'www.', '', $host );
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Normalize a URL.
|
|
||||||
*
|
|
||||||
* @param string $url The URL.
|
|
||||||
*
|
|
||||||
* @return string The normalized URL.
|
|
||||||
*/
|
|
||||||
public static function normalize_url( $url ) {
|
|
||||||
$url = \untrailingslashit( $url );
|
|
||||||
$url = \str_replace( 'https://', '', $url );
|
|
||||||
$url = \str_replace( 'http://', '', $url );
|
|
||||||
$url = \str_replace( 'www.', '', $url );
|
|
||||||
|
|
||||||
return $url;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the User collection.
|
* Get the User collection.
|
||||||
*
|
*
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
namespace Activitypub;
|
namespace Activitypub;
|
||||||
|
|
||||||
|
use WP_Query;
|
||||||
use WP_Error;
|
use WP_Error;
|
||||||
use Activitypub\Http;
|
use Activitypub\Http;
|
||||||
use Activitypub\Comment;
|
use Activitypub\Comment;
|
||||||
@ -794,6 +795,7 @@ function is_local_comment( $comment ) {
|
|||||||
* Mark a WordPress object as federated.
|
* Mark a WordPress object as federated.
|
||||||
*
|
*
|
||||||
* @param WP_Comment|WP_Post|mixed $wp_object
|
* @param WP_Comment|WP_Post|mixed $wp_object
|
||||||
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
function set_wp_object_state( $wp_object, $state ) {
|
function set_wp_object_state( $wp_object, $state ) {
|
||||||
@ -808,6 +810,25 @@ function set_wp_object_state( $wp_object, $state ) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the federation state of a WordPress object.
|
||||||
|
*
|
||||||
|
* @param WP_Comment|WP_Post|mixed $wp_object
|
||||||
|
*
|
||||||
|
* @return string|false The state of the object or false if not found.
|
||||||
|
*/
|
||||||
|
function get_wp_object_state( $wp_object ) {
|
||||||
|
$meta_key = 'activitypub_status';
|
||||||
|
|
||||||
|
if ( $wp_object instanceof \WP_Post ) {
|
||||||
|
return \get_post_meta( $wp_object->ID, $meta_key, true );
|
||||||
|
} elseif ( $wp_object instanceof \WP_Comment ) {
|
||||||
|
return \get_comment_meta( $wp_object->comment_ID, $meta_key, true );
|
||||||
|
} else {
|
||||||
|
return \apply_filters( 'activitypub_get_wp_object_state', false, $wp_object );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the description of a post type.
|
* Get the description of a post type.
|
||||||
*
|
*
|
||||||
@ -969,3 +990,56 @@ function custom_large_numbers( $formatted, $number, $decimals ) {
|
|||||||
// Default fallback. We should not get here.
|
// Default fallback. We should not get here.
|
||||||
return $formatted;
|
return $formatted;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Normalize a URL.
|
||||||
|
*
|
||||||
|
* @param string $url The URL.
|
||||||
|
*
|
||||||
|
* @return string The normalized URL.
|
||||||
|
*/
|
||||||
|
function normalize_url( $url ) {
|
||||||
|
$url = \untrailingslashit( $url );
|
||||||
|
$url = \str_replace( 'https://', '', $url );
|
||||||
|
$url = \str_replace( 'http://', '', $url );
|
||||||
|
$url = \str_replace( 'www.', '', $url );
|
||||||
|
|
||||||
|
return $url;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Normalize a host.
|
||||||
|
*
|
||||||
|
* @param string $host The host.
|
||||||
|
*
|
||||||
|
* @return string The normalized host.
|
||||||
|
*/
|
||||||
|
function normalize_host( $host ) {
|
||||||
|
return \str_replace( 'www.', '', $host );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the Extra Fields of an Actor
|
||||||
|
*
|
||||||
|
* @param int $user_id The User-ID.
|
||||||
|
*
|
||||||
|
* @return array The extra fields.
|
||||||
|
*/
|
||||||
|
function get_actor_extra_fields( $user_id ) {
|
||||||
|
$extra_fields = new WP_Query(
|
||||||
|
array(
|
||||||
|
'post_type' => 'ap_extrafield',
|
||||||
|
'nopaging' => true,
|
||||||
|
'status' => 'publish',
|
||||||
|
'author' => $user_id,
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
if ( $extra_fields->have_posts() ) {
|
||||||
|
$extra_fields = $extra_fields->posts;
|
||||||
|
} else {
|
||||||
|
$extra_fields = array();
|
||||||
|
}
|
||||||
|
|
||||||
|
return apply_filters( 'activitypub_get_actor_extra_fields', $extra_fields, $user_id );
|
||||||
|
}
|
||||||
|
@ -61,7 +61,7 @@ class Create {
|
|||||||
$state = Interactions::add_comment( $array );
|
$state = Interactions::add_comment( $array );
|
||||||
$reaction = null;
|
$reaction = null;
|
||||||
|
|
||||||
if ( $state && ! \is_wp_error( $reaction ) ) {
|
if ( $state && ! \is_wp_error( $state ) ) {
|
||||||
$reaction = \get_comment( $state );
|
$reaction = \get_comment( $state );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -197,4 +197,8 @@ class Application extends Actor {
|
|||||||
)
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function get_canonical_url() {
|
||||||
|
return \home_url();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -230,7 +230,7 @@ class Blog extends Actor {
|
|||||||
*
|
*
|
||||||
* @return array|null The User-Header-Image.
|
* @return array|null The User-Header-Image.
|
||||||
*/
|
*/
|
||||||
public function get_header_image() {
|
public function get_image() {
|
||||||
if ( \has_header_image() ) {
|
if ( \has_header_image() ) {
|
||||||
return array(
|
return array(
|
||||||
'type' => 'Image',
|
'type' => 'Image',
|
||||||
@ -368,4 +368,38 @@ class Blog extends Actor {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Extend the User-Output with Attachments.
|
||||||
|
*
|
||||||
|
* @return array The extended User-Output.
|
||||||
|
*/
|
||||||
|
public function get_attachment() {
|
||||||
|
$array = array();
|
||||||
|
|
||||||
|
$array[] = array(
|
||||||
|
'type' => 'PropertyValue',
|
||||||
|
'name' => \__( 'Blog', 'activitypub' ),
|
||||||
|
'value' => \html_entity_decode(
|
||||||
|
sprintf(
|
||||||
|
'<a rel="me" title="%s" target="_blank" href="%s">%s</a>',
|
||||||
|
\esc_attr( \home_url( '/' ) ),
|
||||||
|
\esc_url( \home_url( '/' ) ),
|
||||||
|
\wp_parse_url( \home_url( '/' ), \PHP_URL_HOST )
|
||||||
|
),
|
||||||
|
\ENT_QUOTES,
|
||||||
|
'UTF-8'
|
||||||
|
),
|
||||||
|
);
|
||||||
|
|
||||||
|
// Add support for FEP-fb2a, for more information see FEDERATION.md
|
||||||
|
$array[] = array(
|
||||||
|
'type' => 'Link',
|
||||||
|
'name' => \__( 'Blog', 'activitypub' ),
|
||||||
|
'href' => \esc_url( \home_url( '/' ) ),
|
||||||
|
'rel' => array( 'me' ),
|
||||||
|
);
|
||||||
|
|
||||||
|
return $array;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -3,6 +3,7 @@ namespace Activitypub\Model;
|
|||||||
|
|
||||||
use WP_Query;
|
use WP_Query;
|
||||||
use WP_Error;
|
use WP_Error;
|
||||||
|
use Activitypub\Migration;
|
||||||
use Activitypub\Signature;
|
use Activitypub\Signature;
|
||||||
use Activitypub\Model\Blog;
|
use Activitypub\Model\Blog;
|
||||||
use Activitypub\Activity\Actor;
|
use Activitypub\Activity\Actor;
|
||||||
@ -10,6 +11,7 @@ use Activitypub\Collection\Users;
|
|||||||
|
|
||||||
use function Activitypub\is_user_disabled;
|
use function Activitypub\is_user_disabled;
|
||||||
use function Activitypub\get_rest_url_by_path;
|
use function Activitypub\get_rest_url_by_path;
|
||||||
|
use function Activitypub\get_actor_extra_fields;
|
||||||
|
|
||||||
class User extends Actor {
|
class User extends Actor {
|
||||||
/**
|
/**
|
||||||
@ -233,41 +235,74 @@ class User extends Actor {
|
|||||||
* @return array The extended User-Output.
|
* @return array The extended User-Output.
|
||||||
*/
|
*/
|
||||||
public function get_attachment() {
|
public function get_attachment() {
|
||||||
$array = array();
|
$extra_fields = get_actor_extra_fields( $this->_id );
|
||||||
|
|
||||||
$array[] = array(
|
$attachments = array();
|
||||||
|
|
||||||
|
foreach ( $extra_fields as $post ) {
|
||||||
|
$content = \get_the_content( null, false, $post );
|
||||||
|
$content = \make_clickable( $content );
|
||||||
|
$content = \do_blocks( $content );
|
||||||
|
$content = \wptexturize( $content );
|
||||||
|
$content = \wp_filter_content_tags( $content );
|
||||||
|
// replace script and style elements
|
||||||
|
$content = \preg_replace( '@<(script|style)[^>]*?>.*?</\\1>@si', '', $content );
|
||||||
|
$content = \strip_shortcodes( $content );
|
||||||
|
$content = \trim( \preg_replace( '/[\n\r\t]/', '', $content ) );
|
||||||
|
|
||||||
|
$attachments[] = array(
|
||||||
'type' => 'PropertyValue',
|
'type' => 'PropertyValue',
|
||||||
'name' => \__( 'Blog', 'activitypub' ),
|
'name' => \get_the_title( $post ),
|
||||||
'value' => \html_entity_decode(
|
'value' => \html_entity_decode(
|
||||||
'<a rel="me" title="' . \esc_attr( \home_url( '/' ) ) . '" target="_blank" href="' . \home_url( '/' ) . '">' . \wp_parse_url( \home_url( '/' ), \PHP_URL_HOST ) . '</a>',
|
$content,
|
||||||
\ENT_QUOTES,
|
\ENT_QUOTES,
|
||||||
'UTF-8'
|
'UTF-8'
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
|
||||||
$array[] = array(
|
$link_added = false;
|
||||||
'type' => 'PropertyValue',
|
|
||||||
'name' => \__( 'Profile', 'activitypub' ),
|
// Add support for FEP-fb2a, for more information see FEDERATION.md
|
||||||
'value' => \html_entity_decode(
|
if ( \class_exists( '\WP_HTML_Tag_Processor' ) ) {
|
||||||
'<a rel="me" title="' . \esc_attr( \get_author_posts_url( $this->get__id() ) ) . '" target="_blank" href="' . \get_author_posts_url( $this->get__id() ) . '">' . \wp_parse_url( \get_author_posts_url( $this->get__id() ), \PHP_URL_HOST ) . '</a>',
|
$tags = new \WP_HTML_Tag_Processor( $content );
|
||||||
\ENT_QUOTES,
|
$tags->next_tag();
|
||||||
'UTF-8'
|
|
||||||
),
|
if ( 'P' === $tags->get_tag() ) {
|
||||||
|
$tags->next_tag();
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( 'A' === $tags->get_tag() ) {
|
||||||
|
$tags->set_bookmark( 'link' );
|
||||||
|
if ( ! $tags->next_tag() ) {
|
||||||
|
$tags->seek( 'link' );
|
||||||
|
$attachment = array(
|
||||||
|
'type' => 'Link',
|
||||||
|
'name' => \get_the_title( $post ),
|
||||||
|
'href' => \esc_url( $tags->get_attribute( 'href' ) ),
|
||||||
|
'rel' => explode( ' ', $tags->get_attribute( 'rel' ) ),
|
||||||
);
|
);
|
||||||
|
|
||||||
if ( \get_the_author_meta( 'user_url', $this->get__id() ) ) {
|
$link_added = true;
|
||||||
$array[] = array(
|
}
|
||||||
'type' => 'PropertyValue',
|
}
|
||||||
'name' => \__( 'Website', 'activitypub' ),
|
}
|
||||||
'value' => \html_entity_decode(
|
|
||||||
'<a rel="me" title="' . \esc_attr( \get_the_author_meta( 'user_url', $this->get__id() ) ) . '" target="_blank" href="' . \get_the_author_meta( 'user_url', $this->get__id() ) . '">' . \wp_parse_url( \get_the_author_meta( 'user_url', $this->get__id() ), \PHP_URL_HOST ) . '</a>',
|
if ( ! $link_added ) {
|
||||||
|
$attachment = array(
|
||||||
|
'type' => 'Note',
|
||||||
|
'name' => \get_the_title( $post ),
|
||||||
|
'content' => \html_entity_decode(
|
||||||
|
$content,
|
||||||
\ENT_QUOTES,
|
\ENT_QUOTES,
|
||||||
'UTF-8'
|
'UTF-8'
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $array;
|
$attachments[] = $attachment;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $attachments;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -123,7 +123,7 @@ class Actors {
|
|||||||
$url = str_replace( '{uri}', $resource, $template );
|
$url = str_replace( '{uri}', $resource, $template );
|
||||||
|
|
||||||
return new WP_REST_Response(
|
return new WP_REST_Response(
|
||||||
array( 'url' => $url ),
|
array( 'url' => $url, 'template' => $template ),
|
||||||
200
|
200
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -29,7 +29,7 @@ class Comment {
|
|||||||
public static function register_routes() {
|
public static function register_routes() {
|
||||||
\register_rest_route(
|
\register_rest_route(
|
||||||
ACTIVITYPUB_REST_NAMESPACE,
|
ACTIVITYPUB_REST_NAMESPACE,
|
||||||
'/(users|actors)/(?P<comment_id>\d+)/remote-reply',
|
'/comments/(?P<comment_id>\d+)/remote-reply',
|
||||||
array(
|
array(
|
||||||
array(
|
array(
|
||||||
'methods' => WP_REST_Server::READABLE,
|
'methods' => WP_REST_Server::READABLE,
|
||||||
@ -88,7 +88,7 @@ class Comment {
|
|||||||
$url = str_replace( '{uri}', $resource, $template );
|
$url = str_replace( '{uri}', $resource, $template );
|
||||||
|
|
||||||
return new WP_REST_Response(
|
return new WP_REST_Response(
|
||||||
array( 'url' => $url ),
|
array( 'url' => $url, 'template' => $template ),
|
||||||
200
|
200
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -55,10 +55,28 @@ class Webfinger {
|
|||||||
*/
|
*/
|
||||||
\do_action( 'activitypub_rest_webfinger_pre' );
|
\do_action( 'activitypub_rest_webfinger_pre' );
|
||||||
|
|
||||||
|
$code = 200;
|
||||||
|
|
||||||
$resource = $request->get_param( 'resource' );
|
$resource = $request->get_param( 'resource' );
|
||||||
$response = self::get_profile( $resource );
|
$response = self::get_profile( $resource );
|
||||||
|
|
||||||
return new WP_REST_Response( $response, 200 );
|
if ( \is_wp_error( $response ) ) {
|
||||||
|
$code = 400;
|
||||||
|
$error_data = $response->get_error_data();
|
||||||
|
|
||||||
|
if ( isset( $error_data['status'] ) ) {
|
||||||
|
$code = $error_data['status'];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return new WP_REST_Response(
|
||||||
|
$response,
|
||||||
|
$code,
|
||||||
|
array(
|
||||||
|
'Access-Control-Allow-Origin' => '*',
|
||||||
|
'Content-Type' => 'application/jrd+json; charset=' . get_option( 'blog_charset' ),
|
||||||
|
)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -88,7 +106,7 @@ class Webfinger {
|
|||||||
public static function get_profile( $resource ) {
|
public static function get_profile( $resource ) {
|
||||||
$user = User_Collection::get_by_resource( $resource );
|
$user = User_Collection::get_by_resource( $resource );
|
||||||
|
|
||||||
if ( is_wp_error( $user ) ) {
|
if ( \is_wp_error( $user ) ) {
|
||||||
return $user;
|
return $user;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -101,6 +101,9 @@ class Post extends Base {
|
|||||||
|
|
||||||
if ( 'trash' === get_post_status( $post ) ) {
|
if ( 'trash' === get_post_status( $post ) ) {
|
||||||
$permalink = \get_post_meta( $post->ID, 'activitypub_canonical_url', true );
|
$permalink = \get_post_meta( $post->ID, 'activitypub_canonical_url', true );
|
||||||
|
} elseif ( 'draft' === get_post_status( $post ) && get_sample_permalink( $post->ID ) ) {
|
||||||
|
$sample = get_sample_permalink( $post->ID );
|
||||||
|
$permalink = str_replace( array( '%pagename%', '%postname%' ), $sample[1], $sample[0] );
|
||||||
} else {
|
} else {
|
||||||
$permalink = \get_permalink( $post );
|
$permalink = \get_permalink( $post );
|
||||||
}
|
}
|
||||||
@ -137,6 +140,11 @@ class Post extends Base {
|
|||||||
* @return array The Attachments.
|
* @return array The Attachments.
|
||||||
*/
|
*/
|
||||||
protected function get_attachment() {
|
protected function get_attachment() {
|
||||||
|
// Remove attachments from drafts.
|
||||||
|
if ( 'draft' === \get_post_status( $this->wp_object ) ) {
|
||||||
|
return array();
|
||||||
|
}
|
||||||
|
|
||||||
// Once upon a time we only supported images, but we now support audio/video as well.
|
// Once upon a time we only supported images, but we now support audio/video as well.
|
||||||
// We maintain the image-centric naming for backwards compatibility.
|
// We maintain the image-centric naming for backwards compatibility.
|
||||||
$max_media = \intval(
|
$max_media = \intval(
|
||||||
@ -692,6 +700,11 @@ class Post extends Base {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Remove Teaser from drafts.
|
||||||
|
if ( 'draft' === \get_post_status( $this->wp_object ) ) {
|
||||||
|
return \__( '(This post is being modified)', 'activitypub' );
|
||||||
|
}
|
||||||
|
|
||||||
$content = \get_post_field( 'post_content', $this->wp_object->ID );
|
$content = \get_post_field( 'post_content', $this->wp_object->ID );
|
||||||
$content = \html_entity_decode( $content );
|
$content = \html_entity_decode( $content );
|
||||||
$content = \wp_strip_all_tags( $content );
|
$content = \wp_strip_all_tags( $content );
|
||||||
@ -746,6 +759,11 @@ class Post extends Base {
|
|||||||
* @return string The content.
|
* @return string The content.
|
||||||
*/
|
*/
|
||||||
protected function get_content() {
|
protected function get_content() {
|
||||||
|
// Remove Content from drafts.
|
||||||
|
if ( 'draft' === \get_post_status( $this->wp_object ) ) {
|
||||||
|
return \__( '(This post is being modified)', 'activitypub' );
|
||||||
|
}
|
||||||
|
|
||||||
global $post;
|
global $post;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -32,7 +32,12 @@ class Buddypress {
|
|||||||
'type' => 'PropertyValue',
|
'type' => 'PropertyValue',
|
||||||
'name' => \__( 'Profile', 'activitypub' ),
|
'name' => \__( 'Profile', 'activitypub' ),
|
||||||
'value' => \html_entity_decode(
|
'value' => \html_entity_decode(
|
||||||
'<a rel="me" title="' . \esc_attr( bp_core_get_user_domain( $author_id ) ) . '" target="_blank" href="' . \bp_core_get_user_domain( $author_id ) . '">' . \wp_parse_url( \bp_core_get_user_domain( $author_id ), \PHP_URL_HOST ) . '</a>',
|
sprintf(
|
||||||
|
'<a rel="me" title="%s" target="_blank" href="%s">%s</a>',
|
||||||
|
\esc_attr( bp_core_get_user_domain( $author_id ) ),
|
||||||
|
\bp_core_get_user_domain( $author_id ),
|
||||||
|
\wp_parse_url( \bp_core_get_user_domain( $author_id ), \PHP_URL_HOST )
|
||||||
|
),
|
||||||
\ENT_QUOTES,
|
\ENT_QUOTES,
|
||||||
'UTF-8'
|
'UTF-8'
|
||||||
),
|
),
|
||||||
@ -51,7 +56,12 @@ class Buddypress {
|
|||||||
'type' => 'PropertyValue',
|
'type' => 'PropertyValue',
|
||||||
'name' => $blog->blogname,
|
'name' => $blog->blogname,
|
||||||
'value' => \html_entity_decode(
|
'value' => \html_entity_decode(
|
||||||
'<a rel="me" title="' . \esc_attr( $blog->siteurl ) . '" target="_blank" href="' . $blog->siteurl . '">' . \wp_parse_url( $blog->siteurl, \PHP_URL_HOST ) . '</a>',
|
sprintf(
|
||||||
|
'<a rel="me" title="%s" target="_blank" href="%s">%s</a>',
|
||||||
|
\esc_attr( $blog->siteurl ),
|
||||||
|
$blog->siteurl,
|
||||||
|
\wp_parse_url( $blog->siteurl, \PHP_URL_HOST )
|
||||||
|
),
|
||||||
\ENT_QUOTES,
|
\ENT_QUOTES,
|
||||||
'UTF-8'
|
'UTF-8'
|
||||||
),
|
),
|
||||||
|
@ -150,6 +150,12 @@ class Enable_Mastodon_Apps {
|
|||||||
return $user_data;
|
return $user_data;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$user = Users::get_by_various( $user_id );
|
||||||
|
|
||||||
|
if ( $user && ! is_wp_error( $user ) ) {
|
||||||
|
return $user_data;
|
||||||
|
}
|
||||||
|
|
||||||
$uri = Webfinger_Util::resolve( $user_id );
|
$uri = Webfinger_Util::resolve( $user_id );
|
||||||
|
|
||||||
if ( ! $uri || is_wp_error( $uri ) ) {
|
if ( ! $uri || is_wp_error( $uri ) ) {
|
||||||
|
107
wp-content/plugins/activitypub/integration/class-opengraph.php
Normal file
107
wp-content/plugins/activitypub/integration/class-opengraph.php
Normal file
@ -0,0 +1,107 @@
|
|||||||
|
<?php
|
||||||
|
namespace Activitypub\Integration;
|
||||||
|
|
||||||
|
use Activitypub\Model\Blog;
|
||||||
|
use Activitypub\Collection\Users;
|
||||||
|
|
||||||
|
use function Activitypub\is_single_user;
|
||||||
|
use function Activitypub\is_user_type_disabled;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Compatibility with the OpenGraph plugin
|
||||||
|
*
|
||||||
|
* @see https://wordpress.org/plugins/opengraph/
|
||||||
|
* @see https://codeberg.org/fediverse/fep/src/branch/main/fep/XXXX/fep-XXXX.md
|
||||||
|
* @see https://github.com/mastodon/mastodon/pull/30398
|
||||||
|
*/
|
||||||
|
class Opengraph {
|
||||||
|
/**
|
||||||
|
* Initialize the class, registering WordPress hooks
|
||||||
|
*/
|
||||||
|
public static function init() {
|
||||||
|
if ( ! function_exists( 'opengraph_metadata' ) ) {
|
||||||
|
\add_action( 'wp_head', array( self::class, 'add_meta_tags' ) );
|
||||||
|
}
|
||||||
|
|
||||||
|
\add_filter( 'opengraph_metadata', array( self::class, 'add_metadata' ) );
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add the ActivityPub prefix to the OpenGraph prefixes.
|
||||||
|
*
|
||||||
|
* @param array $prefixes the current prefixes.
|
||||||
|
*
|
||||||
|
* @return array the updated prefixes.
|
||||||
|
*/
|
||||||
|
public static function add_prefixes( $prefixes ) {
|
||||||
|
// @todo discuss namespace
|
||||||
|
$prefixes['fediverse'] = 'https://codeberg.org/fediverse/fep/src/branch/main/fep/XXXX/fep-XXXX.md';
|
||||||
|
|
||||||
|
return $prefixes;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add the ActivityPub metadata to the OpenGraph metadata.
|
||||||
|
*
|
||||||
|
* @param array $metadata the current metadata.
|
||||||
|
*
|
||||||
|
* @return array the updated metadata.
|
||||||
|
*/
|
||||||
|
public static function add_metadata( $metadata ) {
|
||||||
|
// Always show Blog-User if the Blog is in single user mode
|
||||||
|
if ( is_single_user() ) {
|
||||||
|
$user = new Blog();
|
||||||
|
|
||||||
|
// add WebFinger resource
|
||||||
|
$metadata['fediverse:creator'] = $user->get_webfinger();
|
||||||
|
|
||||||
|
return $metadata;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( \is_author() ) {
|
||||||
|
// Use the Author of the Archive-Page
|
||||||
|
$user_id = \get_queried_object_id();
|
||||||
|
} elseif ( \is_singular() ) {
|
||||||
|
// Use the Author of the Post
|
||||||
|
$user_id = \get_post_field( 'post_author', \get_queried_object_id() );
|
||||||
|
} elseif ( ! is_user_type_disabled( 'blog' ) ) {
|
||||||
|
// Use the Blog-User for any other page, if the Blog-User is not disabled
|
||||||
|
$user_id = Users::BLOG_USER_ID;
|
||||||
|
} else {
|
||||||
|
// Do not add any metadata otherwise
|
||||||
|
return $metadata;
|
||||||
|
}
|
||||||
|
|
||||||
|
$user = Users::get_by_id( $user_id );
|
||||||
|
|
||||||
|
if ( ! $user || \is_wp_error( $user ) ) {
|
||||||
|
return $metadata;
|
||||||
|
}
|
||||||
|
|
||||||
|
// add WebFinger resource
|
||||||
|
$metadata['fediverse:creator'] = $user->get_webfinger();
|
||||||
|
|
||||||
|
return $metadata;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Output Open Graph <meta> tags in the page header.
|
||||||
|
*/
|
||||||
|
public static function add_meta_tags() {
|
||||||
|
$metadata = apply_filters( 'opengraph_metadata', array() );
|
||||||
|
foreach ( $metadata as $key => $value ) {
|
||||||
|
if ( empty( $key ) || empty( $value ) ) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
$value = (array) $value;
|
||||||
|
|
||||||
|
foreach ( $value as $v ) {
|
||||||
|
printf(
|
||||||
|
'<meta property="%1$s" name="%1$s" content="%2$s" />' . PHP_EOL,
|
||||||
|
esc_attr( $key ),
|
||||||
|
esc_attr( $v )
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -2,9 +2,9 @@
|
|||||||
Contributors: automattic, pfefferle, mediaformat, mattwiebe, akirk, jeherve, nuriapena, cavalierlife
|
Contributors: automattic, pfefferle, mediaformat, mattwiebe, akirk, jeherve, nuriapena, cavalierlife
|
||||||
Tags: OStatus, fediverse, activitypub, activitystream
|
Tags: OStatus, fediverse, activitypub, activitystream
|
||||||
Requires at least: 5.5
|
Requires at least: 5.5
|
||||||
Tested up to: 6.5
|
Tested up to: 6.6
|
||||||
Stable tag: 2.4.0
|
Stable tag: 2.6.1
|
||||||
Requires PHP: 5.6
|
Requires PHP: 7.0
|
||||||
License: MIT
|
License: MIT
|
||||||
License URI: http://opensource.org/licenses/MIT
|
License URI: http://opensource.org/licenses/MIT
|
||||||
|
|
||||||
@ -37,7 +37,7 @@ Some things to note:
|
|||||||
|
|
||||||
1. The blog-wide profile is only compatible with sites with rewrite rules enabled. If your site does not have rewrite rules enabled, the author-specific profiles may still work.
|
1. The blog-wide profile is only compatible with sites with rewrite rules enabled. If your site does not have rewrite rules enabled, the author-specific profiles may still work.
|
||||||
1. Many single-author blogs have chosen to turn off or redirect their author profile pages, usually via an SEO plugin like Yoast or Rank Math. This is usually done to avoid duplicate content with your blog’s home page. If your author page has been deactivated in this way, then ActivityPub author profiles won’t work for you. Instead, you can turn your author profile page back on, and then use the option in your SEO plugin to noindex the author page. This will still resolve duplicate content issues with search engines and will enable ActivityPub author profiles to work.
|
1. Many single-author blogs have chosen to turn off or redirect their author profile pages, usually via an SEO plugin like Yoast or Rank Math. This is usually done to avoid duplicate content with your blog’s home page. If your author page has been deactivated in this way, then ActivityPub author profiles won’t work for you. Instead, you can turn your author profile page back on, and then use the option in your SEO plugin to noindex the author page. This will still resolve duplicate content issues with search engines and will enable ActivityPub author profiles to work.
|
||||||
1. Once ActivityPub is installed, *only new posts going forward* will be available in the fediverse. Likewise, even if you’ve been using ActivityPub for a while, anyone who follows your site, will only see new posts you publish from that moment on. They will never see previously-published posts in their Home feed. This process is very similar to subscribing to a newsletter. If you subscribe to a newsletter, you will only receive future emails, but not the old archived ones. With ActivityPub, if someone follows your site, they will only receive new blog posts you publish from then on.
|
1. Once ActivityPub is installed, *only new posts going forward* will be available in the fediverse. Likewise, even if you’ve been using ActivityPub for a while, anyone who follows your site will only see new posts you publish from that moment on. They will never see previously-published posts in their Home feed. This process is very similar to subscribing to a newsletter. If you subscribe to a newsletter, you will only receive future emails, but not the old archived ones. With ActivityPub, if someone follows your site, they will only receive new blog posts you publish from then on.
|
||||||
|
|
||||||
So what’s the process?
|
So what’s the process?
|
||||||
|
|
||||||
@ -101,9 +101,9 @@ Add the following to the site.conf in sites-available:
|
|||||||
|
|
||||||
Where 'blog' is the path to the subdirectory at which your blog resides.
|
Where 'blog' is the path to the subdirectory at which your blog resides.
|
||||||
|
|
||||||
= What if you are running your blog in a subdirectory, but have a different [wp_siteurl](https://wordpress.org/documentation/article/giving-wordpress-its-own-directory/)? =
|
= What if you are running your blog in a subdirectory? =
|
||||||
|
|
||||||
In that case you don't need the redirect, because the index.php will take care of that.
|
If you are running your blog in a subdirectory, but have a different [wp_siteurl](https://wordpress.org/documentation/article/giving-wordpress-its-own-directory/), you don't need the redirect, because the index.php will take care of that.
|
||||||
|
|
||||||
= Constants =
|
= Constants =
|
||||||
|
|
||||||
@ -133,6 +133,33 @@ For reasons of data protection, it is not possible to see the followers of other
|
|||||||
|
|
||||||
== Changelog ==
|
== Changelog ==
|
||||||
|
|
||||||
|
= 2.6.1 =
|
||||||
|
|
||||||
|
* Fixed: Extra Fields will generate wrong entries
|
||||||
|
|
||||||
|
= 2.6.0 =
|
||||||
|
|
||||||
|
* Added: Support for FEP-fb2a
|
||||||
|
* Added: CRUD support for Extra Fields
|
||||||
|
* Improved: Remote-Follow UI and UX
|
||||||
|
* Improved: Open Graph `fediverse:creator` implementation
|
||||||
|
* Fixed: Compatibility issues with fed.brid.gy
|
||||||
|
* Fixed: Remote-Reply endpoint
|
||||||
|
* Fixed: WebFinger Error Codes (thanks to the FediTest project)
|
||||||
|
* Fixed: Fatal Error when wp_schedule_single_event third argument is being passed as a string
|
||||||
|
|
||||||
|
= 2.5.0 =
|
||||||
|
|
||||||
|
* Added: WebFinger cors header
|
||||||
|
* Added: WebFinger Content-Type
|
||||||
|
* Added: The Fediverse creator of a post to OpenGraph
|
||||||
|
* Improved: Try to lookup local users first for Enable Mastodon Apps
|
||||||
|
* Improved: Send also Announces for deletes
|
||||||
|
* Improved: Load time by adding `count_total=false` to `WP_User_Query`
|
||||||
|
* Fixed: Several WebFinger issues
|
||||||
|
* Fixed: Redirect issue for Application user
|
||||||
|
* Fixed: Accessibilty issues with missing screen-reader-text on User overview page
|
||||||
|
|
||||||
= 2.4.0 =
|
= 2.4.0 =
|
||||||
|
|
||||||
* Added: A core/embed block filter to transform iframes to links
|
* Added: A core/embed block filter to transform iframes to links
|
||||||
@ -159,36 +186,6 @@ For reasons of data protection, it is not possible to see the followers of other
|
|||||||
* Fixed: Prevent infinite loops in `get_comment_ancestors`
|
* Fixed: Prevent infinite loops in `get_comment_ancestors`
|
||||||
* Fixed: Better Content-Negotiation handling
|
* Fixed: Better Content-Negotiation handling
|
||||||
|
|
||||||
= 2.3.1 =
|
|
||||||
|
|
||||||
* Added: Enable Mastodon Apps: Add remote outbox fetching
|
|
||||||
* Added: Help texts
|
|
||||||
* Fixed: Compatibility issues with Discourse
|
|
||||||
* Fixed: Do not announce replies
|
|
||||||
* Fixed: Also delete interactions with deleted person
|
|
||||||
* Fixed: Check Author-URL only if user is enabled for ActivityPub
|
|
||||||
* Fixed: Generate comment IDs for federation from home_url
|
|
||||||
* Removed: Beta label from the #Hashtag settings
|
|
||||||
|
|
||||||
= 2.3.0 =
|
|
||||||
|
|
||||||
* Added: Mark links as "unhandled-link" and "status-link", for a better UX in the Mastodon App
|
|
||||||
* Added: Enable-Mastodon-Apps: Provide followers
|
|
||||||
* Added: Enable-Mastodon-Apps: Extend account with ActivityPub data
|
|
||||||
* Added: Enable-Mastodon-Apps: Search in followers
|
|
||||||
* Added: Add `alt` support for images (for Block and Classic-Editor)
|
|
||||||
* Fixed: Counter for system users outbox
|
|
||||||
* Fixed: Don't set a default actor type in the actor class
|
|
||||||
* Fixed: Outbox collection for blog and application user
|
|
||||||
* Changed: A better default content handling based on the Object Type
|
|
||||||
* Changed: Improve User management
|
|
||||||
* Changed: Federated replies: Improved UX for "your reply will federate"
|
|
||||||
* Changed: Comment reply federation: support `is_single_user` sites
|
|
||||||
* Changed: Mask WordPress version number
|
|
||||||
* Changed: Improve remote reply handling
|
|
||||||
* Changed: Remote Reply: limit enqueue to when needed
|
|
||||||
* Changed: Abstract shared Dialog code
|
|
||||||
|
|
||||||
See full Changelog on [GitHub](https://github.com/Automattic/wordpress-activitypub/blob/master/CHANGELOG.md).
|
See full Changelog on [GitHub](https://github.com/Automattic/wordpress-activitypub/blob/master/CHANGELOG.md).
|
||||||
|
|
||||||
== Upgrade Notice ==
|
== Upgrade Notice ==
|
||||||
|
@ -28,5 +28,40 @@ $user = \Activitypub\Collection\Users::get_by_id( \get_current_user_id() ); ?>
|
|||||||
</td>
|
</td>
|
||||||
<?php wp_nonce_field( 'activitypub-user-description', '_apnonce' ); ?>
|
<?php wp_nonce_field( 'activitypub-user-description', '_apnonce' ); ?>
|
||||||
</tr>
|
</tr>
|
||||||
|
<tr scope="row">
|
||||||
|
<th>
|
||||||
|
<label><?php \esc_html_e( 'Extra fields', 'activitypub' ); ?></label>
|
||||||
|
</th>
|
||||||
|
<td>
|
||||||
|
<p class="description"><?php \esc_html_e( 'Your homepage, social profiles, pronouns, age, anything you want.', 'activitypub' ); ?></p>
|
||||||
|
|
||||||
|
<table class="widefat striped activitypub-extra-fields" role="presentation" style="margin: 15px 0;">
|
||||||
|
<?php
|
||||||
|
$extra_fields = \Activitypub\get_actor_extra_fields( \get_current_user_id() );
|
||||||
|
|
||||||
|
foreach ( $extra_fields as $extra_field ) {
|
||||||
|
?>
|
||||||
|
<tr>
|
||||||
|
<td><?php echo \esc_html( $extra_field->post_title ); ?></td>
|
||||||
|
<td><?php echo \wp_kses_post( \get_the_excerpt( $extra_field ) ); ?></td>
|
||||||
|
<td>
|
||||||
|
<a href="<?php echo \esc_url( \get_edit_post_link( $extra_field->ID ) ); ?>" class="button">
|
||||||
|
<?php \esc_html_e( 'Edit', 'activitypub' ); ?>
|
||||||
|
</a>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<?php } ?>
|
||||||
|
</table>
|
||||||
|
|
||||||
|
<p>
|
||||||
|
<a href="<?php echo esc_url( admin_url( '/post-new.php?post_type=ap_extrafield' ) ); ?>" class="button">
|
||||||
|
<?php esc_html_e( 'Add new', 'activitypub' ); ?>
|
||||||
|
</a>
|
||||||
|
<a href="<?php echo esc_url( admin_url( '/edit.php?post_type=ap_extrafield' ) ); ?>">
|
||||||
|
<?php esc_html_e( 'Manage all', 'activitypub' ); ?>
|
||||||
|
</a>
|
||||||
|
</p>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
|
Loading…
Reference in New Issue
Block a user