From: Christian Weiske Date: Mon, 17 Nov 2025 14:11:32 +0000 (+0100) Subject: (no commit message) X-Git-Url: https://git.cweiske.de/paste/944.git/commitdiff_plain/refs/heads/master?ds=inline --- 4b75a9b6d11459183ea92f10f1cbac88c2915c26 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']; + }