Bit of work to set things up
This commit is contained in:
parent
811f63a207
commit
a5e0902366
2
.gitignore
vendored
2
.gitignore
vendored
@ -1 +1,3 @@
|
|||||||
/vendor/
|
/vendor/
|
||||||
|
/.phpunit.result.cache
|
||||||
|
.idea
|
||||||
|
12
index.php
12
index.php
@ -11,13 +11,12 @@ use Lewisdale\Webmentions\Router\Response;
|
|||||||
use Lewisdale\Webmentions\Router\StatusCode;
|
use Lewisdale\Webmentions\Router\StatusCode;
|
||||||
use Lewisdale\Webmentions\Webmention;
|
use Lewisdale\Webmentions\Webmention;
|
||||||
|
|
||||||
$mentioner = new Webmention();
|
|
||||||
|
|
||||||
$router = new Router();
|
$router = new Router();
|
||||||
|
|
||||||
$router->post("/send", function(Request $req, Response $response) use ($webmention) {
|
$router->post("/send", function(Request $req, Response $response) {
|
||||||
$source = $req->query["source"];
|
$mentioner = new Webmention();
|
||||||
$webmention->sendForPage($source);
|
$source = $req->query["source"];
|
||||||
|
$mentioner->sendForPage($source);
|
||||||
});
|
});
|
||||||
|
|
||||||
$router->post("/endpoint", function(Request $req, Response $response) {
|
$router->post("/endpoint", function(Request $req, Response $response) {
|
||||||
@ -39,6 +38,5 @@ $router->post("/endpoint", function(Request $req, Response $response) {
|
|||||||
$response->status_code = StatusCode::Created;
|
$response->status_code = StatusCode::Created;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
$router->get('/', fn($req, $res) => "<h1>Webmention server</h1>");
|
||||||
$router->dispatch();
|
$router->dispatch();
|
||||||
|
|
||||||
?>
|
|
@ -112,7 +112,7 @@ class Endpoint {
|
|||||||
{
|
{
|
||||||
$card = $document->filter('.p-author.h-card')->eq(0);
|
$card = $document->filter('.p-author.h-card')->eq(0);
|
||||||
|
|
||||||
if ($card)
|
if ($card->count())
|
||||||
{
|
{
|
||||||
$name = $card->filter('.p-name')?->text("");
|
$name = $card->filter('.p-name')?->text("");
|
||||||
$url = $card->filter('.u-url')?->text("");
|
$url = $card->filter('.u-url')?->text("");
|
||||||
|
@ -119,9 +119,11 @@ class EndpointTest extends TestCase {
|
|||||||
<head>
|
<head>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<h1>Some content</h1>
|
<article>
|
||||||
<p>Here's some body content. It <a href="/another/page">contains a url</a>.</p>
|
<h1>Some content</h1>
|
||||||
<p>I'm liking <a href="$target" class="u-like-of">this post</a>.</p>
|
<p>Here's some body content. It <a href="/another/page">contains a url</a>.</p>
|
||||||
|
<p>I'm liking <a href="$target" class="u-like-of">this post</a>.</p>
|
||||||
|
</article>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
XML;
|
XML;
|
||||||
@ -160,9 +162,11 @@ class EndpointTest extends TestCase {
|
|||||||
<head>
|
<head>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<h1>Some content</h1>
|
<article class="h-entry">
|
||||||
<p>Here's some body content. It <a href="/another/page">contains a url</a>.</p>
|
<h1>Some content</h1>
|
||||||
<p>I'm writing about <a href="$target" class="my-link">this post</a>.</p>
|
<p>Here's some body content. It <a href="/another/page">contains a url</a>.</p>
|
||||||
|
<p>I'm writing about <a href="$target" class="my-link">this post</a>.</p>
|
||||||
|
</article>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
XML;
|
XML;
|
||||||
@ -200,9 +204,11 @@ class EndpointTest extends TestCase {
|
|||||||
<head>
|
<head>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<h1>Some content</h1>
|
<article class="h-entry">
|
||||||
<p>Here's some body content. It <a href="/another/page">contains a url</a>.</p>
|
<h1>Some content</h1>
|
||||||
<p>I'm writing about <a href="$target" class="u-in-reply-to">this post</a>.</p>
|
<p>Here's some body content. It <a href="/another/page">contains a url</a>.</p>
|
||||||
|
<p>I'm writing about <a href="$target" class="u-in-reply-to">this post</a>.</p>
|
||||||
|
</article>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
XML;
|
XML;
|
||||||
@ -240,9 +246,11 @@ class EndpointTest extends TestCase {
|
|||||||
<head>
|
<head>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<h1>Some content</h1>
|
<article="h-entry">
|
||||||
<p>Here's some body content. It <a href="/another/page">contains a url</a>.</p>
|
<h1>Some content</h1>
|
||||||
<p>I'm writing about <a href="$target" class="u-repost-of">this post</a>.</p>
|
<p>Here's some body content. It <a href="/another/page">contains a url</a>.</p>
|
||||||
|
<p>I'm writing about <a href="$target" class="u-repost-of">this post</a>.</p>
|
||||||
|
</article>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
XML;
|
XML;
|
||||||
|
Loading…
Reference in New Issue
Block a user