chore: update to latest fastapi (#2240)

security alert https://github.com/lnbits/lnbits/security/dependabot/46
This commit is contained in:
dni ⚡
2024-02-06 11:47:36 -03:00
committed by GitHub
parent 59968e38d1
commit c8e5c23ac2
4 changed files with 30 additions and 46 deletions
+1 -1
View File
@@ -8,8 +8,8 @@ from starlette.templating import Jinja2Templates as SuperJinja2Templates
class Jinja2Templates(SuperJinja2Templates):
def __init__(self, loader: BaseLoader) -> None:
super().__init__("")
self.env = self.get_environment(loader)
super().__init__(env=self.env)
def get_environment(self, loader: BaseLoader) -> Environment:
@pass_context
+6 -1
View File
@@ -187,7 +187,12 @@ class ExtensionsRedirectMiddleware:
def add_ratelimit_middleware(app: FastAPI):
core_app_extra.register_new_ratelimiter()
app.add_exception_handler(RateLimitExceeded, _rate_limit_exceeded_handler)
# latest https://slowapi.readthedocs.io/en/latest/
# shows this as a valid way to add the handler
app.add_exception_handler(
RateLimitExceeded,
_rate_limit_exceeded_handler, # type: ignore
)
app.add_middleware(SlowAPIMiddleware)