Skeleton Micropub endpoint

This commit is contained in:
2025-06-13 08:33:08 +01:00
parent f4981e961a
commit 3abbb8e805
5 changed files with 94 additions and 1 deletions

View File

@@ -13,6 +13,7 @@
"doctrine/orm": "^3.3", "doctrine/orm": "^3.3",
"league/commonmark": "^2.7", "league/commonmark": "^2.7",
"league/html-to-markdown": "^5.1", "league/html-to-markdown": "^5.1",
"p3k/micropub": "^0.0.3",
"phpdocumentor/reflection-docblock": "^5.6", "phpdocumentor/reflection-docblock": "^5.6",
"phpstan/phpdoc-parser": "^2.1", "phpstan/phpdoc-parser": "^2.1",
"symfony/asset": "7.2.*", "symfony/asset": "7.2.*",
@@ -77,6 +78,12 @@
"symfony/polyfill-php81": "*", "symfony/polyfill-php81": "*",
"symfony/polyfill-php82": "*" "symfony/polyfill-php82": "*"
}, },
"repositories": [
{
"type": "vcs",
"url": "https://github.com/aaronpk/p3k-micropub"
}
],
"scripts": { "scripts": {
"auto-scripts": { "auto-scripts": {
"cache:clear": "symfony-cmd", "cache:clear": "symfony-cmd",

49
symfony/composer.lock generated
View File

@@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically" "This file is @generated automatically"
], ],
"content-hash": "194a6d80a9896ce73994dc1b6c059f1d", "content-hash": "0e4945ad03f5f6c95ed858b69be0e442",
"packages": [ "packages": [
{ {
"name": "composer/semver", "name": "composer/semver",
@@ -1975,6 +1975,53 @@
}, },
"time": "2025-03-30T21:06:30+00:00" "time": "2025-03-30T21:06:30+00:00"
}, },
{
"name": "p3k/micropub",
"version": "0.0.3",
"source": {
"type": "git",
"url": "https://github.com/aaronpk/p3k-micropub.git",
"reference": "9e3b2f7c1d4d40fef5cbd955689b8e7392a6976d"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/aaronpk/p3k-micropub/zipball/9e3b2f7c1d4d40fef5cbd955689b8e7392a6976d",
"reference": "9e3b2f7c1d4d40fef5cbd955689b8e7392a6976d",
"shasum": ""
},
"require": {
"php": ">=5.6.0"
},
"require-dev": {
"phpunit/phpunit": "^5"
},
"type": "library",
"autoload": {
"psr-0": {
"p3k": "src/"
}
},
"license": [
"Apache-2.0"
],
"authors": [
{
"name": "Aaron Parecki",
"homepage": "https://aaronparecki.com"
}
],
"description": "Utilities to help handle Micropub requests when building servers and clients",
"keywords": [
"indieweb",
"micropub",
"p3k"
],
"support": {
"source": "https://github.com/aaronpk/p3k-micropub/tree/0.0.3",
"issues": "https://github.com/aaronpk/p3k-micropub/issues"
},
"time": "2018-04-16T14:05:38+00:00"
},
{ {
"name": "phpdocumentor/reflection-common", "name": "phpdocumentor/reflection-common",
"version": "2.2.0", "version": "2.2.0",

View File

@@ -42,6 +42,7 @@ class GuiController extends AbstractController {
'description' => 'Joe Carstairs\' personal website', 'description' => 'Joe Carstairs\' personal website',
]; ];
} }
/** /**
* @return array<string,mixed> * @return array<string,mixed>
*/ */

View File

@@ -0,0 +1,29 @@
<?php
namespace App\Controller;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpKernel\Attribute\MapRequestPayload;
use Symfony\Component\Routing\Annotation\Route;
use \p3k\Micropub\Request as MicropubRequest;
class MicropubController extends AbstractController {
/**
* @param $request
* @return Response
*/
#[Route('/micropub', name: 'blog_micropub', methods: ['POST'])]
public function blog(
#[MapRequestPayload]
array $request,
): Response {
$micropubRequest = MicropubRequest::create($request);
return new Response(
json_encode($micropubRequest->toMf2()),
Response::HTTP_NOT_IMPLEMENTED,
['content-type' => 'application/json'],
);
}
}

View File

@@ -1,4 +1,13 @@
{ {
"doctrine/deprecations": {
"version": "1.1",
"recipe": {
"repo": "github.com/symfony/recipes",
"branch": "main",
"version": "1.0",
"ref": "87424683adc81d7dc305eefec1fced883084aab9"
}
},
"doctrine/doctrine-bundle": { "doctrine/doctrine-bundle": {
"version": "2.14", "version": "2.14",
"recipe": { "recipe": {