Commit graph

757 commits

Author SHA1 Message Date
2a7929719b Merge branch 'add/extendable-transformers' of ssh://code.event-federation.eu:2222/Event-Federation/wordpress-activitypub into add/extendable-transformers 2023-11-25 10:24:45 +01:00
Matthias Pfefferle
75f1da13e8
Merge branch 'master' into add/extendable-transformers 2023-11-24 09:48:03 +01:00
Matthias Pfefferle
8849e7b446
Check if the current post type supports ActivityPub. (#570)
* Check if the current post type supports ActivityPub.

* Update includes/functions.php

Co-authored-by: Jeremy Herve <jeremy@jeremy.hu>

* Update functions.php

---------

Co-authored-by: Jeremy Herve <jeremy@jeremy.hu>
2023-11-23 18:00:40 +01:00
ed1b6b7e77 change hook name for registering transformers
follow WordPress coding style and coding style of this plugin
2023-11-22 14:58:06 +01:00
804cb0af1a fix phpcs errors 2023-11-22 14:24:25 +01:00
c857eee616 transformer: move all related code to \Activitypub\Transformer namespace 2023-11-22 13:59:39 +01:00
369b32bc93 transformer: move all related code to \Activitypub\Transformer namespace 2023-11-22 08:36:55 +01:00
Matthias Pfefferle
3a5b530111
Merge branch 'master' into add/extendable-transformers 2023-11-21 15:25:07 +01:00
Matthias Pfefferle
ba44ac701b remove var_dump 2023-11-21 15:05:47 +01:00
Matthias Pfefferle
1af821621b check if ID is set
fallback to URL
2023-11-21 15:05:12 +01:00
Matthias Pfefferle
d00e5a03c8 check if $resource is set 2023-11-21 15:00:39 +01:00
0501fc5ec7 Merge remote-tracking branch 'origin/master' into add/extendable-transformers
also does c35ddf1935
2023-11-21 13:50:57 +01:00
2113d3e9b1 update phpdocs 2023-11-20 23:35:52 +01:00
246600b84e add: untestet draft of the migration for the activated post type setting 2023-11-20 23:30:33 +01:00
0ccb6c91eb fix: add missing self prefix of class constant 2023-11-20 19:39:13 +01:00
6d40ebf30e Automatically set the wp_post when returning a transformer instance for the wp_post 2023-11-20 19:36:45 +01:00
3ae71bb18c fix the wrongs calld of the get_transformer 2023-11-20 18:27:29 +01:00
38be5865c2 initial draft: add/extendable-transformers 2023-11-20 18:15:54 +01:00
Matt Wiebe
c35ddf1935
Attachments: dedupe earlier to prevent incorrect max_media (#565) 2023-11-17 18:44:59 +01:00
Matthias Pfefferle
21206ecda0
search for followers and order the output list (#502)
* search for followers and order the output list

* re-use existing nonce!

* verify nonce for search!

---------

Co-authored-by: Matt Wiebe <wiebe@automattic.com>
2023-11-17 18:44:13 +01:00
Jan Boddez
efd98acd0b
Fix #493 (#497)
* Fix #493

* Fix parenthesis

* Allow `p` and `br` tags only for AP comments

---------

Co-authored-by: Matthias Pfefferle <pfefferle@users.noreply.github.com>
2023-11-13 10:19:35 +01:00
Matthias Pfefferle
6810884c52
have a filter to defer signature verification (#435) 2023-11-11 06:00:20 +01:00
Matthias Pfefferle
26d0d357c2
Add monthly active users (#530)
* Add monthly active users for better stats on FediDB

* use more optimized query

thanks @mattwiebe

* use transients, improve logic

---------

Co-authored-by: Matt Wiebe <wiebe@automattic.com>
2023-11-07 10:27:20 +01:00
Matthias Pfefferle
a81e20a9ba
fix issue when locale is only two chars (#549)
for example  "de" instead of "de_DE"
2023-11-07 08:49:48 +01:00
Ulrich Kiermayr
9d5bd8c220
More reliable way to get author and autorurl (#546)
---------

Co-authored-by: Matt Wiebe <wiebe@automattic.com>
2023-11-06 17:10:54 -06:00
Matt Wiebe
74a774e8e7
Hashtags: 1MB limit for attempting to link (#544) 2023-11-01 10:53:27 -05:00
Matt Wiebe
eda6d6d785
Mentions: 1MB limit for attempting to link mentions, otherwise bail (#540) 2023-10-30 14:32:04 -05:00
Matt Wiebe
9ff4d1251a
Attachments: add support for audio 🔈 and video 📼 (#536)
* only in the block editor
* update settings page copy: media, not just images

---------

Co-authored-by: Matthias Pfefferle <pfefferle@users.noreply.github.com>
2023-10-27 15:55:44 -05:00
Matt Wiebe
53adfe6b80
PHP 8.1 compatibility (#533)
* PHP 8.1 compatibility

* Update compat.php

---------

Co-authored-by: Matthias Pfefferle <pfefferle@users.noreply.github.com>
2023-10-25 08:44:04 +02:00
Matthias Pfefferle
8078512b8c small improvements 2023-10-24 14:54:03 +02:00
Matthias Pfefferle
d7810114b7
improve error messages and codes (#532)
* improve error messages and codes

* version bump
2023-10-24 13:00:22 +02:00
Matthias Pfefferle
e91334e4d7
fix following endpoint (#531)
* fix following endpoint

* version bump
2023-10-24 12:45:46 +02:00
Matthias Pfefferle
4d7c0594cd remove featured tags endpoint 2023-10-23 16:16:26 +02:00
Matthias Pfefferle
b946ef3de1
more consistent use of response content type (#529)
* more consistent use of response content type

* update readme

* fix typo
2023-10-23 14:57:58 +02:00
Matthias Pfefferle
b55c5d1666 use 401 instead of 403 2023-10-23 14:54:40 +02:00
Matthias Pfefferle
0ab8df539e simplify check 2023-10-23 08:28:30 +02:00
Matthias Pfefferle
a40bd8408a
Various improvements (#527)
* remove unused code

* check if `$data['object']` is a sting

* do not index application user

* this fixes GoToSocial errors

* do not cache errors

* re-added the fragment

See https://github.com/superseriousbusiness/gotosocial/issues/2280

* Fix coding standards

* do not verify signature on head request
2023-10-21 11:23:05 +02:00
Matt Wiebe
33b61ca2b9
Shortcodes: only register when needed (#526) 2023-10-19 14:46:31 -05:00
Matt Wiebe
ff58070a5e Revert "Shortcodes: only register when needed"
This reverts commit c4daffe5c6.
2023-10-18 16:21:20 -05:00
Matt Wiebe
c4daffe5c6 Shortcodes: only register when needed 2023-10-18 16:20:06 -05:00
Matthias Pfefferle
7d96f67cb2
increase timeout (#518)
because of several issues

fix #514
2023-10-16 19:04:21 +02:00
Tim Serong
c10c52dafc
Fix typo "lenght" in help page (#511) 2023-10-14 17:38:08 +02:00
Matthias Pfefferle
1ff8bac25a
add filter to check if blog is public (#504) 2023-10-12 15:52:11 +02:00
Matthias Pfefferle
d564915fdf
fix function call (#503) 2023-10-12 13:25:50 +02:00
Matthias Pfefferle
2ef72a0364 API changes 2023-10-12 11:00:58 +02:00
Matthias Pfefferle
fd6cb84ba3 Fix compatibility with WebFinger and NodeInfo plugin 2023-10-11 11:09:37 +02:00
Matthias Pfefferle
12b6750c94
do not overwrite $image_ids (#500)
to include post thumbnail also for block-parser.
2023-10-10 20:48:59 +02:00
Matthias Pfefferle
cbb5570a1b
add backward compatibility support (#489) 2023-10-10 08:12:15 +02:00
Matt Wiebe
838ddf478f
Blocks: improved theme compat &c. (#495)
* only encode needed data
* don't show user select if there isn't more than one user
* vertically center follow me
* add title to handle: might be truncated
* theme compat: ensure readability in dialog
* theme compat for dark bg themes
2023-10-06 22:34:06 -05:00
Matt Wiebe
bade9a1348
Blocks: better frontend UX (#494)
Before this: ugly, bad loading

After this: happy, in my lane, moisturized, moving
2023-10-06 16:54:48 -05:00
Brandon Kraft
b956f5b088
Posts: add pre-fetch hook to allow plugins to hang filters on (#487)
Co-authored-by: Matthias Pfefferle <pfefferle@users.noreply.github.com>
2023-10-05 08:14:32 +02:00
Matt Wiebe
e05176cea5
Add a ACTIVITYPUB_DISABLE_REWRITES constant (#490) 2023-10-04 23:55:13 -05:00
Matt Wiebe
9907585570
Plugin loading refactor (#485)
* Plugin loading refactor
* changed load order for REST endpoints

---------

Co-authored-by: Matthias Pfefferle <pfefferle@users.noreply.github.com>
2023-10-04 11:15:53 -05:00
Matthias Pfefferle
9466048bfb
do not show block for WP versions below 5.9 (#484)
* do not show block for WP versions below 5.9

* oops, wrong operator
2023-10-04 08:32:21 +02:00
Matthias Pfefferle
b7c0e011de
Fix the health check (#481)
* only test author urls if authors are enabled

* if authors are disabled use the blog user to test webfinger
2023-10-02 17:12:23 +02:00
Matthias Pfefferle
336f3e5a62
Fix various encoding issues (#477)
* fix html-entity issue in username

* remove kses

let other platforms decide what to allow and what not

* Remove html_entity_decode to prevent encoding issues (#454)

I've tested this on content which includes MarkDown, HTML, encoded entities, unencoded entities, etc.

Fixes #445

Co-authored-by: Matthias Pfefferle <pfefferle@users.noreply.github.com>

* remove allowed tags

---------

Co-authored-by: Terence Eden <edent@users.noreply.github.com>
2023-10-02 17:11:56 +02:00
Matthias Pfefferle
46b1b4797a update text
thanks @mattwiebe
2023-09-28 17:26:39 +02:00
Matthias Pfefferle
ebc6433213 better mastodon compatibility 2023-09-28 14:38:48 +02:00
Matthias Pfefferle
0b8997d4ff
check if blog-user collides with a username (#471)
* check if blog-user collides with a username

See #470

* added changes proposed by @mattwiebe
2023-09-28 09:15:48 +02:00
Matthias Pfefferle
4cec52189a fix text 2023-09-27 11:20:05 +02:00
Matthias Pfefferle
b3e5bad89c
reduce number of checks when system cron is not used (#472)
* reduce number of checks when system cron is not used

* add health check
2023-09-27 11:14:52 +02:00
Matthias Pfefferle
bcb88eb06f
add moderators as attributed_to (#473) 2023-09-27 11:08:55 +02:00
Matthias Pfefferle
444c4b2837
Fixes PHP warnings and remote delete (#468)
* fix #463

* fix delete

/cc #465 @janboddez

* add disclaimer to not use the same name as an author login

see #470

* check if url is cached before trashing it
2023-09-27 11:05:11 +02:00
Matthias Pfefferle
20d15bc95d
fix is_single_user (#474) 2023-09-26 21:04:51 +02:00
Aslak Raanes
963b2795a6
Move [ap_hashtags] last in post in Content (#462) 2023-09-23 00:15:10 +02:00
Matthias Pfefferle
0d635d5dd1
More Group meta-data to play nicely with existing platforms (#441)
* more group friendly settings

* change http code

* Fix Actor-Type

* fix check if value is set

* only ignore null

* better posting_restricted_to_mods handling

* remove user namespace from moderators endpoint

thanks for the feedback @mattwiebe
2023-09-22 09:38:59 +02:00
Matt Wiebe
dd29775ae4
Activity: try to parse image IDs using blocks (#460)
This will prevent the issue of attaching images that don't were uploaded to the post but not used in the post

The post needs to be using blocks to get the introspection required.
2023-09-22 09:21:49 +02:00
Alex Kirk
008ae52a53
Hashtags, Mentions: Use a tag stack instead of regex for protecting tags (#455)
* Use a tag stack instead of regex for protecting tags

* Use the placeholder in the test

* Add comments

* Update comment

* ignor html comments

thanks @marcS0H

---------

Co-authored-by: Matthias Pfefferle <pfefferle@users.noreply.github.com>
2023-09-21 17:03:57 +02:00
Matthias Pfefferle
addd7dd8a1
better handling when data is missing (#444)
* better handling when data is missing

* WP_Error: add translation key and status

* do not use cache for cleanup and update

* better queries
2023-09-21 16:26:17 +02:00
Matthias Pfefferle
55e39a0b24 fix https://github.com/Automattic/wordpress-activitypub/issues/399#issuecomment-1725167874 2023-09-21 10:49:19 +02:00
Matthias Pfefferle
4a94eae877
add path to route (#438)
* add path to route

fix #421

* added changelog entry
2023-09-21 09:04:51 +02:00
Matthias Pfefferle
0763316009
add status message if it might be returned by API (#448) 2023-09-21 09:03:24 +02:00
Jeremy Herve
fe07d5eb32
Blocks: short-circuit early on sites that do not support blocks (#431)
* Blocks: short-circuit early on sites that do not support blocks

Fixes #430

This is typically only the case for sites using a custom version of WordPress, like ClassicPress.

* let grunt build the markdown

* Check for block support earlier and add filter

One can now deactivate the blocks registered by ActivityPub like so:

```
add_filter( 'activitypub_site_supports_blocks', '__return_false' );
```

* Fix readme (gotta remember to use grunt)

* alias function

---------

Co-authored-by: Matthias Pfefferle <pfefferle@users.noreply.github.com>
2023-09-15 10:38:47 +02:00
Jeremy Herve
2568f6651d
Post images: fix a typo in the hook name (#429)
* Post images: fix a typo in the hook name

Follow-up to #309

It should be '_post', not twice '_pre'.

* let grunt create the readme.md

---------

Co-authored-by: Matthias Pfefferle <pfefferle@users.noreply.github.com>
2023-09-14 19:50:27 +02:00
Terence Eden
163d9e931c
Follow redirects in class-webfinger.php (#423)
Fixes #422
2023-09-13 19:29:41 +02:00
Matthias Pfefferle
5fbf931d41 sanitize user_login 2023-09-11 11:33:31 +02:00
Matt Wiebe
8a74aa5891
Store keypairs as options keyed to user IDs. (#416) 2023-09-07 22:04:39 +02:00
Matthias Pfefferle
8dcbe0c6fd
fix Secops issues (#411) 2023-09-05 21:03:25 +02:00
Django
2ad9bf9148
Link remote comments to source url (#415) 2023-09-05 08:48:50 +02:00
Matt Wiebe
a91c1c23c8
Add default blog user icon (#412)
* add a default WP icon for the blog user

---------

Co-authored-by: Matthias Pfefferle <pfefferle@users.noreply.github.com>
2023-09-01 12:08:27 -05:00
Matthias Pfefferle
2705172b77
Fix some signature and application user issues (#410)
* Fix some signature and application user issues

* it seems that firefish needs at least an inbox also for application users

* prepare domain change

* use https

* fix PHPDoc

* remove image check

---------

Co-authored-by: Matt Wiebe <wiebe@automattic.com>
2023-09-01 18:32:56 +02:00
Dennis
26ad8975d7
Normalize Hashtag behavior in Mastodon Apps (#407)
* Update class-hashtag.php

* Update class-shortcodes.php

* fix unit tests

* missed two tests

---------

Co-authored-by: Matthias Pfefferle <pfefferle@users.noreply.github.com>
2023-08-31 15:04:17 +02:00
Matt Wiebe
c748d12d89
fix lint issues (#406) 2023-08-30 14:23:20 -05:00
Matt Wiebe
7aea1e8263
Add "Follow Me" block (#395)
The Follow Me block helps site visitors to follow you in the fediverse
---------

Co-authored-by: Matthias Pfefferle <pfefferle@users.noreply.github.com>
2023-08-30 14:14:57 -05:00
Matt Wiebe
d38bf60d11
add site logo support to blog user (#400) 2023-08-16 21:39:55 -05:00
Matt Wiebe
9e73081668
deactivate the akismet nonce when processing our comments (#391) 2023-08-16 10:12:31 -05:00
Matt Wiebe
78870cd206
Revert User::get_webfinger_identifier (#398)
we already have `User::get_resource` to do the same
2023-08-16 07:52:26 -05:00
Matt Wiebe
d6ff82b337
adds a get_webfinger_identifier method (#397)
also `get_at_url` needed an update for the Blog User, who would throw an error otherwise
2023-08-15 18:22:58 -05:00
Matthias Pfefferle
14b91cf760
remote-follow endpoint (#392)
Some checks failed
PHP_CodeSniffer / phpcs (push) Failing after 2s
Unit Testing / phpunit (5.6, 6.2) (push) Failing after 2s
Unit Testing / phpunit (7.0) (push) Failing after 2s
Unit Testing / phpunit (7.2) (push) Failing after 2s
Unit Testing / phpunit (7.3) (push) Failing after 2s
Unit Testing / phpunit (7.4) (push) Failing after 2s
Unit Testing / phpunit (8.0) (push) Failing after 2s
Unit Testing / phpunit (8.1) (push) Failing after 2s
Unit Testing / phpunit (8.2) (push) Failing after 2s
Unit Testing / phpunit (latest) (push) Failing after 2s
Plugin asset/readme update / Push to master (push) Failing after 1s
Adds an endpoint at `users/$user_id/follow-me` to return the follow template for a remote user, to enable following them more easily.
2023-08-11 17:41:34 -05:00
Matthias Pfefferle
69ba1c87e1 fix sticky posts endpoint
Some checks failed
PHP_CodeSniffer / phpcs (push) Failing after 2s
Unit Testing / phpunit (5.6, 6.2) (push) Failing after 2s
Unit Testing / phpunit (7.0) (push) Failing after 2s
Unit Testing / phpunit (7.2) (push) Failing after 2s
Unit Testing / phpunit (7.3) (push) Failing after 3s
Unit Testing / phpunit (7.4) (push) Failing after 2s
Unit Testing / phpunit (8.0) (push) Failing after 3s
Unit Testing / phpunit (8.1) (push) Failing after 2s
Unit Testing / phpunit (8.2) (push) Failing after 3s
Unit Testing / phpunit (latest) (push) Failing after 2s
Plugin asset/readme update / Push to master (push) Failing after 18s
2023-08-11 11:16:06 +02:00
Matthias Pfefferle
626203002a only include the minimum required fields for Accept call 2023-08-11 09:24:45 +02:00
Matthias Pfefferle
30eb07ba17 add missing "type"
see https://git.joinfirefish.org/firefish/firefish/-/issues/10650#note_1011
2023-08-11 09:23:49 +02:00
Matthias Pfefferle
bc7e173fe0 also allow JSON 2023-08-11 09:22:46 +02:00
Matthias Pfefferle
6e2656311b oops 2023-08-10 15:35:10 +02:00
Matthias Pfefferle
1fd0cca185 fix check! 2023-08-10 15:10:07 +02:00
Matthias Pfefferle
fcc9603920 fix typo 2023-08-09 14:15:05 +02:00
Matthias Pfefferle
7de3696c2c fix @context 2023-08-09 14:13:58 +02:00
Matthias Pfefferle
21afec8586 fix rewrite rule 2023-08-09 13:58:42 +02:00
Matthias Pfefferle
049046be70
update endpoints (#390)
* add collection endpoint

* show featured posts

* more consistant wording

* backwards compatibility with php7.x

* compatibility with php5.6

* use ACTIVITYPUB_AUTHORIZED_FETCH instead

because the ACTIVITYPUB_SECURE_MODE could be misinterpreted with disabling the security mechanisms completely.

* the blog user follows all authors of a blog

if not in single_user mode

* phpdoc

* adding changes based on feedback from @jeherve

* global namespace

* better hashtag handling

should also fix #373 #239

thanks @jeherve for help and feedback!

* fix workflow
2023-08-09 13:07:30 +02:00
Matt Wiebe
48632a7e1b
Add inbox create/react actions (#387)
This will help us to debug why comments fail
2023-08-02 12:03:32 -05:00