Commit graph

187 commits

Author SHA1 Message Date
Matthias Pfefferle
dab261826b fix redirect issue 2024-06-17 12:37:43 +02:00
Matthias Pfefferle
3fde5bbe96
Improve lemmy compatibility (#752)
* improve lemmy compatibility

* simplify code

* fix tests

* use string instead of array

* use `actors` instead of `users`

* optimize ID generation

* update ID

* the #threadiverse needs Announces for everything! :)

* change to full Announce Object

* fix indents
2024-05-16 17:30:08 +02:00
Jan Boddez
2b96c6efd2
Improve transformer (#731)
* Factory::get_transformer() may return a WP_Error instance

* Fix templates

* PHPDoc

* "Fix" conneg (for posts, at least)

* (Hopefully) fix conneg for comments, too

* Ugly, but works?

* Fix outboxes, collections

* Clean up a bit

* Use Factory

* Remove outdated `use`

* Use Transformer\Factory instead of Transformer\Post

* "Fix" _deprecated_function() call

* Remove superfluous transformer check

* Remove transformer check

* Call Transformer::get_transformer() only once per request

* PHPDoc

* this should be fine

a failing transformer is very unlikely because there are a lot of checks before `is_singular` or `is_comment` is valid.

* no longer used

---------

Co-authored-by: Matthias Pfefferle <pfefferle@users.noreply.github.com>
2024-05-16 15:14:31 +02:00
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
Jan Boddez
2b8480fa1c
Fix #621 (#677)
* Update class-follower.php

Just a test

* Update class-follower.php

* Update class-follower.php

---------

Co-authored-by: Matthias Pfefferle <pfefferle@users.noreply.github.com>
2024-01-26 17:37:13 +01: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
4fafea35e7
implements a basic followers endpoint for the mastodon api (#666)
* implements a basic followers endpoint for the mastodon api

see https://github.com/akirk/enable-mastodon-apps/pull/67

/cc @akirk

* fix php 5.6 issue
2024-01-18 13:38:02 +01:00
Matthias Pfefferle
88ab98005e fix deprecated class 2024-01-12 16:07:48 +01:00
Matthias Pfefferle
9f09bfbcf4 re-add Post model
workaround for #639
2024-01-12 16:02:40 +01:00
Matthias Pfefferle
2c107eec62
Use FEP-2c59 for WebFinger reference (#636) 2024-01-08 20:01:16 +01:00
Matthias Pfefferle
a8078ce72b
Shared Inbox (#617)
* init shared inbox

* try to get user id from activity

* some code formatting

* disable ACTIVITYPUB_SHARED_INBOX_FEATURE

* done!

* do not use the inbox-user at all

* fix user check!

* fix user check!
2023-12-22 17:45:27 +01:00
Matthias Pfefferle
f4cab6647d fix application user 2023-12-21 10:10:55 +01:00
Matthias Pfefferle
39c9288987
Improve/webfinger (#616)
* Fix some WebFinger issues

* update changelog
2023-12-21 10:04:15 +01:00
Matthias Pfefferle
77c508059b
Remove deprecated classes (#604) 2023-12-12 13:47:01 +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
Matthias Pfefferle
4d7c0594cd remove featured tags endpoint 2023-10-23 16:16:26 +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
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
ebc6433213 better mastodon compatibility 2023-09-28 14:38:48 +02:00
Matthias Pfefferle
bcb88eb06f
add moderators as attributed_to (#473) 2023-09-27 11:08:55 +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
Matthias Pfefferle
0763316009
add status message if it might be returned by API (#448) 2023-09-21 09:03:24 +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
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
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
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
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
338c63d3e1
re-add post model (#386) 2023-08-01 18:37:16 +02:00
Matthias Pfefferle
3afed5b296
Add/small improvements (#384)
* flush rewrite rules after migration

* some activity improvements

* equate usernames with and without `.`

Can we equate `@notiz.blog@notiz.blog` with `@notizblog@notiz.blog`?

* better NodeInfo compatibility check

* fix `extract_name_from_uri`

* reset user check

* re-added action

* fix check
2023-07-31 20:15:11 +02:00
Matthias Pfefferle
a89a106f21 fall back to preferred username 2023-07-28 15:18:48 +02:00
Matthias Pfefferle
d2af87c259 ignore phpcs warning 2023-07-28 09:50:30 +02:00
Matthias Pfefferle
799280a808 fix default username 2023-07-28 00:47:20 +02:00
Matthias Pfefferle
e12cfa44ac
workaround for special chars (#379) 2023-07-28 00:39:22 +02:00
Matthias Pfefferle
d456e86d1a fix escaping 2023-07-27 17:30:35 +02:00
Matt Wiebe
5b9dadd6fd
Followers Block (#344)
Introduces a new Followers block. Proudly display your Fediverse followers to the world!

---------

Co-authored-by: Matthias Pfefferle <pfefferle@users.noreply.github.com>
2023-07-26 15:05:41 -05:00
Matthias Pfefferle
626616a747 always use host as default username 2023-07-14 11:29:03 +02:00
Matthias Pfefferle
002d4e7981 refactoring 2023-07-11 14:34:11 +02:00
Matthias Pfefferle
57bc4214b7 If the Blog is in "single user" mode, return "Person" insted of "Group". 2023-07-11 09:28:10 +02:00
Matthias Pfefferle
befd0d4f1e do not persist data in a getter! 2023-07-11 09:21:16 +02:00
Matthias Pfefferle
a461ea3b1f some refactorings 2023-07-11 09:09:37 +02:00
Matthias Pfefferle
d5a389420d some fixes based on the feedback of @mattwiebe 2023-07-11 08:53:18 +02:00
Matthias Pfefferle
fe99fffab6 use Group type for blog-user 2023-07-10 10:29:15 +02:00
Matthias Pfefferle
a0a1e33dc8 Fall back to ID id URL is empty 2023-07-10 10:28:45 +02:00
Matthias Pfefferle
d4f5ad8ec1 use post_meta instead of post_content 2023-07-06 16:10:48 +02:00
Matthias Pfefferle
96c1e92151 optimize and simplify followers 2023-07-06 14:42:18 +02:00
Matthias Pfefferle
52038c9f43 fix image and username handling 2023-07-05 15:32:26 +02:00