Merge pull request #535 from jonnybarnes/develop

MTM Handle finding webmention targets better
This commit is contained in:
Jonny Barnes 2022-11-09 20:10:55 +00:00 committed by GitHub
commit 30c9b2e248
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 318 additions and 485 deletions

View file

@ -100,9 +100,12 @@ class SendWebMentions implements ShouldQueue
} elseif (array_key_exists('http://webmention.org/', $rels[0])) { } elseif (array_key_exists('http://webmention.org/', $rels[0])) {
$endpoint = $rels[0]['http://webmention.org/'][0]; $endpoint = $rels[0]['http://webmention.org/'][0];
} }
if ($endpoint) {
return $this->resolveUri($endpoint, $url); if ($endpoint === null) {
return null;
} }
return $this->resolveUri($endpoint, $url);
} }
/** /**

92
composer.lock generated
View file

@ -1341,31 +1341,31 @@
}, },
{ {
"name": "indieauth/client", "name": "indieauth/client",
"version": "1.1.5", "version": "1.1.6",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/indieweb/indieauth-client-php.git", "url": "https://github.com/indieweb/indieauth-client-php.git",
"reference": "2ebd8396913ae8c72438dc24f037c8e1717b66ed" "reference": "9f3f9cc71a752c371b44d40a979504ffd7026c7d"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/indieweb/indieauth-client-php/zipball/2ebd8396913ae8c72438dc24f037c8e1717b66ed", "url": "https://api.github.com/repos/indieweb/indieauth-client-php/zipball/9f3f9cc71a752c371b44d40a979504ffd7026c7d",
"reference": "2ebd8396913ae8c72438dc24f037c8e1717b66ed", "reference": "9f3f9cc71a752c371b44d40a979504ffd7026c7d",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
"indieweb/representative-h-card": "^0.1.2", "indieweb/representative-h-card": "^0.1.2",
"mf2/mf2": ">=0.3.2", "mf2/mf2": "^0.5",
"p3k/http": ">=0.1.6", "p3k/http": "^0.1",
"php": ">5.6.0" "php": ">5.6.0"
}, },
"require-dev": { "require-dev": {
"phpunit/phpunit": "4.8.*" "yoast/phpunit-polyfills": "^1.0"
}, },
"type": "library", "type": "library",
"autoload": { "autoload": {
"psr-0": { "psr-4": {
"IndieAuth": "src/" "IndieAuth\\": "src/IndieAuth/"
} }
}, },
"notification-url": "https://packagist.org/downloads/", "notification-url": "https://packagist.org/downloads/",
@ -1381,7 +1381,7 @@
"description": "IndieAuth Client Library", "description": "IndieAuth Client Library",
"support": { "support": {
"issues": "https://github.com/indieweb/indieauth-client-php/issues", "issues": "https://github.com/indieweb/indieauth-client-php/issues",
"source": "https://github.com/indieweb/indieauth-client-php/tree/1.1.5" "source": "https://github.com/indieweb/indieauth-client-php/tree/1.1.6"
}, },
"funding": [ "funding": [
{ {
@ -1389,7 +1389,7 @@
"type": "opencollective" "type": "opencollective"
} }
], ],
"time": "2021-01-10T00:19:07+00:00" "time": "2022-11-08T21:37:04+00:00"
}, },
{ {
"name": "indieweb/link-rel-parser", "name": "indieweb/link-rel-parser",
@ -1741,16 +1741,16 @@
}, },
{ {
"name": "laravel/framework", "name": "laravel/framework",
"version": "v9.38.0", "version": "v9.39.0",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/laravel/framework.git", "url": "https://github.com/laravel/framework.git",
"reference": "abf198e443e06696af3f356b44de67c0fa516107" "reference": "67e674709e1e7db14f304a871481f310822d68c5"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/laravel/framework/zipball/abf198e443e06696af3f356b44de67c0fa516107", "url": "https://api.github.com/repos/laravel/framework/zipball/67e674709e1e7db14f304a871481f310822d68c5",
"reference": "abf198e443e06696af3f356b44de67c0fa516107", "reference": "67e674709e1e7db14f304a871481f310822d68c5",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -1923,20 +1923,20 @@
"issues": "https://github.com/laravel/framework/issues", "issues": "https://github.com/laravel/framework/issues",
"source": "https://github.com/laravel/framework" "source": "https://github.com/laravel/framework"
}, },
"time": "2022-11-01T14:05:55+00:00" "time": "2022-11-08T14:47:39+00:00"
}, },
{ {
"name": "laravel/horizon", "name": "laravel/horizon",
"version": "v5.10.3", "version": "v5.10.4",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/laravel/horizon.git", "url": "https://github.com/laravel/horizon.git",
"reference": "22403726851d62c45051114c89106130c348decc" "reference": "07a5d73b804c6ba17598e378057f4353c983fb3a"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/laravel/horizon/zipball/22403726851d62c45051114c89106130c348decc", "url": "https://api.github.com/repos/laravel/horizon/zipball/07a5d73b804c6ba17598e378057f4353c983fb3a",
"reference": "22403726851d62c45051114c89106130c348decc", "reference": "07a5d73b804c6ba17598e378057f4353c983fb3a",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -1998,9 +1998,9 @@
], ],
"support": { "support": {
"issues": "https://github.com/laravel/horizon/issues", "issues": "https://github.com/laravel/horizon/issues",
"source": "https://github.com/laravel/horizon/tree/v5.10.3" "source": "https://github.com/laravel/horizon/tree/v5.10.4"
}, },
"time": "2022-10-14T13:33:44+00:00" "time": "2022-11-07T08:57:31+00:00"
}, },
{ {
"name": "laravel/serializable-closure", "name": "laravel/serializable-closure",
@ -3200,16 +3200,16 @@
}, },
{ {
"name": "nesbot/carbon", "name": "nesbot/carbon",
"version": "2.62.1", "version": "2.63.0",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/briannesbitt/Carbon.git", "url": "https://github.com/briannesbitt/Carbon.git",
"reference": "01bc4cdefe98ef58d1f9cb31bdbbddddf2a88f7a" "reference": "ad35dd71a6a212b98e4b87e97389b6fa85f0e347"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/briannesbitt/Carbon/zipball/01bc4cdefe98ef58d1f9cb31bdbbddddf2a88f7a", "url": "https://api.github.com/repos/briannesbitt/Carbon/zipball/ad35dd71a6a212b98e4b87e97389b6fa85f0e347",
"reference": "01bc4cdefe98ef58d1f9cb31bdbbddddf2a88f7a", "reference": "ad35dd71a6a212b98e4b87e97389b6fa85f0e347",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -3298,7 +3298,7 @@
"type": "tidelift" "type": "tidelift"
} }
], ],
"time": "2022-09-02T07:48:13+00:00" "time": "2022-10-30T18:34:28+00:00"
}, },
{ {
"name": "nette/schema", "name": "nette/schema",
@ -4271,21 +4271,20 @@
}, },
{ {
"name": "ramsey/uuid", "name": "ramsey/uuid",
"version": "4.5.1", "version": "4.6.0",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/ramsey/uuid.git", "url": "https://github.com/ramsey/uuid.git",
"reference": "a161a26d917604dc6d3aa25100fddf2556e9f35d" "reference": "ad63bc700e7d021039e30ce464eba384c4a1d40f"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/ramsey/uuid/zipball/a161a26d917604dc6d3aa25100fddf2556e9f35d", "url": "https://api.github.com/repos/ramsey/uuid/zipball/ad63bc700e7d021039e30ce464eba384c4a1d40f",
"reference": "a161a26d917604dc6d3aa25100fddf2556e9f35d", "reference": "ad63bc700e7d021039e30ce464eba384c4a1d40f",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
"brick/math": "^0.8.8 || ^0.9 || ^0.10", "brick/math": "^0.8.8 || ^0.9 || ^0.10",
"ext-ctype": "*",
"ext-json": "*", "ext-json": "*",
"php": "^8.0", "php": "^8.0",
"ramsey/collection": "^1.0" "ramsey/collection": "^1.0"
@ -4317,7 +4316,6 @@
}, },
"suggest": { "suggest": {
"ext-bcmath": "Enables faster math with arbitrary-precision integers using BCMath.", "ext-bcmath": "Enables faster math with arbitrary-precision integers using BCMath.",
"ext-ctype": "Enables faster processing of character classification using ctype functions.",
"ext-gmp": "Enables faster math with arbitrary-precision integers using GMP.", "ext-gmp": "Enables faster math with arbitrary-precision integers using GMP.",
"ext-uuid": "Enables the use of PeclUuidTimeGenerator and PeclUuidRandomGenerator.", "ext-uuid": "Enables the use of PeclUuidTimeGenerator and PeclUuidRandomGenerator.",
"paragonie/random-lib": "Provides RandomLib for use with the RandomLibAdapter", "paragonie/random-lib": "Provides RandomLib for use with the RandomLibAdapter",
@ -4349,7 +4347,7 @@
], ],
"support": { "support": {
"issues": "https://github.com/ramsey/uuid/issues", "issues": "https://github.com/ramsey/uuid/issues",
"source": "https://github.com/ramsey/uuid/tree/4.5.1" "source": "https://github.com/ramsey/uuid/tree/4.6.0"
}, },
"funding": [ "funding": [
{ {
@ -4361,7 +4359,7 @@
"type": "tidelift" "type": "tidelift"
} }
], ],
"time": "2022-09-16T03:22:46+00:00" "time": "2022-11-05T23:03:38+00:00"
}, },
{ {
"name": "scrivo/highlight.php", "name": "scrivo/highlight.php",
@ -7923,16 +7921,16 @@
}, },
{ {
"name": "composer/pcre", "name": "composer/pcre",
"version": "3.0.0", "version": "3.0.2",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/composer/pcre.git", "url": "https://github.com/composer/pcre.git",
"reference": "e300eb6c535192decd27a85bc72a9290f0d6b3bd" "reference": "4482b6409ca6bfc2af043a5711cd21ac3e7a8dfb"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/composer/pcre/zipball/e300eb6c535192decd27a85bc72a9290f0d6b3bd", "url": "https://api.github.com/repos/composer/pcre/zipball/4482b6409ca6bfc2af043a5711cd21ac3e7a8dfb",
"reference": "e300eb6c535192decd27a85bc72a9290f0d6b3bd", "reference": "4482b6409ca6bfc2af043a5711cd21ac3e7a8dfb",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -7974,7 +7972,7 @@
], ],
"support": { "support": {
"issues": "https://github.com/composer/pcre/issues", "issues": "https://github.com/composer/pcre/issues",
"source": "https://github.com/composer/pcre/tree/3.0.0" "source": "https://github.com/composer/pcre/tree/3.0.2"
}, },
"funding": [ "funding": [
{ {
@ -7990,7 +7988,7 @@
"type": "tidelift" "type": "tidelift"
} }
], ],
"time": "2022-02-25T20:21:48+00:00" "time": "2022-11-03T20:24:16+00:00"
}, },
{ {
"name": "composer/semver", "name": "composer/semver",
@ -11994,16 +11992,16 @@
}, },
{ {
"name": "vimeo/psalm", "name": "vimeo/psalm",
"version": "4.29.0", "version": "4.30.0",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/vimeo/psalm.git", "url": "https://github.com/vimeo/psalm.git",
"reference": "7ec5ffbd5f68ae03782d7fd33fff0c45a69f95b3" "reference": "d0bc6e25d89f649e4f36a534f330f8bb4643dd69"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/vimeo/psalm/zipball/7ec5ffbd5f68ae03782d7fd33fff0c45a69f95b3", "url": "https://api.github.com/repos/vimeo/psalm/zipball/d0bc6e25d89f649e4f36a534f330f8bb4643dd69",
"reference": "7ec5ffbd5f68ae03782d7fd33fff0c45a69f95b3", "reference": "d0bc6e25d89f649e4f36a534f330f8bb4643dd69",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@ -12096,9 +12094,9 @@
], ],
"support": { "support": {
"issues": "https://github.com/vimeo/psalm/issues", "issues": "https://github.com/vimeo/psalm/issues",
"source": "https://github.com/vimeo/psalm/tree/4.29.0" "source": "https://github.com/vimeo/psalm/tree/4.30.0"
}, },
"time": "2022-10-11T17:09:17+00:00" "time": "2022-11-06T20:37:08+00:00"
}, },
{ {
"name": "webmozart/path-util", "name": "webmozart/path-util",

684
package-lock.json generated

File diff suppressed because it is too large Load diff

View file

@ -9,15 +9,15 @@
"puppeteer": "^19.2.2" "puppeteer": "^19.2.2"
}, },
"devDependencies": { "devDependencies": {
"@babel/core": "^7.19.6", "@babel/core": "^7.20.2",
"@babel/preset-env": "^7.19.4", "@babel/preset-env": "^7.20.2",
"autoprefixer": "^10.4.13", "autoprefixer": "^10.4.13",
"babel-loader": "^9.1.0", "babel-loader": "^9.1.0",
"browserlist": "^1.0.1", "browserlist": "^1.0.1",
"compression-webpack-plugin": "^10.0.0", "compression-webpack-plugin": "^10.0.0",
"css-loader": "^6.2.0", "css-loader": "^6.2.0",
"cssnano": "^5.1.14", "cssnano": "^5.1.14",
"eslint": "^8.26.0", "eslint": "^8.27.0",
"eslint-webpack-plugin": "^3.2.0", "eslint-webpack-plugin": "^3.2.0",
"mini-css-extract-plugin": "^2.6.1", "mini-css-extract-plugin": "^2.6.1",
"postcss": "^8.4.18", "postcss": "^8.4.18",

View file

@ -109,4 +109,18 @@ class SendWebMentionJobTest extends TestCase
$job->handle(); $job->handle();
$this->assertTrue(true); $this->assertTrue(true);
} }
/** @test */
public function linksInNotesCanNotSupportWebmentions(): void
{
$mock = new MockHandler([
new Response(200),
]);
$handler = HandlerStack::create($mock);
$client = new Client(['handler' => $handler]);
$this->app->instance(Client::class, $client);
$job = new SendWebMentions(new Note());
$this->assertNull($job->discoverWebmentionEndpoint('https://example.org'));
}
} }