Disable API endpoints.

This commit is contained in:
James Cole
2023-12-29 08:42:03 +01:00
parent 4e6fc8e2a2
commit e4d91aa337
7 changed files with 64 additions and 0 deletions

View File

@@ -35,6 +35,7 @@ use Illuminate\Support\Facades\Log;
use League\Fractal\Pagination\IlluminatePaginatorAdapter;
use League\Fractal\Resource\Collection as FractalCollection;
use League\Fractal\Resource\Item;
use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
/**
* Class MessageController
@@ -65,6 +66,9 @@ class MessageController extends Controller
*/
public function index(Webhook $webhook): JsonResponse
{
if(false === config('firefly.allow_webhooks')) {
throw new NotFoundHttpException('Webhooks are not enabled.');
}
Log::channel('audit')->info(sprintf('User views messages of webhook #%d.', $webhook->id));
$manager = $this->getManager();
$pageSize = $this->parameters->get('limit');
@@ -100,6 +104,10 @@ class MessageController extends Controller
if ($message->webhook_id !== $webhook->id) {
throw new FireflyException('200040: Webhook and webhook message are no match');
}
if(false === config('firefly.allow_webhooks')) {
throw new NotFoundHttpException('Webhooks are not enabled.');
}
Log::channel('audit')->info(sprintf('User views message #%d of webhook #%d.', $message->id, $webhook->id));
$manager = $this->getManager();