Commit graph

1172 commits

Author SHA1 Message Date
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
Alex Kirk
dad6b73cdb
Enable Mastodon Apps: Add followers_count to internal accounts (#676)
* Mock http requests, add followers_count to account object

* Remove one more MockAction

* Add one more assert

* cleanup

* cleanup

* use Users class, to check if user is really an ActivityPub user

---------

Co-authored-by: Matthias Pfefferle <pfefferle@users.noreply.github.com>
2024-01-26 17:34:02 +01:00
Alex Kirk
e560d1b5b6
Enable Mastodon Apps: Implement the account endpoint for an external account (#674)
* Implement the account endpoint for an external account

* phpcs

* typos

* Change namespace calling

* Populate with more data

* phpcs

* some formatting

* some phpdoc

* Potentially extend an existing account

props @pfefferle

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

* phpcs

* Switch to using jsonSerialize

---------

Co-authored-by: Matthias Pfefferle <pfefferle@users.noreply.github.com>
2024-01-25 15:54:35 +01:00
Matthias Pfefferle
48feabe39e
Improve post-type support (#675)
* Improve post-type support

* Remove `page` from default types (fix #665)
* Add description to settings (fix #673)

* fix tests
2024-01-25 15:51:21 +01:00
dependabot[bot]
873de246a7
Bump @wordpress/scripts from 26.19.0 to 27.0.0 (#663)
Bumps [@wordpress/scripts](https://github.com/WordPress/gutenberg/tree/HEAD/packages/scripts) from 26.19.0 to 27.0.0.
- [Release notes](https://github.com/WordPress/gutenberg/releases)
- [Changelog](https://github.com/WordPress/gutenberg/blob/trunk/packages/scripts/CHANGELOG.md)
- [Commits](https://github.com/WordPress/gutenberg/commits/@wordpress/scripts@27.0.0/packages/scripts)

---
updated-dependencies:
- dependency-name: "@wordpress/scripts"
  dependency-type: direct:development
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Matthias Pfefferle <pfefferle@users.noreply.github.com>
2024-01-22 14:26:35 -06:00
Matthias Pfefferle
1a7c9a5ea9 better checks to prevent possible PHP errors 2024-01-22 12:15:33 +01:00
Matthias Pfefferle
3d1fab501d use esc_textarea 2024-01-22 11:50:32 +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
b612ce0f8e check if blog author is enabled or not
thanks for your help with debugging @akirk
2024-01-18 15:54:42 +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
b2271cda6b unschedule old hooks
related #639
2024-01-13 20:29:16 +01:00
Matthias Pfefferle
d6842616c7 fallback to ID id URL is not set 2024-01-12 16:51:33 +01:00
Matthias Pfefferle
7e35c1e8b9 version bump 2024-01-12 16:07:56 +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
e23c65f295 remove whitespaces 2024-01-12 10:10:14 +01:00
Matthias Pfefferle
fba1c42dc0
fix comment update federation (#651)
fix #649
2024-01-12 10:08:07 +01:00
Jan Boddez
b243ca9301
Update class-activitypub.php (#650) 2024-01-11 22:41:47 +01:00
Matthias Pfefferle
f7d535b885 Revert "introduce a filter to check if an activity should be sent or not"
This reverts commit 62b73d251a.
2024-01-11 14:15:46 +01:00
Matthias Pfefferle
62b73d251a introduce a filter to check if an activity should be sent or not 2024-01-11 14:15:15 +01:00
Matthias Pfefferle
bdd8ab804f fix mentions and finally add dot support 2024-01-10 20:57:40 +01:00
Matthias Pfefferle
1fe2ff7ca5 remove dot 2024-01-10 20:49:38 +01:00
Matthias Pfefferle
f3753f2150 re-order positions 2024-01-10 20:42:02 +01:00
Matthias Pfefferle
907ae508b1 escape dot 2024-01-10 20:38:39 +01:00
Matthias Pfefferle
23d7d84f35 support dots in the user part of WebFinger 2024-01-10 20:34:18 +01:00
Matthias Pfefferle
48a33b82e9 always use application user to check webfinger endpoint
see #627
2024-01-10 11:06:01 +01:00
Sam Lade
d09b2ae9f3
Fix classic editor image finding for large images (#643)
The filename with -scaled in it is used as the primary key in this case.
Fix lookups to take this into account.
2024-01-10 10:44:45 +01:00
Matthias Pfefferle
20a49edb1b fix #627 2024-01-10 10:27:05 +01:00
Matthias Pfefferle
3f8d6af7fc version bump 2024-01-09 09:44:40 +01:00
Matthias Pfefferle
6437d3d5cf better user handling in post transformer 2024-01-09 09:04:19 +01:00
Matthias Pfefferle
2c107eec62
Use FEP-2c59 for WebFinger reference (#636) 2024-01-08 20:01:16 +01:00
Matthias Pfefferle
e5c270b09f fallback to preferredUsername
fix: https://wordpress.org/support/topic/anonymous-instead-of-nickname/
2024-01-08 15:52:27 +01:00
Jan Boddez
6e5cb57e3a
Address some of things found in #633 (#634)
* Address some of things found in #633

* Improve "state"
2024-01-05 19:53:25 +01:00
André Menrath
4c297acfd4
Improve the property names of the transformer classes (#630)
* Improve the property names of the transformer classes
- Rename the property 'object' to 'wp_object' to indicate that its the source
- Enhance some PHP-Docs

* Transformer might also get called with stdClass as a parameter.

Applied as suggestions from code review.

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

* remove stdClass

---------

Co-authored-by: Matthias Pfefferle <pfefferle@users.noreply.github.com>
2024-01-04 14:05:00 +01:00
Tom
245cda8433
Add readme section for "WordPress in sub directory" with different si… (#625)
* Add readme section for "WordPress in sub directory" with different site_url, fixes #538

* Add readme section for "WordPress in sub directory" also in readme.txt

* Fix typo

* the readme is auto-generated

---------

Co-authored-by: Matthias Pfefferle <pfefferle@users.noreply.github.com>
2023-12-28 21:04:12 +01:00
Sam Lade
7855437c5c
Add improved classic editor image detection (#624)
* Add improved classic editor image detection

Parse the HTML if possible to extract image URLs.

* dedupe

* make linter happy

* small changes

---------

Co-authored-by: Matthias Pfefferle <pfefferle@users.noreply.github.com>
2023-12-26 21:06:58 +01:00
Matthias Pfefferle
e915b7af8b fix #620 2023-12-23 20:31:42 +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
Matthew Exon
a9c65f55d6
show admin notice when permalink structure is plain (#615)
* show admin notice when permalink structure is plain

fix #609

* fix phpcs issues

* remove calculation of static array of issues

* small changes

* removed unused attribute

---------

Co-authored-by: Matthew Exon <git.mexon@spamgourmet.com>
Co-authored-by: Matthias Pfefferle <pfefferle@users.noreply.github.com>
2023-12-22 11:42:20 +01:00
Matt Wiebe
3cda64a255
Profiles: Update followers when profile fields change (#542)
* Profiles: update followers when profile fields change

* use static

* only try to merge mention inboxes when valid

* cleanups

* add hook to wp_update_user

* update readme

---------

Co-authored-by: Matthias Pfefferle <pfefferle@users.noreply.github.com>
2023-12-22 11:33:25 +01:00
Matthias Pfefferle
f2b231ccac fix some small issues 2023-12-22 11:01:23 +01:00
Matthias Pfefferle
b744dc551d
Comment Federation (#550)
* Comments 1

* Delete FUNDING.yml

* Add basic BuddyPress support

fix #122

thanks and props @skysarwer

* change URL to `bp_core_get_user_domain`

* fix "Follow" issue

fix #133

* fix #135

* version bump

* Create phpunit.yml

* Update composer.json

* Update composer.json

* Update phpunit.yml

* Update composer.json

* Create phpcs.yml

* Update phpcs.xml

* Update composer.json

* phpcs fixes

* fix typo

* Comments update

* webfinger_extract remove extra param

* coding standards

* Replies Collection, settings, other fixes

* Create stale.yml

* move stale file

* code standards cleanup

* Migrate / Update script

* bugfix

* add settings link to plugin page

* fix code standards

* fix cs

* fix PHPCS

* PHPCS fixes

* change background image for wp.org

* fix docker

* fix webfinger for email identifiers

fix #152

* version bump

* update composer file to fix unit testing

* allow plugins

* fix dependencies

* Migrate tools

* code cleanup

* regression fix

* Fix announce, clarified language

* update included filename

* code cleanup

* Improve migration UX

* Add comments view, warnings to migrate page

* style fix

* more style fixes

* Fix send_delete_activity

* replace ap_comment_id to reuse  replytocom var

* Comments class missing attributes

* Post class fix attributes

* move js file to assets/js

* Separate file for Comment processing hooks

* fix file path

* associate comments to back compat post

* Fix js assets enqueue

* change regex matching potential hashtags

Matches any string starting with '#' and consisting of any number and combination of [A-Za-z0-9_] that is directly followed by whitespace or punctuation. Groups everything after '#' for access in functions using this regex.

This fixes #183 (incomplete links on hashtags containing special characters) by not matching these at all.

* also detect hashtags at the start of a paragraph

* restrict html tags after which to detect a hashtag

Hashtags should not be detected after just any html tag - for example not after an opening a or div. To still allow detection at the start of a line, allow specifically p and br to directly precede a hashtag.

* fix pagination

* Add Custom Post Type support to outbox API

* remove comment_type

* fix comparison

* remove trailing spaces

* fix phpcs issues

* fix phpcs issues

* run phpcs also on pull_requests

* fix phpcs issues

* support threaded comments from ActivityPub

* refactor support for threaded comments from ActivityPub

* remove debugging log line

* add first unit tests for class inbox

* fix code smells

* make filter function static

* attempt to resolve backwards compatibility issues

* update js to new file

* delete old js

* Remove migrate code

* update post meta canonical

* remove type and mention meta from comment filters

* extract mentions from comment_content

* phpcbf

* remove extra curly bracket

* Remove migrate code

* remove version_check()

* Update enqueue scripts

* Remove remote comments from preprocessing

* Reply to comments from Dashboard

* rename function, inserts users into reply text

* Update dispatch comments

* update comment model

* fix comment model replies property

* fix preprocess_comment cap check

* Add webfinger filter to comments

* Add comment edit datetime

* cleanup

* fix var name

* cleanup

* phpcbf

* better actual translation support

* Separate comment reply script

* migrate dispatch, migrate comment model to transform

* ignore WP_Comment type for now

* Adds new helpers for resolving inReplyTo url

* Update activitypub_send_comment_activity to include type

* remove redundant id check

* reinclude user_id in saved ap_object meta

* update post field meta

* Fix comment updated datetime

* front-end reply inserts @mentions

* enqueue reply script on front end

* use const instead of dirname

* some simplifications

* move some functions

* fixes

* some more fixes

* fix namespace

* fix unittests

* fix testcase

* fixed typo

* fix tests

* fix tests

* fix PHPCS

* move functions to transformer class

* fix warnings

* Link remote comments on frontend

* Link to comment source as row action

* Init Comments class

* remove dead dispatch action

* re-add extract mentions filter

* Restore and tweak Comment transform

* Schedule comments activities for non-admin users

* lint

* remove context property

* rename get_id method to generate_id

* fix locale

* move functions

* PHPDoc

* this is never used

* remove some edit methods

* remove replies for now

* remove JS calls

* remove reply_recipients

* never used

* remove other query-vars

* otherwise to_json would not work properly

* small changes

* use `c` for comment IDs

* remove comments.php for now

maybe re-add it later

* wp_insert_post is an action

* also parse comment_text

* remove duplicate functions

* add Base transformer

* remove invalid test

* update to new query var

* update dispatcher to support comments and posts

* fix transition

* remove unused functions for now

* schedule_comment_activity seems to ignore create and update

* fix wrong use of functions!

* not every platforms sends an URL

* check source-id first

* remove hashtags for now

* fallback to ID

* fix typo

* move to_activity to Base class

* remove unused function

* add support for announce and like

* also ping inboxes of other commenters in the thread

* restructure WebFinger class

* some small improvements

* simplified to_object class

props @Menrath for the feedback and the idea!

* fix unit tests

* make transformer filterable

/cc @Menrath

* use transformer factory, so that transformer can be overwritten

* phpcs fixes

* fix attachments

* fix comment transformer

* remove comments for now

* update readme/changelog

* simplify and unify json_encodes

---------

Co-authored-by: Django Doucet <mediaformat.ux@gmail.com>
Co-authored-by: Andreas <andreas@bocops.de>
Co-authored-by: Eana Hufwe <eana@1a23.com>
Co-authored-by: Matthew Exon <git.mexon@spamgourmet.com>
Co-authored-by: Django Doucet <django.doucet@webdevstudios.com>
2023-12-22 10:12:26 +01:00
Matthias Pfefferle
a3ea9955d9 fix issue with wrong object init! 2023-12-21 17:27:43 +01:00
André Menrath
45e6ace890
Add nodeinfo metadata (#618)
* add nodeinfo metadata
nodeName, nodeDescription and nodeIcon

* Fix CS: double space typo
2023-12-21 16:05:32 +01:00
Matthias Pfefferle
5ce8f28852 fix nodeinfo integration 2023-12-21 15:19:18 +01:00
Matthias Pfefferle
f4cab6647d fix application user 2023-12-21 10:10:55 +01:00
Matthias Pfefferle
6f1a9a1f7f
added FEP-2677 (#613)
* added FEP-2677

This PR enables [FEP-2677: Identifying the Application Actor](https://codeberg.org/fediverse/fep/src/branch/main/fep/2677/fep-2677.md)

@Menrath I needed a small task for in between ;)

* update changelog
2023-12-21 10:06:37 +01:00
Matthias Pfefferle
39c9288987
Improve/webfinger (#616)
* Fix some WebFinger issues

* update changelog
2023-12-21 10:04:15 +01:00
Kan-Ru Chen
a47c9cd7ae
replace excerpt_more with custom filter activitypub_excerpt_more for better consistency (#610) 2023-12-16 07:36:45 +01:00
Matthias Pfefferle
97e2bbfe7a remove systems cron warning
fix #525
2023-12-15 07:45:11 +01:00