updated plugin ActivityPub version 9.1.0
This commit is contained in:
@ -1,2 +1,2 @@
|
||||
(()=>{"use strict";var e,t={6755(e,t,i){const r=window.wp.blocks,s=window.wp.i18n,n=window.wp.blockEditor,l=window.wp.components,a=window.wp.dom,o=window.wp.data,c=window.wp.element,d=window.wp.apiFetch;var u=i.n(d);function p(){return window._activityPubOptions||{}}const h=window.ReactJSXRuntime,b=JSON.parse('{"UU":"activitypub/extra-fields"}');(0,r.registerBlockType)(b.UU,{edit:function({attributes:e,setAttributes:t,context:i}){const{selectedUser:r,maxFields:d}=e,{postId:b,postType:v}=i??{},[y,f]=(0,c.useState)([]),[x,g]=(0,c.useState)(!1),[w,m]=(0,c.useState)(null),_=(0,o.useSelect)(e=>{if(b&&v){const t=e("core");if(t){const e=t.getEditedEntityRecord?.("postType",v,b)??null;if(e?.author)return e.author;const i=t.getEntityRecord?.("postType",v,b)??null;if(i?.author)return i.author}}const t=e("core/editor");return t&&t.getCurrentPostAttribute?t.getCurrentPostAttribute("author"):null},[b,v]),j="blog"===r?0:"inherit"===r?_||null:r,{namespace:k="activitypub/1.0",profileUrls:U={}}=p(),F="blog"===r?U.blog:U.user,C=(0,n.useBlockProps)({className:"activitypub-extra-fields-block-wrapper"}),O=function({withInherit:e=!1}){const{enabled:t,namespace:i}=p(),[r,n]=(0,c.useState)(!1),{fetchedUsers:l,isLoadingUsers:a}=(0,o.useSelect)(e=>{const{getUsers:i,getIsResolving:r}=e("core");return{fetchedUsers:t?.users?i({capabilities:"activitypub"}):null,isLoadingUsers:!!t?.users&&r("getUsers",[{capabilities:"activitypub"}])}},[t?.users]),d=(0,o.useSelect)(e=>l||a?null:e("core").getCurrentUser(),[l,a]);(0,c.useEffect)(()=>{!l&&!a&&d&&i&&u()({path:`/${i}/actors/${d.id}`,method:"HEAD",headers:{Accept:"application/activity+json"},parse:!1}).then(()=>n(!0)).catch(()=>n(!1))},[l,a,d,i]);const h=(0,c.useMemo)(()=>l||(d&&r?[{id:d.id,name:d.name}]:[]),[l,d,r]);return(0,c.useMemo)(()=>{if(!h.length)return[];const i=[];return t?.blog&&l&&i.push({label:(0,s.__)("Blog","activitypub"),value:"blog"}),e&&t?.users&&l&&i.push({label:(0,s.__)("Dynamic User","activitypub"),value:"inherit"}),h.reduce((e,t)=>(e.push({label:t.name,value:`${t.id}`}),e),i)},[h,t?.blog,t?.users,l,e])}({withInherit:!0});(0,c.useEffect)(()=>{null!==j?(g(!0),m(null),u()({path:`/${k}/actors/${j}`,headers:{Accept:"application/activity+json"}}).then(e=>{const t=(e.attachment||[]).filter(e=>"PropertyValue"===e.type);f(t),g(!1)}).catch(e=>{m(e.message),g(!1)})):f([])},[j,k]);const E=d>0?y.slice(0,d):y,S=(()=>{const t=e.className?.includes("is-style-cards");if(!t)return{};const i=e.style||{},r=e.backgroundColor,s=i.color?.background;return r?{backgroundColor:`var(--wp--preset--color--${r})`}:s?{backgroundColor:s}:{}})(),P=(0,h.jsx)(n.InspectorControls,{children:(0,h.jsxs)(l.PanelBody,{title:(0,s.__)("Settings","activitypub"),initialOpen:!0,children:[(0,h.jsx)(l.SelectControl,{label:(0,s.__)("User","activitypub"),value:r,options:O,onChange:e=>t({selectedUser:e})}),(0,h.jsx)(l.RangeControl,{label:(0,s.__)("Maximum Fields","activitypub"),value:d,onChange:e=>t({maxFields:e}),min:0,max:20,help:(0,s.__)("Limit the number of fields displayed. 0 = show all.","activitypub")})]})});return"inherit"!==r||_?x?(0,h.jsx)("div",{...C,children:(0,h.jsx)(l.Placeholder,{label:(0,s.__)("Fediverse Extra Fields","activitypub"),children:(0,h.jsx)(l.Spinner,{})})}):w?(0,h.jsx)("div",{...C,children:(0,h.jsx)(l.Placeholder,{label:(0,s.__)("Fediverse Extra Fields","activitypub"),children:(0,h.jsx)("p",{children:(0,s.sprintf)(/* translators: %s: Error message */ /* translators: %s: Error message */
|
||||
(0,s.__)("Error loading extra fields: %s","activitypub"),w)})})}):0===E.length?(0,h.jsxs)(h.Fragment,{children:[P,(0,h.jsx)("div",{...C,children:(0,h.jsx)(l.Placeholder,{label:(0,s.__)("Fediverse Extra Fields","activitypub"),children:(0,h.jsxs)("p",{children:[(0,s.__)("No extra fields found.","activitypub")," ",F&&(0,h.jsx)(l.Button,{variant:"link",onClick:()=>{window.location.href=F},children:(0,s.__)("Add fields in your profile settings","activitypub")})]})})})]}):(0,h.jsxs)(h.Fragment,{children:[P,(0,h.jsx)("div",{...C,children:(0,h.jsx)("dl",{className:"activitypub-extra-fields",children:E.map(e=>(0,h.jsxs)("div",{className:"activitypub-extra-field",style:S,children:[(0,h.jsx)("dt",{children:e.name}),(0,h.jsx)("dd",{dangerouslySetInnerHTML:{__html:(0,a.safeHTML)(e.value)}})]},`${e.name}-${e.value}`))})})]}):(0,h.jsxs)(h.Fragment,{children:[P,(0,h.jsx)("div",{...C,children:(0,h.jsx)(l.Placeholder,{label:(0,s.__)("Fediverse Extra Fields","activitypub"),children:(0,h.jsx)("p",{children:(0,s.__)("This block will display extra fields based on the post author when published.","activitypub")})})})]})},save:()=>null})}},i={};function r(e){var s=i[e];if(void 0!==s)return s.exports;var n=i[e]={exports:{}};return t[e](n,n.exports,r),n.exports}r.m=t,e=[],r.O=(t,i,s,n)=>{if(!i){var l=1/0;for(d=0;d<e.length;d++){for(var[i,s,n]=e[d],a=!0,o=0;o<i.length;o++)(!1&n||l>=n)&&Object.keys(r.O).every(e=>r.O[e](i[o]))?i.splice(o--,1):(a=!1,n<l&&(l=n));if(a){e.splice(d--,1);var c=s();void 0!==c&&(t=c)}}return t}n=n||0;for(var d=e.length;d>0&&e[d-1][2]>n;d--)e[d]=e[d-1];e[d]=[i,s,n]},r.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return r.d(t,{a:t}),t},r.d=(e,t)=>{for(var i in t)r.o(t,i)&&!r.o(e,i)&&Object.defineProperty(e,i,{enumerable:!0,get:t[i]})},r.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),(()=>{var e={914:0,678:0};r.O.j=t=>0===e[t];var t=(t,i)=>{var s,n,[l,a,o]=i,c=0;if(l.some(t=>0!==e[t])){for(s in a)r.o(a,s)&&(r.m[s]=a[s]);if(o)var d=o(r)}for(t&&t(i);c<l.length;c++)n=l[c],r.o(e,n)&&e[n]&&e[n][0](),e[n]=0;return r.O(d)},i=globalThis.webpackChunkwordpress_activitypub=globalThis.webpackChunkwordpress_activitypub||[];i.forEach(t.bind(null,0)),i.push=t.bind(null,i.push.bind(i))})();var s=r.O(void 0,[678],()=>r(6755));s=r.O(s)})();
|
||||
(()=>{"use strict";var e={755(e,t,i){const r=window.wp.blocks,s=window.wp.i18n,n=window.wp.blockEditor,l=window.wp.components,a=window.wp.dom,o=window.wp.data,c=window.wp.element,d=window.wp.apiFetch;var u=i.n(d);function p(){return window._activityPubOptions||{}}const h=window.ReactJSXRuntime,b=JSON.parse('{"UU":"activitypub/extra-fields"}');(0,r.registerBlockType)(b.UU,{edit:function({attributes:e,setAttributes:t,context:i}){const{selectedUser:r,maxFields:d}=e,{postId:b,postType:v}=i??{},[f,y]=(0,c.useState)([]),[x,g]=(0,c.useState)(!1),[m,w]=(0,c.useState)(null),_=(0,o.useSelect)(e=>{if(b&&v){const t=e("core");if(t){const e=t.getEditedEntityRecord?.("postType",v,b)??null;if(e?.author)return e.author;const i=t.getEntityRecord?.("postType",v,b)??null;if(i?.author)return i.author}}const t=e("core/editor");return t&&t.getCurrentPostAttribute?t.getCurrentPostAttribute("author"):null},[b,v]),j="blog"===r?0:"inherit"===r?_||null:r,{namespace:O="activitypub/1.0",profileUrls:U={}}=p(),k="blog"===r?U.blog:U.user,F=(0,n.useBlockProps)({className:"activitypub-extra-fields-block-wrapper"}),C=function({withInherit:e=!1}){const{enabled:t,namespace:i}=p(),[r,n]=(0,c.useState)(!1),{fetchedUsers:l,isLoadingUsers:a}=(0,o.useSelect)(e=>{const{getUsers:i,getIsResolving:r}=e("core");return{fetchedUsers:t?.users?i({capabilities:"activitypub"}):null,isLoadingUsers:!!t?.users&&r("getUsers",[{capabilities:"activitypub"}])}},[t?.users]),d=(0,o.useSelect)(e=>l||a?null:e("core").getCurrentUser(),[l,a]);(0,c.useEffect)(()=>{!l&&!a&&d&&i&&u()({path:`/${i}/actors/${d.id}`,method:"HEAD",headers:{Accept:"application/activity+json"},parse:!1}).then(()=>n(!0)).catch(()=>n(!1))},[l,a,d,i]);const h=(0,c.useMemo)(()=>l||(d&&r?[{id:d.id,name:d.name}]:[]),[l,d,r]);return(0,c.useMemo)(()=>{if(!h.length)return[];const i=[];return t?.blog&&l&&i.push({label:(0,s.__)("Blog","activitypub"),value:"blog"}),e&&t?.users&&l&&i.push({label:(0,s.__)("Dynamic User","activitypub"),value:"inherit"}),h.reduce((e,t)=>(e.push({label:t.name,value:`${t.id}`}),e),i)},[h,t?.blog,t?.users,l,e])}({withInherit:!0});(0,c.useEffect)(()=>{null!==j?(g(!0),w(null),u()({path:`/${O}/actors/${j}`,headers:{Accept:"application/activity+json"}}).then(e=>{const t=(e.attachment||[]).filter(e=>"PropertyValue"===e.type);y(t),g(!1)}).catch(e=>{w(e.message),g(!1)})):y([])},[j,O]);const E=d>0?f.slice(0,d):f,P=(()=>{const t=e.className?.includes("is-style-cards");if(!t)return{};const i=e.style||{},r=e.backgroundColor,s=i.color?.background;return r?{backgroundColor:`var(--wp--preset--color--${r})`}:s?{backgroundColor:s}:{}})(),S=(0,h.jsx)(n.InspectorControls,{children:(0,h.jsxs)(l.PanelBody,{title:(0,s.__)("Settings","activitypub"),initialOpen:!0,children:[(0,h.jsx)(l.SelectControl,{label:(0,s.__)("User","activitypub"),value:r,options:C,onChange:e=>t({selectedUser:e})}),(0,h.jsx)(l.RangeControl,{label:(0,s.__)("Maximum Fields","activitypub"),value:d,onChange:e=>t({maxFields:e}),min:0,max:20,help:(0,s.__)("Limit the number of fields displayed. 0 = show all.","activitypub")})]})});return"inherit"!==r||_?x?(0,h.jsx)("div",{...F,children:(0,h.jsx)(l.Placeholder,{label:(0,s.__)("Fediverse Extra Fields","activitypub"),children:(0,h.jsx)(l.Spinner,{})})}):m?(0,h.jsx)("div",{...F,children:(0,h.jsx)(l.Placeholder,{label:(0,s.__)("Fediverse Extra Fields","activitypub"),children:(0,h.jsx)("p",{children:(0,s.sprintf)(/* translators: %s: Error message */ /* translators: %s: Error message */
|
||||
(0,s.__)("Error loading extra fields: %s","activitypub"),m)})})}):0===E.length?(0,h.jsxs)(h.Fragment,{children:[S,(0,h.jsx)("div",{...F,children:(0,h.jsx)(l.Placeholder,{label:(0,s.__)("Fediverse Extra Fields","activitypub"),children:(0,h.jsxs)("p",{children:[(0,s.__)("No extra fields found.","activitypub")," ",k&&(0,h.jsx)(l.Button,{variant:"link",onClick:()=>{window.location.href=k},children:(0,s.__)("Add fields in your profile settings","activitypub")})]})})})]}):(0,h.jsxs)(h.Fragment,{children:[S,(0,h.jsx)("div",{...F,children:(0,h.jsx)("dl",{className:"activitypub-extra-fields",children:E.map(e=>(0,h.jsxs)("div",{className:"activitypub-extra-field",style:P,children:[(0,h.jsx)("dt",{children:e.name}),(0,h.jsx)("dd",{dangerouslySetInnerHTML:{__html:(0,a.safeHTML)(e.value)}})]},`${e.name}-${e.value}`))})})]}):(0,h.jsxs)(h.Fragment,{children:[S,(0,h.jsx)("div",{...F,children:(0,h.jsx)(l.Placeholder,{label:(0,s.__)("Fediverse Extra Fields","activitypub"),children:(0,h.jsx)("p",{children:(0,s.__)("This block will display extra fields based on the post author when published.","activitypub")})})})]})},save:()=>null})}};const t={};function i(r){const s=t[r];if(void 0!==s)return s.exports;const n=t[r]={exports:{}};return e[r](n,n.exports,i),n.exports}i.m=e,(()=>{const e=[];i.O=(t,r,s,n)=>{if(r){n=n||0;for(var l=e.length;l>0&&e[l-1][2]>n;l--)e[l]=e[l-1];return void(e[l]=[r,s,n])}let a=1/0;for(l=0;l<e.length;l++){let[r,s,n]=e[l],c=!0;for(var o=0;o<r.length;o++)(!1&n||a>=n)&&Object.keys(i.O).every(e=>i.O[e](r[o]))?r.splice(o--,1):(c=!1,n<a&&(a=n));if(c){e.splice(l--,1);const i=s();void 0!==i&&(t=i)}}return t}})(),i.n=e=>{const t=e&&e.__esModule?()=>e.default:()=>e;return i.d(t,{a:t}),t},i.d=(e,t)=>{if(Array.isArray(t))for(var r=0;r<t.length;){var s=t[r++],n=t[r++];i.o(e,s)?0===n&&r++:0===n?Object.defineProperty(e,s,{enumerable:!0,value:t[r++]}):Object.defineProperty(e,s,{enumerable:!0,get:n})}else for(var s in t)i.o(t,s)&&!i.o(e,s)&&Object.defineProperty(e,s,{enumerable:!0,get:t[s]})},i.o=(e,t)=>Object.hasOwn(e,t),(()=>{const e={914:0,678:0};i.O.j=t=>0===e[t];const t=(t,r)=>{let[s,n,l]=r;var a,o,c=0;if(s.some(t=>0!==e[t])){for(a in n)i.o(n,a)&&(i.m[a]=n[a]);if(l)var d=l(i)}for(t&&t(r);c<s.length;c++)o=s[c],i.o(e,o)&&e[o]&&e[o][0](),e[o]=0;return i.O(d)},r=globalThis.webpackChunkwordpress_activitypub||=[];r.forEach(t.bind(null,0)),r.push=t.bind(null,r.push.bind(r))})();let r=i.O(void 0,[678],()=>i(755));r=i.O(r)})();
|
||||
Reference in New Issue
Block a user