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

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"
},
"devDependencies": {
"@babel/core": "^7.19.6",
"@babel/preset-env": "^7.19.4",
"@babel/core": "^7.20.2",
"@babel/preset-env": "^7.20.2",
"autoprefixer": "^10.4.13",
"babel-loader": "^9.1.0",
"browserlist": "^1.0.1",
"compression-webpack-plugin": "^10.0.0",
"css-loader": "^6.2.0",
"cssnano": "^5.1.14",
"eslint": "^8.26.0",
"eslint": "^8.27.0",
"eslint-webpack-plugin": "^3.2.0",
"mini-css-extract-plugin": "^2.6.1",
"postcss": "^8.4.18",

View file

@ -109,4 +109,18 @@ class SendWebMentionJobTest extends TestCase
$job->handle();
$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'));
}
}