From a904294db09ccaa93a5b561e7cd177026010e601 Mon Sep 17 00:00:00 2001 From: winter Date: Wed, 7 May 2025 19:37:08 +0100 Subject: implement extension objects at a basic level --- routes/extension.php | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 routes/extension.php (limited to 'routes') diff --git a/routes/extension.php b/routes/extension.php new file mode 100644 index 0000000..50413e8 --- /dev/null +++ b/routes/extension.php @@ -0,0 +1,21 @@ +mount('/extension/:id', function (array $args) { + $obj = ExtensionObject::find($args['id']); + $instance = Instance::findByRequestHeaders(); + if ($obj == null || $obj->deleted) { + throw new NotFound("i don't know that extension object"); + } + if (hostname_from_uri($obj->uri) != GlobalConfig::getInstance()->getCanonicalHost()) { + throw new NotFound("i don't want to tell you about non local objects sorry"); + } + PolicyManager::getInstance()->checkFederationOrThrow($obj, $instance); + json_response($obj); +}); \ No newline at end of file -- cgit v1.3