diff --git a/.distignore b/.distignore index 93fbfdb..782f2e8 100644 --- a/.distignore +++ b/.distignore @@ -22,6 +22,8 @@ bin composer.json composer.lock docker-compose.yml +docker-compose-test.yml +Dockerfile gulpfile.js package.json node_modules diff --git a/.github/stale.yml b/.github/stale.yml new file mode 100644 index 0000000..e6e3287 --- /dev/null +++ b/.github/stale.yml @@ -0,0 +1,17 @@ +# Number of days of inactivity before an issue becomes stale +daysUntilStale: 120 +# Number of days of inactivity before a stale issue is closed +daysUntilClose: 7 +# Issues with these labels will never be considered stale +exemptLabels: + - pinned + - security +# Label to use when marking an issue as stale +staleLabel: wontfix +# Comment to post when marking an issue as stale. Set to `false` to disable +markComment: > + This issue has been automatically marked as stale because it has not had + recent activity. It will be closed if no further activity occurs. Thank you + for your contributions. +# Comment to post when closing a stale issue. Set to `false` to disable +closeComment: false diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 5aa90f7..2e17997 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -10,7 +10,7 @@ jobs: steps: - uses: actions/checkout@master - name: WordPress Plugin Deploy - uses: 10up/action-wordpress-plugin-deploy@master + uses: 10up/action-wordpress-plugin-deploy@stable env: SVN_PASSWORD: ${{ secrets.SVN_PASSWORD }} SVN_USERNAME: ${{ secrets.SVN_USERNAME }} diff --git a/.github/workflows/phpcs.yml b/.github/workflows/phpcs.yml index 870b0ee..b7392e1 100644 --- a/.github/workflows/phpcs.yml +++ b/.github/workflows/phpcs.yml @@ -1,5 +1,7 @@ name: PHP_CodeSniffer -on: push +on: + push: + pull_request: jobs: phpcs: runs-on: ubuntu-latest @@ -19,7 +21,7 @@ jobs: uses: pat-s/always-upload-cache@v1.1.4 with: path: ${{ steps.composer-cache.outputs.dir }} - # Use the hash of composer.json as the key for your cache if you do not commit composer.lock. + # Use the hash of composer.json as the key for your cache if you do not commit composer.lock. key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }} #key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }} restore-keys: ${{ runner.os }}-composer- diff --git a/.github/workflows/phpunit.yml b/.github/workflows/phpunit.yml index cf53773..4c70a1e 100644 --- a/.github/workflows/phpunit.yml +++ b/.github/workflows/phpunit.yml @@ -1,9 +1,9 @@ name: Unit Testing -on: - push: - pull_request: +on: + push: + pull_request: jobs: - phpcs: + phpunit: runs-on: ubuntu-latest services: mysql: @@ -15,7 +15,7 @@ jobs: options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=10s --health-retries=10 strategy: matrix: - php-versions: ['5.6', '7.2', '7.3', '7.4', '8.0', '8.1'] + php-versions: ['5.6', '7.2', '7.3', '7.4', '8.0', '8.1', '8.2'] steps: - name: Checkout uses: actions/checkout@v2 @@ -24,7 +24,7 @@ jobs: with: php-version: ${{ matrix.php-versions }} coverage: none - tools: composer, phpunit-polyfills + tools: composer, phpunit-polyfills extensions: mysql - name: Install Composer dependencies for PHP uses: "ramsey/composer-install@v1" diff --git a/.github/workflows/update-assets.yml b/.github/workflows/update-assets.yml index 06a7c71..2a9955a 100644 --- a/.github/workflows/update-assets.yml +++ b/.github/workflows/update-assets.yml @@ -10,7 +10,7 @@ jobs: steps: - uses: actions/checkout@master - name: WordPress.org plugin asset/readme update - uses: 10up/action-wordpress-plugin-asset-update@master + uses: 10up/action-wordpress-plugin-asset-update@stable env: SVN_PASSWORD: ${{ secrets.SVN_PASSWORD }} SVN_USERNAME: ${{ secrets.SVN_USERNAME }} diff --git a/.gitignore b/.gitignore index 6012ccb..4606504 100644 --- a/.gitignore +++ b/.gitignore @@ -5,3 +5,5 @@ composer.lock .DS_Store .idea/ .php_cs.cache +.vscode/settings.json +.phpunit.result.cache diff --git a/.wordpress-org/banner-772x250-v1.png b/.wordpress-org/banner-772x250-v1.png new file mode 100644 index 0000000..7006253 Binary files /dev/null and b/.wordpress-org/banner-772x250-v1.png differ diff --git a/.wordpress-org/banner-772x250.png b/.wordpress-org/banner-772x250.png index 7006253..bf84cb3 100644 Binary files a/.wordpress-org/banner-772x250.png and b/.wordpress-org/banner-772x250.png differ diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..3b056fd --- /dev/null +++ b/Dockerfile @@ -0,0 +1,27 @@ +FROM php:7.4-alpine3.13 + +RUN mkdir /app + +WORKDIR /app + +# Install Git, NPM & needed libraries +RUN apk update \ + && apk add bash git nodejs npm gettext subversion mysql mysql-client zip \ + && rm -f /var/cache/apk/* + +RUN docker-php-ext-install mysqli + +# Install Composer +RUN EXPECTED_CHECKSUM=$(curl -s https://composer.github.io/installer.sig) \ + && curl https://getcomposer.org/installer -o composer-setup.php \ + && ACTUAL_CHECKSUM="$(php -r "echo hash_file('sha384', 'composer-setup.php');")" \ + && if [ "$EXPECTED_CHECKSUM" != "$ACTUAL_CHECKSUM" ]; then >&2 echo 'ERROR: Invalid installer checksum'; rm composer-setup.php; exit 1; fi \ + && php composer-setup.php --quiet \ + && php -r "unlink('composer-setup.php');" \ + && mv composer.phar /usr/local/bin/composer + +RUN curl -O https://raw.githubusercontent.com/wp-cli/builds/gh-pages/phar/wp-cli.phar && \ + chmod +x wp-cli.phar && \ + mv wp-cli.phar /usr/local/bin/wp + +RUN chmod +x -R ./ diff --git a/README.md b/README.md index ecab103..9de8b8f 100644 --- a/README.md +++ b/README.md @@ -1,10 +1,10 @@ # ActivityPub # -**Contributors:** [pfefferle](https://profiles.wordpress.org/pfefferle), [mediaformat](https://profiles.wordpress.org/mediaformat) +**Contributors:** [pfefferle](https://profiles.wordpress.org/pfefferle/), [mediaformat](https://profiles.wordpress.org/mediaformat/), [akirk](https://profiles.wordpress.org/akirk/) **Donate link:** https://notiz.blog/donate/ **Tags:** OStatus, fediverse, activitypub, activitystream **Requires at least:** 4.7 -**Tested up to:** 5.9 -**Stable tag:** 0.13.3 +**Tested up to:** 6.1 +**Stable tag:** 0.16.2 **Requires PHP:** 5.6 **License:** MIT **License URI:** http://opensource.org/licenses/MIT @@ -88,6 +88,53 @@ Where 'blog' is the path to the subdirectory at which your blog resides. Project maintained on GitHub at [pfefferle/wordpress-activitypub](https://github.com/pfefferle/wordpress-activitypub). +### 0.16.2 ### + +* Fix fatal error in outbox + +### 0.16.1 ### + +* Fix "update and create, posts appear blank on Mastodon" issue + +### 0.16.0 ### + +* Add "Outgoing Mentions" ([#213](https://github.com/pfefferle/wordpress-activitypub/pull/213)) props [@akirk](https://github.com/akirk) +* Add configuration item for number of images to attach ([#248](https://github.com/pfefferle/wordpress-activitypub/pull/248)) props [@mexon](https://github.com/mexon) +* Use shortcodes instead of custom templates, to setup the Activity Post-Content ([#250](https://github.com/pfefferle/wordpress-activitypub/pull/250)) props [@toolstack](https://github.com/toolstack) +* Remove custom REST Server, because the needed changes are now merged into Core. +* Fix hashtags ([#261](https://github.com/pfefferle/wordpress-activitypub/pull/261)) props [@akirk](https://github.com/akirk) +* Change priorites, to maybe fix the hashtag issue + +### 0.15.0 ### + +* Enable ActivityPub only for users that can `publish_posts` +* Persist only public Activities +* Fix remote-delete + +### 0.14.3 ### + +* Better error handling. props [@akirk](https://github.com/akirk) + +### 0.14.2 ### + +* Fix Critical error when using Friends Plugin and adding new URL to follow. props [@akirk](https://github.com/akirk) + +### 0.14.1 ### + +* Fix "WebFinger not compatible with PHP < 8.0". props [@mexon](https://github.com/mexon) + +### 0.14.0 ### + +* Friends support: https://wordpress.org/plugins/friends/ props [@akirk](https://github.com/akirk) +* Massive guidance improvements. props [mediaformat](https://github.com/mediaformat) & [@akirk](https://github.com/akirk) +* Add Custom Post Type support to outbox API. props [blueset](https://github.com/blueset) +* Better hash-tag support. props [bocops](https://github.com/bocops) +* Fix user-count (NodeInfo). props [mediaformat](https://github.com/mediaformat) + +### 0.13.4 ### + +* fix webfinger for email identifiers + ### 0.13.3 ### * fix: Create and Note should not have the same ActivityPub ID diff --git a/activitypub.php b/activitypub.php index 1e69abc..fe50550 100644 --- a/activitypub.php +++ b/activitypub.php @@ -3,7 +3,7 @@ * Plugin Name: ActivityPub * Plugin URI: https://github.com/pfefferle/wordpress-activitypub/ * Description: The ActivityPub protocol is a decentralized social networking protocol based upon the ActivityStreams 2.0 data format. - * Version: 0.13.3 + * Version: 0.16.2 * Author: Matthias Pfefferle * Author URI: https://notiz.blog/ * License: MIT @@ -21,12 +21,19 @@ require __DIR__ . '/vendor/autoload.php'; * Initialize plugin */ function init() { - \defined( 'ACTIVITYPUB_HASHTAGS_REGEXP' ) || \define( 'ACTIVITYPUB_HASHTAGS_REGEXP', '(?:(?<=\s)|^)#(\w*[A-Za-z_]+\w*)' ); + \defined( 'ACTIVITYPUB_EXCERPT_LENGTH' ) || \define( 'ACTIVITYPUB_EXCERPT_LENGTH', 400 ); + \defined( 'ACTIVITYPUB_MAX_IMAGE_ATTACHMENTS' ) || \define( 'ACTIVITYPUB_MAX_IMAGE_ATTACHMENTS', 3 ); + \defined( 'ACTIVITYPUB_HASHTAGS_REGEXP' ) || \define( 'ACTIVITYPUB_HASHTAGS_REGEXP', '(?:(?<=\s)|(?<=

)|(?<=
)|^)#([A-Za-z0-9_]+)(?:(?=\s|[[:punct:]]|$))' ); + \defined( 'ACTIVITYPUB_USERNAME_REGEXP' ) || \define( 'ACTIVITYPUB_USERNAME_REGEXP', '(?:([A-Za-z0-9_-]+)@((?:[A-Za-z0-9_-]+\.)+[A-Za-z]+))' ); \defined( 'ACTIVITYPUB_ALLOWED_HTML' ) || \define( 'ACTIVITYPUB_ALLOWED_HTML', '