Add some rudimentary authentication to the API

This commit is contained in:
Lewis Dale committed 2023-03-21 09:09:24 +00:00
1 parent 7dc9d0a5cb
commit 4c4fffaf9d
9 files changed
+397 -34

No files matched your search

+7 -3
View File
@@ -2,6 +2,7 @@
require_once __DIR__ . "/vendor/autoload.php";
use Lewisdale\Webmentions\Api\WebmentionApi;
use Lewisdale\Webmentions\Endpoint;
use Lewisdale\Webmentions\Exceptions\InvalidSourceException;
use Lewisdale\Webmentions\Exceptions\InvalidTargetException;
@@ -16,10 +17,13 @@ use Lewisdale\Webmentions\Router\StatusCode;
use Lewisdale\Webmentions\Webmention;
use Symfony\Component\HttpClient\HttpClient;
$router = new Router();
$gateway = new SqliteGateway("webmentions.db");
$dotenv = Dotenv\Dotenv::createImmutable(__DIR__);
$dotenv->load();
$apiController = new \Lewisdale\Webmentions\Api\WebmentionApi($gateway);
$router = new Router();
$gateway = new SqliteGateway($_ENV["DB"]);
$apiController = new WebmentionApi($gateway);
$router->post("/send", function (Request $req, Response $response) {
$mentioner = new Webmention();