Commit graph

37 commits

Author SHA1 Message Date
Matthias Pfefferle
f0c52580ff
Improve AUTHORIZED_FETCH (#728)
* simplify code

* show limited profile informations

* exclude application user

* use actor instead of user

* change JS

* use Application instead of Application_User

* re-add use

* add summary

* Improves comment intent

* remove limited actor json in favour of the application user

---------

Co-authored-by: Django Doucet <mediaformat.ux@gmail.com>
2024-05-03 08:54:06 +02:00
André Menrath
174262d22c
Add/event objects (#629)
* remove redundant property definitions

* Add redused context for actors.

* Add classes to construct Moblizon compatible events

* Bind the context to the activitypub object
- change the propertyname  which stores the json-ld context from context to _context, because context is already reserved in the ActivityStreams vocabulary.
- cleanup currently unused code

* fix phpcs

* Remove PostalAddress object: it's enough (at least atm) to directly write the array in transformers.

* Remove _context property from ActivityPub objects in favour of getter function get_json_ld_context()

* fix unit tests: ActivityPub Activity objects have a custom getter for the JsonLD context

* fix phpcs

* fix unit-tests to also support php5.6

* fix phpcs

* add param include_json_ld_context to to_array function
This allows to not set the @context in the resulting array.

* propagate the param include_json_ld_context to nested calls of to_array.

* fix phpcs

* Nested AcitivityPub objects: never build context in inner items in to_array function

* fix: param of set_address may also be an array

* fix typo in comment

* always prefix json-ld context with json-ld and move event class to sub-namespace

* fix usage of reserved object keyword
seems it should not be used as a namespace either

* Merge commit 'b2271cda6b857f879e0abd4f3c6683642d725267' into add/event-objects

* Fix calling non-static function as static

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

* Partly fix Json-LD contexts in collections

* Update includes/activity/class-base-object.php

* this is implicit

We already set the correct user with `$transformer->change_wp_user_id( $user_id );` so the Actor will be generated properly. We can change the behaviour, but we should not use both.

* this change prevents the Activity to re-use Object vars

this should stay as is, because it pre-fills the Activity with data (for example cc and to) and it will no longer be done with your change.

It is on purpose that it first sets the object and then replaces it with the URI.

See: https://github.com/Automattic/wordpress-activitypub/blob/master/includes/activity/class-activity.php#L195

* add `$include_json_ld_context` support to `to_json`

* disable some more contexts

* remove whitespace

* Add php-comment for 7ed17c042a

* Fix JSON-LD context for ActivityPub objects: child classes may override it.

* coding standards

* call folder/namespace `Extended_Object`

 to be consistent with folder names in singular

* fix: unnessesary nesting of extended-objects

* remove license

I hope this is fine, to have the complete plugin under the MIT @Menrath ?!?

---------

Co-authored-by: Matthias Pfefferle <pfefferle@users.noreply.github.com>
2024-01-18 16:35:52 +01:00
Matthias Pfefferle
6e7f82bf42
Activity-Type based handlers (#551)
* init

* save source id

* fix delete and add improve undo

* test new functions

* add support for threaded comments

* some formatting

* check if URL is no longer available

...and returns either status 410 or 404.

* improve delete handler

* improve update handler

* `object` and `actor` are already required by the inbox endpoint

* fix typo

* simplify queries

* cosmetics

* fix unit tests

* schedule delete comments of deleted actor (#575)

* schedule delete comments of deleted actor

* phpcs

---------

Co-authored-by: Django Doucet <django.doucet@webdevstudios.com>

* move `get_comments_by_actor` to interactions collection

* consistent wording

* implement Tombstone

* fix follow issue

* fix inbox-create

* added missing namespace

* check if field is set

* Fix namespacing issue

* update profile and update interaction

* fields are already validated by inbox

* optimize avatar handling

---------

Co-authored-by: Django <mediaformat.ux@gmail.com>
Co-authored-by: Django Doucet <django.doucet@webdevstudios.com>
2023-11-30 11:43:48 +01:00
Matthias Pfefferle
6810884c52
have a filter to defer signature verification (#435) 2023-11-11 06:00:20 +01:00
Matthias Pfefferle
8078512b8c small improvements 2023-10-24 14:54:03 +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
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
Matthias Pfefferle
2ef72a0364 API changes 2023-10-12 11:00:58 +02: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
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
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
Matthias Pfefferle
112eb51af1 updated signature feature to new structure 2023-06-27 14:29:42 +02:00
Matthias Pfefferle
d2b7c287fc code doc 2023-05-22 13:35:46 +02:00
Matthias Pfefferle
ec4e22f570 fix routing checks 2023-05-22 13:34:14 +02:00
Matthias Pfefferle
467a349b16 some small improvements 2023-05-22 11:31:46 +02:00
Django Doucet
f4aadc00fc phpcs 2023-05-18 00:10:03 -06:00
Django Doucet
ed77ffce26 update rest paths to namespace 2023-05-18 00:03:11 -06:00
Django Doucet
12724a3681 Switch secure_mode to a filter 2023-05-16 00:07:15 -06:00
Matthias Pfefferle
7456d36834 use const instead of -1 2023-05-15 10:48:34 +02:00
Matthias Pfefferle
7d5cfb3078 phpdoc 2023-05-12 10:17:36 +02:00
Matthias Pfefferle
f196047901 remove casts
after feedback from @akirk
2023-05-11 11:02:06 +02:00
Matthias Pfefferle
ca8aff1823 cast to bool, to be sure that '0' is false 2023-05-09 12:25:25 +02:00
Matthias Pfefferle
96953dfc7e fail early and always return $response as fallback 2023-05-09 11:57:43 +02:00
Django Doucet
f79200ef27 make webfinger route available unsigned 2023-05-05 23:44:15 -06:00
Django Doucet
9202c19730 Add secure mode to REST get requests 2023-05-05 14:39:33 -06:00
Django Doucet
6c95a23d10 phpcbf 2023-05-05 13:45:38 -06:00
Django Doucet
9d30f2c1dd phpcbf 2023-05-05 12:55:12 -06:00
Django Doucet
e827221ee6 service actor as application actor 2023-05-05 12:09:12 -06:00
Django Doucet
27636b62d5 Add Service actor for signing get requests 2023-05-05 12:02:12 -06:00
Django Doucet
6b68f0763d hold off secure mode 2023-05-05 07:49:27 -06:00
Django Doucet
f396c6da4e Optimize verification code and returns WP_Errors 2023-04-21 15:25:39 -06:00
Matthias Pfefferle
24648d6d74 fix server config
See: https://wordpress.org/support/topic/jetpack-conflict-15/
2023-01-31 09:56:48 +01:00
Matthias Pfefferle
d260d7c276 add support for custom post content
fix #97 #91
2020-07-21 09:23:35 +02:00
Matthias Pfefferle
122461ab6e escape even more 2020-05-12 20:30:06 +02:00
Matthias Pfefferle
273787295a native function invocation 2020-02-22 13:02:58 +01:00
Matthias Pfefferle
385aac3568 improve request validation and added blacklist check 2020-02-21 11:11:03 +01:00