From 4b75a9b6d11459183ea92f10f1cbac88c2915c26 Mon Sep 17 00:00:00 2001 From: Christian Weiske Date: Mon, 17 Nov 2025 15:11:32 +0100 Subject: [PATCH 1/1] --- README.rst | 1 + phork0.php | 32 ++++++++++++++++++++++++++++++++ 2 files changed, 33 insertions(+) create mode 100644 README.rst create mode 100644 phork0.php diff --git a/README.rst b/README.rst new file mode 100644 index 0000000..6a21696 --- /dev/null +++ b/README.rst @@ -0,0 +1 @@ +Pretty hacky, but works on TYPO3 v13. \ No newline at end of file diff --git a/phork0.php b/phork0.php new file mode 100644 index 0000000..c6f23b0 --- /dev/null +++ b/phork0.php @@ -0,0 +1,32 @@ +getTsfe(); + $typoscript = $tsfe->getConfigArray(); + + $headers = $typoscript['additionalHeaders.'] ?? []; + $headers['910.'] = ['header' => 'X-RateLimit-Remaining: ' . $limit->getRemainingTokens()]; + $headers['911.'] = ['header' => 'X-RateLimit-Retry-After: ' . $limit->getRetryAfter()->getTimestamp() - time()]; + $headers['912.'] = ['header' => 'X-RateLimit-Limit: ' . $limit->getLimit()]; + + + $typoscript['additionalHeaders.'] = $headers; + $tsfe->setConfigArray($typoscript); + } + + protected function getTsfe(): FrontendTypoScript + { + return $this->getRequest()->getAttribute('frontend.typoscript'); + } + + protected function getRequest(): ServerRequestInterface + { + return $GLOBALS['TYPO3_REQUEST']; + } -- 2.30.2